rancher / fleet

Deploy workloads from Git to large fleets of Kubernetes clusters
https://fleet.rancher.io/
Apache License 2.0
1.48k stars 217 forks source link

Bundle name is dynamic from gitrepo config upon edit prevents re-deployment #719

Open Jackbennett opened 2 years ago

Jackbennett commented 2 years ago

I made a gitRrepo in the UI with a path example/ for the namespace example-demo-master. The example/fleet.yaml only has kustomize: dir: ./deployed/site. I edited the gitRepo to change the path to example/deployed/site/apply which is just k8s yaml, this is kustomize build output. expecting to no longer need the fleet.yaml. This now errors to apply;

rendered manifests contain a resource that already exists. Unable to continue with install: Deployment "assets" in namespace "example-demo-master" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-name" must equal "example-example-deployed-example-4c31c": current value is "example-demo-example-demo"

helm-release-name not being linked to the gitrepo is weird. Shouldn't that just use the gitrepo CRD name which has to be unique anyway due to k8s? As far as I can tell this name reconstruction isn't documented. It seems like I should at least be able to set the release name in the gitRepo yaml.

Now editing this back to the original path I can't clear that error. I had to delete the newly created bundle with the longer name. Using more specific path and deleting the old bundle emptied the namespace and recreated everything under the new helm release name.

rancher 2.5 52b8fb1 with fleet rancher/fleet-agent:v0.3.5 on the target cluster. rancher/fleet-agent:v0.3.5 rancher/fleet:v0.3.5 and rancher/gitjob:v0.1.15 on the rancher cluster

Jackbennett commented 2 years ago

Thanks to slack I didn't realize helm.releaseName was inside fleet.yaml which could help. I'm not clear why this info needs coupling inside the git repo instead of being in the CRD.