Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: look up app slug in list of Helm apps #42

Merged
merged 1 commit into from
Apr 4, 2023
Merged

fix: look up app slug in list of Helm apps #42

merged 1 commit into from
Apr 4, 2023

Conversation

kelvintaywl
Copy link
Contributor

⚙️ Issue

When the k8s namespace has more than 1 Helm app installed, the kots-exporter will fail since the following command will return multilines.

$ helm list -n circleci -o yaml | yq '.[].name'
circleci-server
helloworld

Fix

I modified the yq command, using yq operators, to look up the list of Helm apps by name.
This fixes the case where the k8s namespace contains >1 Helm app.

Context

$ helm list -n circleci -o yaml | yq '.[].name'
circleci-server
helloworld

Before

$ ./kots-exporter/kots-exporter.sh -n circleci
Script Path: /Users/kelvin/personal/kelvintaywl-server-scripts/kots-exporter


############ CHECKING REQUIRED ARGUMENTS ################
License Key String: asdjkla

############ SET DEFAULT VALUES ################

############ CHECKING K8S NAMESPACE and HELM RELEASE ################
------->> Error: Helm release circleci-server does not exist.
[1]    20279 terminated  ./kots-exporter/kots-exporter.sh -n circleci

After

$ ./kots-exporter/kots-exporter.sh -n circleci
Script Path: /Users/kelvin/personal/kelvintaywl-server-scripts/kots-exporter


############ CHECKING REQUIRED ARGUMENTS ################
License Key String: asdjkla

############ SET DEFAULT VALUES ################

############ CHECKING K8S NAMESPACE and HELM RELEASE ################

############ CREATING FOLDERS ################
output folder has been created.

############ DOWNLOADING HELM VALUE ################

Downloading helm value file from release: circleci-server and namespace: circleci
++++ Helm value file download has completed
....
  • Tested Updating Existing Instance
  • Installed on new instance

This fixes the case where the k8s namespace contains >1 Helm app.
Copy link
Contributor

@ryanwohara ryanwohara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@soulchips soulchips merged commit d472837 into CircleCI-Public:main Apr 4, 2023
@kelvintaywl kelvintaywl deleted the fix-helm-app-lookup branch April 4, 2023 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants