Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions api/v1alpha1/addon_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ type NutanixAddons struct {

// +kubebuilder:validation:Optional
COSI *NutanixCOSI `json:"cosi,omitempty"`

// +kubebuilder:validation:Optional
K8sRegistrationAgent *NutanixK8sRegistrationAgent `json:"k8sRegistrationAgent,omitempty"`
}

type GenericAddons struct {
Expand Down Expand Up @@ -359,3 +362,21 @@ type RegistryAddon struct {
// +kubebuilder:validation:Enum="CNCF Distribution"
Provider string `json:"provider"`
}

type NutanixK8sRegistrationAgent struct {
// A reference to the Secret for credential information for the target Prism Central instance
// +kubebuilder:validation:Optional
Credentials *NutanixK8sAgentCredentials `json:"credentials,omitempty"`

// Addon strategy used to deploy the Nutanix k8s-registration-agent to the k8s cluster.
// +kubebuilder:default=HelmAddon
// +kubebuilder:validation:Optional
// +kubebuilder:validation:Enum=ClusterResourceSet;HelmAddon
Strategy AddonStrategy `json:"strategy,omitzero"`
}

type NutanixK8sAgentCredentials struct {
// A reference to the Secret containing the credentials used by the CCM provider.
// +kubebuilder:validation:Required
SecretRef LocalObjectReference `json:"secretRef"`
}
2 changes: 2 additions & 0 deletions api/v1alpha1/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const (
ServiceLoadBalancerVariableName = "serviceLoadBalancer"
// RegistryAddonVariableName is the OCI registry config patch variable name.
RegistryAddonVariableName = "registry"
// K8sRegistrationAgentVariableName is the Nutanix k8s-registration-agent addon config patch variable name.
K8sRegistrationAgentVariableName = "k8sRegistrationAgent"

// GlobalMirrorVariableName is the global image registry mirror patch variable name.
GlobalMirrorVariableName = "globalImageRegistryMirror"
Expand Down
29 changes: 29 additions & 0 deletions api/v1alpha1/crds/caren.nutanix.com_nutanixclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,35 @@ spec:
- defaultStorage
- providers
type: object
k8sRegistrationAgent:
properties:
credentials:
description: A reference to the Secret for credential information for the target Prism Central instance
properties:
secretRef:
description: A reference to the Secret containing the credentials used by the CCM provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
maxLength: 253
minLength: 1
type: string
required:
- name
type: object
required:
- secretRef
type: object
strategy:
default: HelmAddon
description: Addon strategy used to deploy the Nutanix k8s-registration-agent to the k8s cluster.
enum:
- ClusterResourceSet
- HelmAddon
type: string
type: object
nfd:
description: NFD tells us to enable or disable the node feature discovery addon.
properties:
Expand Down
41 changes: 41 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api/variables/aggregate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ type Addons struct {
CSI *CSI `json:"csi,omitempty"`

COSI *COSI `json:"cosi,omitempty"`

NutanixK8sRegistrationAgent *NutanixK8sRegistrationAgent `json:"k8sRegistrationAgent,omitempty"`
}

type NutanixK8sRegistrationAgent struct {
carenv1.NutanixK8sRegistrationAgent `json:",inline"`
}

type CSI struct {
Expand Down
2 changes: 2 additions & 0 deletions charts/cluster-api-runtime-extensions-nutanix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ A Helm chart for cluster-api-runtime-extensions-nutanix
| hooks.registrySyncer.defaultValueTemplateConfigMap.name | string | `"default-registry-syncer-helm-values-template"` | |
| hooks.serviceLoadBalancer.metalLB.defaultValueTemplateConfigMap.create | bool | `true` | |
| hooks.serviceLoadBalancer.metalLB.defaultValueTemplateConfigMap.name | string | `"default-metallb-helm-values-template"` | |
| hooks.k8sRegistrationAgent.helmAddonStrategy.defaultValueTemplateConfigMap.create | bool | `true` | |
| hooks.k8sRegistrationAgent.helmAddonStrategy.defaultValueTemplateConfigMap.name | string | `"default-k8s-registrationagent-helm-values-template"` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"ghcr.io/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix"` | |
| image.tag | string | `""` | |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
agent:
name: {{ .AgentName}}

pc:
port: {{ .PrismCentralPort }}
insecure: {{ .PrismCentralInsecure }} #set this to true if PC does not have https enabled
endpoint: {{ .PrismCentralHost }} # eg: ip or fqdn
k8sClusterName: {{ .ClusterName }}

createSecret: false

Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ spec:
- --csi.snapshot-controller.helm-addon.default-values-template-configmap-name={{ (index .Values.hooks.csi "snapshot-controller").helmAddonStrategy.defaultValueTemplateConfigMap.name }}
- --ccm.aws.helm-addon.default-values-template-configmap-name={{ .Values.hooks.ccm.aws.helmAddonStrategy.defaultValueTemplateConfigMap.name }}
- --cosi.controller.helm-addon.default-values-template-configmap-name={{ .Values.hooks.cosi.controller.helmAddonStrategy.defaultValueTemplateConfigMap.name }}
- --k8s-registration-agent.helm-addon.default-values-template-configmap-name={{ .Values.hooks.k8sRegistrationAgent.helmAddonStrategy.defaultValueTemplateConfigMap.name }}
{{- range $k, $v := .Values.hooks.ccm.aws.k8sMinorVersionToCCMVersion }}
- --ccm.aws.aws-ccm-versions={{ $k }}={{ $v }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ data:
ChartName: cosi
ChartVersion: 0.0.1-alpha.5
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://mesosphere.github.io/charts/stable/{{ end }}'
k8s-registration-agent: |
ChartName: nutanix-k8s-agent
ChartVersion: 0.0.1-alpha.1
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}http://192.168.1.16:8080{{ end }}'
local-path-provisioner-csi: |
ChartName: local-path-provisioner
ChartVersion: 0.0.31
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2025 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

{{- if .Values.hooks.k8sRegistrationAgent.helmAddonStrategy.defaultValueTemplateConfigMap.name }}
apiVersion: v1
kind: ConfigMap
metadata:
name: '{{ .Values.hooks.k8sRegistrationAgent.helmAddonStrategy.defaultValueTemplateConfigMap.name }}'
data:
values.yaml: |-
{{- .Files.Get "addons/k8s-registration-agent/values-template.yaml" | nindent 4 }}
{{- end -}}
21 changes: 21 additions & 0 deletions charts/cluster-api-runtime-extensions-nutanix/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,27 @@
}
}
},
"k8sRegistrationAgent": {
"properties": {
"helmAddonStrategy": {
"properties": {
"defaultValueTemplateConfigMap": {
"properties": {
"create": {
"type": "boolean"
},
"name": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
},
"type": "object"
},
"csi": {
"type": "object",
"properties": {
Expand Down
5 changes: 5 additions & 0 deletions charts/cluster-api-runtime-extensions-nutanix/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ hooks:
defaultValueTemplateConfigMap:
create: true
name: default-metallb-helm-values-template
k8sRegistrationAgent:
helmAddonStrategy:
defaultValueTemplateConfigMap:
create: true
name: default-k8s-registrationagent-helm-values-template
cosi:
controller:
helmAddonStrategy:
Expand Down
30 changes: 30 additions & 0 deletions docs/content/addons/k8s-registration-agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
+++
title = "Kubernetes cluster registration addon"
icon = "fa-solid fa-object-group"
+++

By leveraging CAPI cluster lifecycle hooks, this handler deploys [Kubernetes cluster registration agent]
on the new cluster at the `AfterControlPlaneInitialized` phase.

The hook uses the [Cluster API Add-on Provider for Helm] to deploy the k8s-registration resources.

## Example

To enable deployment of kubernets registration agent on a cluster, specify the following values:

```yaml
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: <NAME>
spec:
topology:
variables:
- name: clusterConfig
value:
addons:
k8sRegistrationAgent: {}
```

[Kubernetes cluster registration agent]: https://github.com/nutanix-core/k8s-agent
[Cluster API Add-on Provider for Helm]: https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm
1 change: 1 addition & 0 deletions examples/capi-quick-start/nutanix-cluster-calico-crs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ spec:
provider: Calico
strategy: ClusterResourceSet
cosi: {}
k8sRegistrationAgent: {}
csi:
defaultStorage:
provider: nutanix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ spec:
cni:
provider: Calico
cosi: {}
k8sRegistrationAgent: {}
csi:
defaultStorage:
provider: nutanix
Expand Down
1 change: 1 addition & 0 deletions examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ spec:
provider: Cilium
strategy: ClusterResourceSet
cosi: {}
k8sRegistrationAgent: {}
csi:
defaultStorage:
provider: nutanix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ spec:
cni:
provider: Cilium
cosi: {}
k8sRegistrationAgent: {}
csi:
defaultStorage:
provider: nutanix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ spec:
provider: Cilium
strategy: ClusterResourceSet
cosi: {}
k8sRegistrationAgent: {}
csi:
defaultStorage:
provider: nutanix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ spec:
cni:
provider: Cilium
cosi: {}
k8sRegistrationAgent: {}
csi:
defaultStorage:
provider: nutanix
Expand Down
5 changes: 5 additions & 0 deletions hack/addons/helm-chart-bundler/repos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ repositories:
charts:
nutanix-csi-storage:
- 3.3.4
nutanix-k8s-agent:
repoURL: http://192.168.1.16:8080
charts:
nutanix-k8s-agent:
- 0.0.1-alpha.1
registry-syncer:
repoURL: https://mesosphere.github.io/charts/staging/
charts:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

metadata:
name: k8s-registration-agent-kustomize

helmCharts:
- name: nutanix-k8s-agent
namespace: kube-system
#repo: https://mesosphere.github.io/charts/stable
repo: http://192.168.1.16:8080
releaseName: k8s-registration-agent
version: ${K8S_REGISTRATION_AGENT_VERSION}
includeCRDs: true
skipTests: true
3 changes: 3 additions & 0 deletions hack/examples/bases/nutanix/cluster/kustomization.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ patches:
- target:
kind: Cluster
path: ../../../patches/nutanix/cosi.yaml
- target:
kind: Cluster
path: ../../../patches/nutanix/k8s-registration-agent.yaml
- target:
kind: Cluster
path: ../../../patches/nutanix/ccm.yaml
Expand Down
6 changes: 6 additions & 0 deletions hack/examples/patches/nutanix/k8s-registration-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2025 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

- op: "add"
path: "/spec/topology/variables/0/value/addons/k8sRegistrationAgent"
value: {}
2 changes: 2 additions & 0 deletions hack/tools/fetch-images/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ func getValuesFileForChartIfNeeded(chartName, carenChartDirectory string) (strin
return tempFile.Name(), nil
case "cosi-controller":
return filepath.Join(carenChartDirectory, "addons", "cosi", "controller", defaultHelmAddonFilename), nil
case "k8s-registration-agent":
return filepath.Join(carenChartDirectory, "addons", "k8s-registration-agent", defaultHelmAddonFilename), nil
case "metallb":
return filepath.Join(
carenChartDirectory,
Expand Down
2 changes: 2 additions & 0 deletions make/addons.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export METALLB_CHART_VERSION := 0.15.2

export COSI_CONTROLLER_VERSION := 0.0.1-alpha.5

export K8S_REGISTRATION_AGENT_VERSION := 0.0.1-alpha.1

.PHONY: addons.sync
addons.sync: $(addprefix update-addon.,calico cilium nfd cluster-autoscaler snapshot-controller local-path-provisioner-csi aws-ebs-csi kube-vip)
addons.sync: $(addprefix update-addon.aws-ccm.,130 131 132 133)
Expand Down
Loading
Loading