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

feat: Configure namespace sync in helm chart #726

Merged

Conversation

dlipovetsky
Copy link
Contributor

@dlipovetsky dlipovetsky commented Jun 18, 2024

What problem does this PR solve?:

  • Allows user to configure target namespace label key using flag. Sets the default label key as an empty string. Labels cannot have an empty key, which means that, by default, no namespaces are target namespaces.
  • Adds configuration fields to helm values, and passes them to manager as flags. Defines caren.nutanix.com/namespace-sync as the default target namespace label key.
  • Documents configuration fields and their default values.

#725 fixes behavior when the source namespace and/or target namespace label key are empty strings.

Which issue(s) this PR fixes:
Fixes #

How Has This Been Tested?:

Special notes for your reviewer:

I think this behavior deserves to be documented, but right now the only place where we talk about configuration of CAREN itself is in the Chart README. Should I add something there, or under docs/?

@dlipovetsky dlipovetsky force-pushed the configure-namespacesync branch from 6050ddb to 2e5a2b9 Compare June 18, 2024 18:50
@github-actions github-actions bot added feature and removed feature labels Jun 18, 2024
@jimmidyson
Copy link
Member

@dlipovetsky wdyt about adding helm configuration for enabling the sync controller (default enabled) with required sync source namespace flag? Don't start up if misconfigured.

Also default sync source namespace to pod (helm release) namespace?

@dlipovetsky
Copy link
Contributor Author

@dlipovetsky wdyt about adding helm configuration for enabling the sync controller (default enabled) with required sync source namespace flag? Don't start up if misconfigured.

Also default sync source namespace to pod (helm release) namespace?

Both ideas sound good.

I'll leave the source namespace flag default value an empty string.

I will start the controller only if both the source namespace and target namespace label key flags have values.

@dlipovetsky
Copy link
Contributor Author

(Rebased on main)

@dlipovetsky
Copy link
Contributor Author

e2e tests failing, will rebase on main once #736 merges

@dlipovetsky dlipovetsky force-pushed the configure-namespacesync branch 3 times, most recently from 65a50b9 to 3f7ed43 Compare June 21, 2024 23:10
@dlipovetsky
Copy link
Contributor Author

dlipovetsky commented Jun 24, 2024

The CAREN process fails to start. We don't get Pod logs for failing CI jobs, so I had to run the e2e test locally.

cluster-api-runtime-extensions-nutanix-6bc6c9dcbd-p6ghd E0624 16:36:10.605469       1 main.go:153] "Namespace Sync is enabled, but source namespace and/or target namespace label key are not configured." logger="main"
Stream closed EOF for caren-system/cluster-api-runtime-extensions-nutanix-6bc6c9dcbd-p6ghd (webhook)

The Deployment looks correct:

    spec:
      containers:
      - args:
        - --webhook-cert-dir=/runtimehooks-certs/
        - --defaults-namespace=$(POD_NAMESPACE)
        - --namespacesync-enabled=true
        - --namespacesync-source-namespace=caren-system
        - --namespacesync-target-namespace-label-key=caren.nutanix.com/namespace-sync

Will find the bug. Update: Found it by stepping through startup sequence. I made a copy-paste typo and bound the flag to the wrong variable. Fixed!

@dlipovetsky
Copy link
Contributor Author

dlipovetsky commented Jun 24, 2024

lint-test-helm fails:

Events:
  Type     Reason       Age                    From               Message
  ----     ------       ----                   ----               -------
  Warning  Failed       3m27s (x4 over 4m59s)  kubelet            Failed to pull image "ghcr.io/nutanix-cloud-native/caren-helm-reg:v0.11.0-dev": rpc error: code = NotFound desc = failed to pull and unpack image "ghcr.io/nutanix-cloud-native/caren-helm-reg:v0.11.0-dev": failed to resolve reference "ghcr.io/nutanix-cloud-native/caren-helm-reg:v0.11.0-dev": ghcr.io/nutanix-cloud-native/caren-helm-reg:v0.11.0-dev: not found

Error from server (BadRequest): container "helm-repository" in pod "helm-repository-67575f489c-xxx5n" is waiting to start: trying and failing to pull image
Error printing details: failed waiting for process: exit status 1

I think this is because of https://github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pull/745/files#diff-42e26dc67aed8aa3edb2472b4403288c1699fb6dc47419b9a475f0f224fe4689R44-R46

@dlipovetsky
Copy link
Contributor Author

Going to rebase on #746

Sets the default label key as an empty string. Labels cannot have an
empty key, which means that, by default, no namespaces are target
namespaces.
- Adds configuration fields and passes them to manager as flags.
- Documents configuration fields and their default values.
@dlipovetsky dlipovetsky force-pushed the configure-namespacesync branch from dbfb881 to 3c5abeb Compare June 24, 2024 18:29
@dlipovetsky dlipovetsky merged commit 3c5abeb into nutanix-cloud-native:main Jun 24, 2024
16 checks passed
jimmidyson added a commit that referenced this pull request Jun 27, 2024
🤖 I have created a release *beep* *boop*
---


## 0.11.0 (2024-06-27)

<!-- Release notes generated using configuration in .github/release.yaml
at main -->

## What's Changed
### Exciting New Features 🎉
* feat: Configure namespace sync in helm chart by @dlipovetsky in
#726
* feat: Support CRS for local-path provisioner and add CSI e2e by
@jimmidyson in
#737
* feat: Support HelmAddon strategy for AWS EBS by @jimmidyson in
#732
* feat: Deploy snapshot-controller as separate addon by @jimmidyson in
#734
* feat: Update AWS CCM versions and add HelmAddon strategy by
@jimmidyson in
#748
### Fixes 🔧
* fix: Namespace Sync controller should list no resources when source
namespace is empty string by @dlipovetsky in
#725
* fix: Temporarily hard-code supported PC version for Nutanix CSI by
@jimmidyson in
#751
* fix: skip kubeadm CA file when Secret doesn't have a CA by @dkoshkin
in
#752
* fix: Correctly report failed deploy of ServiceLoadBalancer by
@dlipovetsky in
#759
### Other Changes
* build: Tidy up goreleaser config by @jimmidyson in
#745
* ci: Fix up image loading for lint-test-helm by @jimmidyson in
#746
* refactor: Tidy up Nutanix CSI with consistent apply strategy by
@jimmidyson in
#733
* test(e2e): Set empty env vars for Nutanix e2e vars by @jimmidyson in
#749
* refactor: Use recommended "default" function syntax in helm templates
by @dlipovetsky in
#750
* refactor: Reusable HelmAddon strategy by @jimmidyson in
#735
* test(e2e): Various e2e tests fixes by @jimmidyson in
#754
* test(e2e): Correct default helm release names for AWS CCM and EBS CSI
by @jimmidyson in
#756


**Full Changelog**:
v0.10.0...v0.11.0

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants