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

[Bug] Install fails with --namespace helm install parameter if namespace doesn't exist #48

Closed
cmisale opened this issue Sep 26, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@cmisale
Copy link
Collaborator

cmisale commented Sep 26, 2024

Summary

A helm install command with --namespace=autopilot will fail if the autopilot namespace doesn't exist. This doesn't allow the user to create the namespace automatically through Helm and install the helm chart in that same namespace

Steps To Reproduce

Made sure autopilot namespace did not exist:

$ kubectl get namespace autopilot
Error from server (NotFound): namespaces "autopilot" not found

Ran command to have the helm release create the namespace for me and targeted the namespace so it was not installed in default:

$ helm upgrade autopilot autopilot/autopilot --install --create-namespace --namespace=autopilot -f autopilot-cfg.yaml
Release "autopilot" does not exist. Installing it now.
Error: 1 error occurred:
        * namespaces "autopilot" already exists

I checked if pods were there anyways, and they were:

$ kubectl get pods -n autopilot
NAME              READY   STATUS    RESTARTS   AGE
autopilot-2q7zc   0/1     Running   0          26s
autopilot-6s7zz   0/1     Running   0          26s
autopilot-gvprj   0/1     Running   0          26s
autopilot-hbzhl   0/1     Running   0          26s
autopilot-hsfdv   0/1     Running   0          26s
autopilot-hzn7t   0/1     Running   0          26s
autopilot-m87zw   0/1     Running   0          26s
autopilot-n9sbj   0/1     Running   0          26s
autopilot-q9rzb   0/1     Running   0          26s
autopilot-t2z7m   0/1     Running   0          26s
autopilot-zlk99   0/1     Running   0          26s

Checked status of autopilot via helm, it was saying it was failed:

$ helm list 
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS  CHART                   APP VERSION
autopilot       autopilot       1               2024-09-25 17:09:56.366324 -0400 EDT    failed  autopilot-v1.9.0        latest 

Ran above command again and it went w/o issues and the helm status changed to deployed...

$ helm upgrade autopilot autopilot/autopilot --install --create-namespace --namespace=autopilot -f autopilot-cfg.yaml
Release "autopilot" has been upgraded. Happy Helming!
NAME: autopilot
LAST DEPLOYED: Wed Sep 25 17:11:02 2024
NAMESPACE: autopilot
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
Autopilot DaemonSet deployed.

$ helm list                                                                                                          
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
autopilot       autopilot       2               2024-09-25 17:11:02.781032 -0400 EDT    deployed        autopilot-v1.9.0        latest

Expected behavior

Be able to install autopilot in the autopilot namespace

Evidence

See steps to reproduce

Proposed Solution

Remove the create: option in the config.yaml for the namespace, and let it be decided through the Helm cli

Additional context
The installer will still work as expected if the helm chart install namespace is different from autopilot AND the namespace doesn't exist already.

Thanks to Kevin O'Connor for finding this. All the commands above are reported by him.

@cmisale cmisale added the bug Something isn't working label Sep 26, 2024
@cmisale cmisale self-assigned this Sep 26, 2024
@cmisale
Copy link
Collaborator Author

cmisale commented Oct 4, 2024

I now remember why I did it that way.. This shows that Helm doesn't allow to add labels or annotations to the namespace. So it's either we make it helm friendly and add openshift.io/cluster-monitoring: "true" through oc/kubectl, or make it helm unfriendly and create the namespace with the label. The label is only openshift specific, so taking that out of the way it would make the tool more kubernetes-native..

@cmisale
Copy link
Collaborator Author

cmisale commented Oct 4, 2024

We decided to remove the namespace creation from the yaml templates and let the user create that through the helm cli.
Further info to enable prometheus scrape metrics from the autopilot repository, will be added in the readme

@cmisale
Copy link
Collaborator Author

cmisale commented Nov 4, 2024

fixed in #54

@cmisale cmisale closed this as completed Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant