Skip to content

Commit a76a6db

Browse files
committed
feat: add Cluster Autoscaler Addon with CRS
1 parent f85024a commit a76a6db

File tree

22 files changed

+879
-63
lines changed

22 files changed

+879
-63
lines changed

api/v1alpha1/addon_types.go

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ type Addons struct {
1616
// +optional
1717
NFD *NFD `json:"nfd,omitempty"`
1818

19+
// +optional
20+
ClusterAutoscaler *ClusterAutoscaler `json:"clusterAutoscaler,omitempty"`
21+
1922
// +optional
2023
CPI *CPI `json:"cpi,omitempty"`
2124

@@ -29,10 +32,11 @@ func (Addons) VariableSchema() clusterv1.VariableSchema {
2932
Description: "Cluster configuration",
3033
Type: "object",
3134
Properties: map[string]clusterv1.JSONSchemaProps{
32-
"cni": CNI{}.VariableSchema().OpenAPIV3Schema,
33-
"nfd": NFD{}.VariableSchema().OpenAPIV3Schema,
34-
"csi": CSIProviders{}.VariableSchema().OpenAPIV3Schema,
35-
"cpi": CPI{}.VariableSchema().OpenAPIV3Schema,
35+
"cni": CNI{}.VariableSchema().OpenAPIV3Schema,
36+
"nfd": NFD{}.VariableSchema().OpenAPIV3Schema,
37+
"clusterAutoscaler": ClusterAutoscaler{}.VariableSchema().OpenAPIV3Schema,
38+
"csi": CSIProviders{}.VariableSchema().OpenAPIV3Schema,
39+
"cpi": CPI{}.VariableSchema().OpenAPIV3Schema,
3640
},
3741
},
3842
}
@@ -104,6 +108,30 @@ func (NFD) VariableSchema() clusterv1.VariableSchema {
104108
}
105109
}
106110

111+
// ClusterAutoscaler tells us to enable or disable the cluster-autoscaler addon.
112+
type ClusterAutoscaler struct {
113+
// +optional
114+
Strategy AddonStrategy `json:"strategy,omitempty"`
115+
}
116+
117+
func (ClusterAutoscaler) VariableSchema() clusterv1.VariableSchema {
118+
return clusterv1.VariableSchema{
119+
OpenAPIV3Schema: clusterv1.JSONSchemaProps{
120+
Type: "object",
121+
Properties: map[string]clusterv1.JSONSchemaProps{
122+
"strategy": {
123+
Description: "Addon strategy used to deploy cluster-autoscaler to the management cluster, targeting the workload cluster.",
124+
Type: "string",
125+
Enum: variables.MustMarshalValuesToEnumJSON(
126+
AddonStrategyClusterResourceSet,
127+
),
128+
},
129+
},
130+
Required: []string{"strategy"},
131+
},
132+
}
133+
}
134+
107135
type CSIProviders struct {
108136
// +optional
109137
Providers []CSIProvider `json:"providers,omitempty"`

api/v1alpha1/constants.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const (
88
CNIVariableName = "cni"
99
// NFDVariableName is the NFD external patch variable name.
1010
NFDVariableName = "nfd"
11+
// ClusterAutoscalerVariableName is the cluster-autoscaler external patch variable name.
12+
ClusterAutoscalerVariableName = "clusterAutoscaler"
1113
// AWSVariableName is the AWS config patch variable name.
1214
AWSVariableName = "aws"
1315
)

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/capi-runtime-extensions/README.md

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,44 +23,45 @@ A Helm chart for capi-runtime-extensions
2323

2424
## Values
2525

26-
| Key | Type | Default | Description |
27-
|-----|------|---------|-------------|
28-
| certificates.issuer.kind | string | `"Issuer"` | |
29-
| certificates.issuer.name | string | `""` | |
30-
| certificates.issuer.selfSigned | bool | `true` | |
31-
| deployDefaultClusterClasses | bool | `true` | |
32-
| deployment.replicas | int | `1` | |
33-
| env | object | `{}` | |
34-
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.AWSCluster.configMap.content | string | `""` | |
35-
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.AWSCluster.configMap.name | string | `"calico-cni-crs-installation-awscluster"` | |
36-
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.AWSCluster.create | bool | `true` | |
37-
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.DockerCluster.configMap.content | string | `""` | |
38-
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.DockerCluster.configMap.name | string | `"calico-cni-crs-installation-dockercluster"` | |
39-
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.DockerCluster.create | bool | `true` | |
40-
| hooks.cni.calico.crsStrategy.defaultTigeraOperatorConfigMap.name | string | `"tigera-operator"` | |
41-
| hooks.cni.calico.defaultPodSubnet | string | `"192.168.0.0/16"` | |
42-
| hooks.cni.calico.helmAddonStrategy.defaultValueTemplatesConfigMaps.AWSCluster.create | bool | `true` | |
43-
| hooks.cni.calico.helmAddonStrategy.defaultValueTemplatesConfigMaps.AWSCluster.name | string | `"calico-cni-helm-values-template-awscluster"` | |
44-
| hooks.cni.calico.helmAddonStrategy.defaultValueTemplatesConfigMaps.DockerCluster.create | bool | `true` | |
45-
| hooks.cni.calico.helmAddonStrategy.defaultValueTemplatesConfigMaps.DockerCluster.name | string | `"calico-cni-helm-values-template-dockercluster"` | |
46-
| hooks.cni.cilium.crsStrategy.defaultCiliumConfigMap.name | string | `"cilium"` | |
47-
| hooks.cni.cilium.helmAddonStrategy.defaultValueTemplateConfigMap.create | bool | `true` | |
48-
| hooks.cni.cilium.helmAddonStrategy.defaultValueTemplateConfigMap.name | string | `"default-cilium-cni-helm-values-template"` | |
49-
| hooks.nfd.crsStrategy.defaultInstallationConfigMap.name | string | `"node-feature-discovery"` | |
50-
| hooks.nfd.helmAddonStrategy.defaultValueTemplateConfigMap.create | bool | `true` | |
51-
| hooks.nfd.helmAddonStrategy.defaultValueTemplateConfigMap.name | string | `"default-nfd-helm-values-template"` | |
52-
| image.pullPolicy | string | `"IfNotPresent"` | |
53-
| image.repository | string | `"ghcr.io/d2iq-labs/capi-runtime-extensions"` | |
54-
| image.tag | string | `""` | |
55-
| imagePullSecrets | list | `[]` | Optional secrets used for pulling the container image |
56-
| nodeSelector | object | `{}` | |
57-
| priorityClassName | string | `""` | Optional priority class to be used for the pod. |
58-
| resources.limits.cpu | string | `"100m"` | |
59-
| resources.limits.memory | string | `"256Mi"` | |
60-
| resources.requests.cpu | string | `"100m"` | |
61-
| resources.requests.memory | string | `"128Mi"` | |
62-
| securityContext.runAsUser | int | `65532` | |
63-
| service.annotations | object | `{}` | |
64-
| service.port | int | `443` | |
65-
| service.type | string | `"ClusterIP"` | |
66-
| tolerations | list | `[]` | |
26+
| Key | Type | Default | Description |
27+
|--------------------------------------------------------------------------------------------|------|---------------------------------------------------|-------------|
28+
| certificates.issuer.kind | string | `"Issuer"` | |
29+
| certificates.issuer.name | string | `""` | |
30+
| certificates.issuer.selfSigned | bool | `true` | |
31+
| deployDefaultClusterClasses | bool | `true` | |
32+
| deployment.replicas | int | `1` | |
33+
| env | object | `{}` | |
34+
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.AWSCluster.configMap.content | string | `""` | |
35+
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.AWSCluster.configMap.name | string | `"calico-cni-crs-installation-awscluster"` | |
36+
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.AWSCluster.create | bool | `true` | |
37+
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.DockerCluster.configMap.content | string | `""` | |
38+
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.DockerCluster.configMap.name | string | `"calico-cni-crs-installation-dockercluster"` | |
39+
| hooks.cni.calico.crsStrategy.defaultInstallationConfigMaps.DockerCluster.create | bool | `true` | |
40+
| hooks.cni.calico.crsStrategy.defaultTigeraOperatorConfigMap.name | string | `"tigera-operator"` | |
41+
| hooks.cni.calico.defaultPodSubnet | string | `"192.168.0.0/16"` | |
42+
| hooks.cni.calico.helmAddonStrategy.defaultValueTemplatesConfigMaps.AWSCluster.create | bool | `true` | |
43+
| hooks.cni.calico.helmAddonStrategy.defaultValueTemplatesConfigMaps.AWSCluster.name | string | `"calico-cni-helm-values-template-awscluster"` | |
44+
| hooks.cni.calico.helmAddonStrategy.defaultValueTemplatesConfigMaps.DockerCluster.create | bool | `true` | |
45+
| hooks.cni.calico.helmAddonStrategy.defaultValueTemplatesConfigMaps.DockerCluster.name | string | `"calico-cni-helm-values-template-dockercluster"` | |
46+
| hooks.cni.cilium.crsStrategy.defaultCiliumConfigMap.name | string | `"cilium"` | |
47+
| hooks.cni.cilium.helmAddonStrategy.defaultValueTemplateConfigMap.create | bool | `true` | |
48+
| hooks.cni.cilium.helmAddonStrategy.defaultValueTemplateConfigMap.name | string | `"default-cilium-cni-helm-values-template"` | |
49+
| hooks.nfd.crsStrategy.defaultInstallationConfigMap.name | string | `"node-feature-discovery"` | |
50+
| hooks.nfd.helmAddonStrategy.defaultValueTemplateConfigMap.create | bool | `true` | |
51+
| hooks.nfd.helmAddonStrategy.defaultValueTemplateConfigMap.name | string | `"default-nfd-helm-values-template"` | |
52+
| hooks.clusterAutoscaler.crsStrategy.defaultInstallationConfigMap.name | string | `"cluster-autoscaler"` | |
53+
| image.pullPolicy | string | `"IfNotPresent"` | |
54+
| image.repository | string | `"ghcr.io/d2iq-labs/capi-runtime-extensions"` | |
55+
| image.tag | string | `""` | |
56+
| imagePullSecrets | list | `[]` | Optional secrets used for pulling the container image |
57+
| nodeSelector | object | `{}` | |
58+
| priorityClassName | string | `""` | Optional priority class to be used for the pod. |
59+
| resources.limits.cpu | string | `"100m"` | |
60+
| resources.limits.memory | string | `"256Mi"` | |
61+
| resources.requests.cpu | string | `"100m"` | |
62+
| resources.requests.memory | string | `"128Mi"` | |
63+
| securityContext.runAsUser | int | `65532` | |
64+
| service.annotations | object | `{}` | |
65+
| service.port | int | `443` | |
66+
| service.type | string | `"ClusterIP"` | |
67+
| tolerations | list | `[]` | |

0 commit comments

Comments
 (0)