weaveworks / pctl

CLI for interacting with profiles
Other
7 stars 6 forks source link

Generated ConfigMap.yaml is not included in kustomization.yaml #331

Closed tomhuang12 closed 3 years ago

tomhuang12 commented 3 years ago

What were you trying to accomplish? I am trying to add a profile that has a local chart and defaultValues defined.

pctl add \
  --name nginx \
  --profile-repo-url https://github.com/weaveworks/profiles-examples.git \
  --profile-path bitnami-nginx \
  --create-pr \
  --pr-repo <gitops-repo> \
  --pr-branch add-nginx \
  --git-repository wego-system/wego-system

or

pctl add --name nginx \
--profile-repo-url https://github.com/weaveworks/profiles-examples.git \
--profile-path bitnami-nginx \
--out . --git-repository wego-system/wego-system

What happened? The generated artifacts has the ConfigMap.yaml generated but missing from ./nginx/artifacts/nginx-server/helm-chart/kustomization.yaml, causing it not deployed. The corresponding HelmRelease fails to reconcile until the ConfigMap is applied.

How to reproduce it? On a GitOps repository, run the commands from above. Check that the ./nginx/artifacts/nginx-server/helm-chart/kustomization.yaml resources is missing - ConfigMap.yaml.

Logs

pctl add \                                                                                                                                                 ✔ 
  --name nginx \
  --profile-repo-url https://github.com/weaveworks/profiles-examples.git \
  --profile-path bitnami-nginx \
  --create-pr \
  --pr-repo xxx \
  --pr-branch add-nginx \
  --git-repository wego-system/wego-system
config file cannot be found... using default values
► generating profile installation from source: repository https://github.com/weaveworks/profiles-examples.git, path: bitnami-nginx and branch main
✔ installation completed successfully
► creating a PR to repo xxx with base main and branch add-nginx
► creating new branch

► adding unstaged changes

► pushing to remote

► Creating pull request with : xxx
✔ PR created with number: 4 and URL: xxx

Anything else we need to know? Darwin amd64

Versions 0.10.0

aclevername commented 3 years ago

Thanks for opening the issue @tomhuang12 ! Definitely looks like a bug that needs to be fixed. We will get to it soon.

@Himangini can we move this to ready for work without having to do planning? Quite an annoying bug that might block a lot of CX folks.

Skarlso commented 3 years ago

Ops...:D

aclevername commented 3 years ago

Ops...:D

the bug isn't obvious to me... like we do have logic around it https://github.com/weaveworks/pctl/blob/4309c6da53c461831bb6425779cbaae12959e566/pkg/install/artifact/artifact.go#L126-L130 but looking at our e2e tests it isn't explicitly tested, which is a gap for sure. I'm wondering whats causing this :thinking:

tomhuang12 commented 3 years ago

I think this line needs to check if cfgMap exists and include as part of kustomization: https://github.com/weaveworks/pctl/blob/4309c6da53c461831bb6425779cbaae12959e566/pkg/install/artifact/artifact.go#L140.

aclevername commented 3 years ago

I think this line needs to check if cfgMap exists and include as part of kustomization:

https://github.com/weaveworks/pctl/blob/4309c6da53c461831bb6425779cbaae12959e566/pkg/install/artifact/artifact.go#L140

.

yeah I'm working on a fix atm :smile:

aclevername commented 3 years ago

Fixed in 0.11.0 @tomhuang12

tomhuang12 commented 3 years ago

Working as expected in 0.11.0! Thank you!