Skip to content

feat: implementation for user defined configmap for cilium addon in cluster creation #1033

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

Merged
merged 3 commits into from
Feb 5, 2025

Conversation

manoj-nutanix
Copy link
Contributor

@manoj-nutanix manoj-nutanix commented Feb 4, 2025

What problem does this PR solve?:

implementation for user defined cilium configmap in cluster creation, current PR's implementation covers only configmap kind and assumes that clusterctl.cluster.x-k8s.io/move label is added on configmap by user.

pending PRs:

  1. Implementation for Secret kind object for user defined cilium spec.

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

How Has This Been Tested?:

Special notes for your reviewer:

$ kg cluster
NAME               CLUSTERCLASS          PHASE         AGE   VERSION
nkp-mgmt-cluster   nutanix-quick-start   Provisioned   15m   v1.31.4

$ kg cm custom-cilium-cni-helm-values-template -oyaml
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 * *"       
      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","clusterctl.cluster.x-k8s.io/move":""},"name":"custom-cilium-cni-helm-values-template","namespace":"default"}}
  creationTimestamp: "2025-02-04T14:55:33Z"
  labels:
    cluster.x-k8s.io/cluster-name: nkp-mgmt-cluster
    clusterctl.cluster.x-k8s.io/move: ""
  name: custom-cilium-cni-helm-values-template
  namespace: default
  resourceVersion: "23373"
  uid: 943620cd-a1a0-4d99-8383-d68e4329d029

$ kg hcp cilium-0194d059-494c-7879-a6bd-fe281ba362d9 -oyaml
apiVersion: addons.cluster.x-k8s.io/v1alpha1
kind: HelmChartProxy
metadata:
  creationTimestamp: "2025-02-04T14:56:33Z"
  finalizers:
  - helmchartproxy.addons.cluster.x-k8s.io
  generation: 1
  name: cilium-0194d059-494c-7879-a6bd-fe281ba362d9
  namespace: default
  ownerReferences:
  - apiVersion: cluster.x-k8s.io/v1beta1
    kind: Cluster
    name: nkp-mgmt-cluster
    uid: 83c0cc69-7100-41f5-a415-ccff87c8d03e
  resourceVersion: "26337"
  uid: f70e9e27-45a8-4832-9497-a94306b7ec30
spec:
  chartName: cilium
  clusterSelector:
    matchLabels:
      cluster.x-k8s.io/cluster-name: nkp-mgmt-cluster
  namespace: kube-system
  options:
    enableClientCache: false
    install:
      createNamespace: true
    timeout: 10m0s
    upgrade:
      maxHistory: 10
  releaseName: cilium
  repoURL: oci://helm-repository.default.svc/charts
  tlsConfig:
    caSecret:
      name: helm-repository-tls
      namespace: default
  valuesTemplate: |-
    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
  version: 1.16.4
status:
  conditions:
  - lastTransitionTime: "2025-02-04T15:04:13Z"
    status: "True"
    type: Ready
  - lastTransitionTime: "2025-02-04T15:04:13Z"
    status: "True"
    type: HelmReleaseProxiesReady
  - lastTransitionTime: "2025-02-04T15:02:45Z"
    status: "True"
    type: HelmReleaseProxySpecsUpToDate
  matchingClusters:
  - apiVersion: cluster.x-k8s.io/v1beta1
    kind: Cluster
    name: nkp-mgmt-cluster
    namespace: default
  observedGeneration: 1

@github-actions github-actions bot added feature and removed feature labels Feb 4, 2025
@manoj-nutanix manoj-nutanix changed the title feat: implementation for user defined cilium configmap feat: implementation for user defined configmap for cilium addon in cluster creation Feb 4, 2025
@github-actions github-actions bot added feature and removed feature labels Feb 4, 2025
Copy link
Contributor

@dkoshkin dkoshkin left a comment

Choose a reason for hiding this comment

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

Nice and simple of a change!

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.

LGTM. we should add unit test for this or some helpers for unit tests for addons.
Can we create a followup PR/jira to add unit tests.

Copy link
Contributor

@dkoshkin dkoshkin left a comment

Choose a reason for hiding this comment

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

Thanks!

@github-actions github-actions bot added feature and removed feature labels Feb 5, 2025
@manoj-nutanix manoj-nutanix merged commit d962187 into main Feb 5, 2025
24 checks passed
@manoj-nutanix manoj-nutanix deleted the NCN-105148a branch February 5, 2025 18:32
@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]>
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