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: adds cluster's ownerref on cilium helm values source object #1034

Merged
merged 5 commits into from
Feb 5, 2025

Conversation

manoj-nutanix
Copy link
Contributor

What problem does this PR solve?:
Adds cluster's ownerref on cilium helm values source object so users won't have to explicitly need to add clusterctl.cluster.x-k8s.io/move: "" label

Which issue(s) this PR fixes:
Fixes #
NCN-105148

How Has This Been Tested?:

Special notes for your reviewer:

apiVersion: v1
data:
  values.yaml: |-
    cni:
      chainingMode: portmap
      exclusive: false
    hubble:
      enabled: true
      tls:
        auto:
          enabled: true               # enable automatic TLS certificate generation
          method: cronJob             # auto generate certificates using cronJob method
          certValidityDuration: 60    # certificates validity duration in days (default 2 months)
          schedule: "0 0 5 * *"       # schedule on the 1st day regeneration of each month
      relay:
        enabled: true
        image:
          useDigest: false
    ipam:
      mode: kubernetes
    image:
      useDigest: false
    operator:
      image:
        useDigest: false
    certgen:
      image:
        useDigest: false
    socketLB:
      hostNamespaceOnly: true
    envoy:
      image:
        useDigest: false
kind: ConfigMap
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","data":{"values.yaml":"cni:\n  chainingMode: portmap\n  exclusive: false\nhubble:\n  enabled: true\n  tls:\n    auto:\n      enabled: true               # enable automatic TLS certificate generation\n      method: cronJob             # auto generate certificates using cronJob method\n      certValidityDuration: 60    # certificates validity duration in days (default 2 months)\n      schedule: \"0 0 5 * *\"       # schedule on the 1st day regeneration of each month\n  relay:\n    enabled: true\n    image:\n      useDigest: false\nipam:\n  mode: kubernetes\nimage:\n  useDigest: false\noperator:\n  image:\n    useDigest: false\ncertgen:\n  image:\n    useDigest: false\nsocketLB:\n  hostNamespaceOnly: true\nenvoy:\n  image:\n    useDigest: false"},"kind":"ConfigMap","metadata":{"annotations":{},"labels":{"cluster.x-k8s.io/cluster-name":"nkp-mgmt-cluster"},"name":"custom-cilium-cni-helm-values-template","namespace":"default"}}
  creationTimestamp: "2025-02-05T12:47:38Z"
  labels:
    cluster.x-k8s.io/cluster-name: nkp-mgmt-cluster
  name: custom-cilium-cni-helm-values-template
  namespace: default
  ownerReferences:
  - apiVersion: cluster.x-k8s.io/v1beta1
    kind: Cluster
    name: nkp-mgmt-cluster
    uid: 6915b86b-91ae-4673-bb6e-3a94f96dc22f
  resourceVersion: "9260"
  uid: c541aec0-2b5d-4b0d-8cdb-ba63bef0ca06
➜  ~ kg cluster -oyaml
apiVersion: v1
items:
- apiVersion: cluster.x-k8s.io/v1beta1
  kind: Cluster
  metadata:
    annotations:
      caren.nutanix.com/cluster-uuid: 0194d059-494c-7879-a6bd-fe281ba362d9
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"cluster.x-k8s.io/v1beta1","kind":"Cluster","metadata":{"annotations":{"caren.nutanix.com/cluster-uuid":"0194d059-494c-7879-a6bd-fe281ba362d9"},"labels":{"cluster.x-k8s.io/provider":"nutanix","konvoy.d2iq.io/cluster-name":"nkp-mgmt-cluster","konvoy.d2iq.io/provider":"nutanix"},"name":"nkp-mgmt-cluster","namespace":"default"},"spec":{"clusterNetwork":{"pods":{"cidrBlocks":["192.168.0.0/16"]},"services":{"cidrBlocks":["10.96.0.0/12"]}},"controlPlaneEndpoint":{"host":"","port":0},"topology":{"class":"nutanix-quick-start","controlPlane":{"metadata":{},"replicas":1},"variables":[{"name":"clusterConfig","value":{"addons":{"ccm":{"credentials":{"secretRef":{"name":"nkp-mgmt-cluster-pc-credentials"}},"strategy":"HelmAddon"},"clusterAutoscaler":{"strategy":"HelmAddon"},"cni":{"provider":"Cilium","strategy":"HelmAddon","values":{"sourceRef":{"kind":"ConfigMap","name":"custom-cilium-cni-helm-values-template"}}},"csi":{"defaultStorage":{"provider":"nutanix","storageClassConfig":"volume"},"providers":{"nutanix":{"credentials":{"secretRef":{"name":"nkp-mgmt-cluster-pc-credentials-for-csi"}},"storageClassConfigs":{"volume":{"allowExpansion":true,"parameters":{"csi.storage.k8s.io/fstype":"ext4","description":"CSI StorageClass nutanix-volume for nkp-mgmt-cluster","flashMode":"DISABLED","hypervisorAttached":"ENABLED","storageContainer":"default-container-32638919133770","storageType":"NutanixVolumes"},"reclaimPolicy":"Delete","volumeBindingMode":"WaitForFirstConsumer"}},"strategy":"HelmAddon"}},"snapshotController":{"strategy":"HelmAddon"}},"nfd":{"strategy":"HelmAddon"},"serviceLoadBalancer":{"configuration":{"addressRanges":[{"end":"10.47.10.82","start":"10.47.10.82"}]},"provider":"MetalLB"}},"controlPlane":{"nutanix":{"machineDetails":{"bootType":"uefi","cluster":{"name":"auto_cluster_prod_manoj_surudwad_1a2aac0a51c7","type":"name"},"image":{"name":"nkp-rocky-9.5-release-1.31.4-20250122010854.qcow2","type":"name"},"memorySize":"8Gi","subnets":[{"name":"vlan.155","type":"name"}],"systemDiskSize":"80Gi","vcpuSockets":4,"vcpusPerSocket":1}}},"dns":{"coreDNS":{}},"encryptionAtRest":{"providers":[{"secretbox":{}}]},"imageRegistries":[{"credentials":{"secretRef":{"name":"nkp-mgmt-cluster-image-registry-credentials"}},"url":"https://docker.io"}],"nutanix":{"controlPlaneEndpoint":{"host":"10.47.10.4","port":6443,"virtualIP":{"provider":"KubeVIP"}},"prismCentralEndpoint":{"credentials":{"secretRef":{"name":"nkp-mgmt-cluster-pc-credentials"}},"insecure":true,"url":"https://10.47.10.25:9440"}},"users":[{"name":"konvoy","sshAuthorizedKeys":["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCky5ata76YkcrZi2EdXcD4ESrHtGUU3+0aqtzG4PueOtjhcLSd5160+fKsyLt/CC7+0MbLW6nQYZH3HHgQuF0gb5gfXHuHH4kLJnmRmP3nM3KhZZ2f0lOtKpSJ5lPxvIlbTHacWkd4s4tlmUQvg4XRasQ1t8dgjQGmyQdCuMHE02jOsmc4JGseJ6u3Ne6dJtTwglwLbN+IlsJECuVubU7yqN0ZHL1G5mAy2IWzCRKmDL9ZyCXSM9QWsbTqnvuVGVUp0cW3YquTuoEuiupWYw6HRQSAvFHGUR+juHmUwIVFkgGjBlOAdMiRhRJHEUnE6YpTKZEfIhw9nlwXQfdXRXsoNcV5pDNr2Pd71DlHocAQRSlEa3sZ75W8O5TPzkzxF8W0WLLiiS2PlnbZFLiY2RyQcUBXKOeYVHZTvUpLNnNISPzF4IB8OwZDpJWWQ4kLZ7PAdL2NeN/uI3a5eDXcyBkqisnBewm6YHvDjfV/dTeJrxo9vPX++rPlAe7C6Edr7as=\n"],"sudo":"ALL=(ALL) NOPASSWD:ALL"}]}}],"version":"v1.31.4","workers":{"machineDeployments":[{"class":"default-worker","metadata":{"annotations":{"cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size":"3","cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size":"3"}},"name":"md-0","variables":{"overrides":[{"name":"workerConfig","value":{"nutanix":{"machineDetails":{"bootType":"uefi","cluster":{"name":"auto_cluster_prod_manoj_surudwad_1a2aac0a51c7","type":"name"},"image":{"name":"nkp-rocky-9.5-release-1.31.4-20250122010854.qcow2","type":"name"},"memorySize":"8Gi","subnets":[{"name":"vlan.155","type":"name"}],"systemDiskSize":"80Gi","vcpuSockets":8,"vcpusPerSocket":1}}}}]}}]}}}}
    creationTimestamp: "2025-02-05T12:47:16Z"
    finalizers:
    - cluster.cluster.x-k8s.io
    generation: 5
    labels:
      cluster.x-k8s.io/cluster-name: nkp-mgmt-cluster
      cluster.x-k8s.io/provider: nutanix
      konvoy.d2iq.io/cluster-name: nkp-mgmt-cluster
      konvoy.d2iq.io/provider: nutanix
      topology.cluster.x-k8s.io/owned: ""
    name: nkp-mgmt-cluster
    namespace: default
    resourceVersion: "9931"
    uid: 6915b86b-91ae-4673-bb6e-3a94f96dc22f
  spec:
...
...
...
  status:
    conditions:
    - lastTransitionTime: "2025-02-05T12:48:54Z"
      status: "True"
      type: Ready
    - lastTransitionTime: "2025-02-05T12:48:54Z"
      status: "True"
      type: ControlPlaneInitialized
    - lastTransitionTime: "2025-02-05T12:48:54Z"
      status: "True"
      type: ControlPlaneReady
    - lastTransitionTime: "2025-02-05T12:47:22Z"
      status: "True"
      type: InfrastructureReady
    - lastTransitionTime: "2025-02-05T12:50:34Z"
      status: "True"
      type: TopologyReconciled
    controlPlaneReady: true
    infrastructureReady: true
    observedGeneration: 5
    phase: Provisioned

pkg/handlers/generic/lifecycle/cni/cilium/handler.go Outdated Show resolved Hide resolved
pkg/handlers/generic/lifecycle/cni/cilium/handler.go Outdated Show resolved Hide resolved
pkg/handlers/utils/secrets.go Outdated Show resolved Hide resolved
dkoshkin
dkoshkin previously approved these changes Feb 5, 2025
Base automatically changed from NCN-105148a to main February 5, 2025 18:32
@manoj-nutanix manoj-nutanix dismissed dkoshkin’s stale review February 5, 2025 18:32

The base branch was changed.

@github-actions github-actions bot added feature and removed feature labels Feb 5, 2025
Copy link
Contributor

@supershal supershal left a comment

Choose a reason for hiding this comment

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

Looks good other then one nit code suggestion.
Also we should add e2e tests for checking owner reference. https://github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/blob/main/test/e2e/quick_start_test.go#L176

@dkoshkin dkoshkin enabled auto-merge (squash) February 5, 2025 19:52
@dkoshkin
Copy link
Contributor

dkoshkin commented Feb 5, 2025

Needed to rebase to not break the build 498a27f

@dkoshkin dkoshkin merged commit a319934 into main Feb 5, 2025
21 checks passed
@dkoshkin dkoshkin deleted the NCN-105148b branch February 5, 2025 22:30
@github-actions github-actions bot mentioned this pull request Feb 5, 2025
dkoshkin added a commit that referenced this pull request Feb 5, 2025
🤖 I have created a release *beep* *boop*
---


## 0.26.0 (2025-02-05)

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

## What's Changed
### Exciting New Features 🎉
* feat: adds new field for helm values input for cilium CNI by
@manoj-nutanix in
#1011
* feat: implementation for user defined configmap for cilium addon in
cluster creation by @manoj-nutanix in
#1033
* feat: update CAPI to v1.9.3 by @dkoshkin in
#1010
* feat: adds cluster's ownerref on cilium helm values source object by
@manoj-nutanix in
#1034
### Fixes 🔧
* fix: correctly copy Helm charts in init container by @dkoshkin in
#1018
* fix: Use mindthegap v1.17.0 for the helm-repository container by
@dlipovetsky in
#1024
* fix: use republished COSI controller image by @dkoshkin in
#1022
### Other Changes
* test: wait for COSI controller to be ready by @dkoshkin in
#1014
* refactor: Remove api module dependency from common module by
@jimmidyson in
#1019


**Full Changelog**:
v0.25.0...v0.26.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>
Co-authored-by: Dimitri Koshkin <[email protected]>
@manoj-nutanix
Copy link
Contributor Author

Looks good other then one nit code suggestion. Also we should add e2e tests for checking owner reference. https://github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/blob/main/test/e2e/quick_start_test.go#L176

Done https://jira.nutanix.com/browse/NCN-105581

@manoj-nutanix
Copy link
Contributor Author

Needed to rebase to not break the build 498a27f

Thanks @dkoshkin for taking this PR ahead and merging it.

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.

4 participants