Skip to content

Commit 450255f

Browse files
authored
Make baseDomain and managementCluster required values (#1538)
* Make baseDomain and managementCluster required values * Move required values to central place
1 parent db63d0d commit 450255f

24 files changed

+51
-33
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Changed
1313

14+
- Make `global.baseDomain` and `global.managementCluster` required values. These values will be passed to the chart when deploying it from the `cluster-app-installation-values` ConfigMap in the default namespace.
15+
- Extract required values to its own central file to avoid repeating the `required` keyword and error messages. This is normally done automatically by a Kyverno policy.
1416
- Change the default root disk size for Karpenter node pools. Karpenter will choose the cheapest instances, and certain instances, like `g6f.xlarge` come with some drivers that require a larger disk.
1517
- Chart: Update `cluster` to v4.3.0.
1618

helm/cluster-aws/ci/ci-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
global:
22
release:
33
version: 29.1.0
4+
managementCluster: test
45
metadata:
56
name: test-wc
67
organization: "test"

helm/cluster-aws/ci/test-eni-mode-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
global:
22
release:
33
version: 29.1.0
4+
managementCluster: test
45
metadata:
56
name: test-wc
67
organization: "test"

helm/cluster-aws/ci/test-multiple-service-account-issuers-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
global:
22
release:
33
version: v27.0.0-alpha.1
4+
managementCluster: test
45
metadata:
56
name: test-wc
67
organization: "test"

helm/cluster-aws/ci/test-multiple-vpc-cidrs-eni-mode-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
global:
22
release:
33
version: 29.1.0
4+
managementCluster: test
45
metadata:
56
name: test-wc-multiple-vpc-cidrs-eni-mode
67
organization: "test"

helm/cluster-aws/ci/test-spot-instances-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
global:
22
release:
33
version: 29.1.0
4+
managementCluster: test
45
metadata:
56
name: test-wc-minimal
67
organization: test

helm/cluster-aws/ci/test-subnet-tags-values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
global:
22
release:
33
version: v29.1.0
4+
managementCluster: test
45
metadata:
56
name: test-wc
67
organization: "test"

helm/cluster-aws/files/etc/systemd/network/99-unmanaged-devices.network

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if eq (required "global.connectivity.cilium.ipamMode is required" .Values.global.connectivity.cilium.ipamMode) "eni" -}}
1+
{{- if eq .Values.global.connectivity.cilium.ipamMode "eni" -}}
22
# https://docs.cilium.io/en/latest/network/concepts/ipam/eni/#node-configuration
33
#
44
# For ENI mode, this ensures the Cilium-created network interfaces are not managed, so that they

helm/cluster-aws/files/opt/bin/kubelet-aws-config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ err_report() {
66
}
77
trap 'err_report ${LINENO}' ERR
88

9-
{{- if ne (required "global.connectivity.cilium.ipamMode is required" .Values.global.connectivity.cilium.ipamMode) "eni" }}
9+
{{- if ne .Values.global.connectivity.cilium.ipamMode "eni" }}
1010

1111
echo "Skipping setting --max-pods based on instance type because Cilium ENI mode is not used and thus no such restrictions apply."
1212
exit 0

helm/cluster-aws/templates/_aws_cluster.tpl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- define "aws-cluster" }}
2-
{{- if and (regexMatch "\\.internal$" (required "global.connectivity.baseDomain is required" .Values.global.connectivity.baseDomain)) (eq (required "global.connectivity.dns.mode required" .Values.global.connectivity.dns.mode) "public") }}
2+
{{- if and (regexMatch "\\.internal$" .Values.global.connectivity.baseDomain) (eq (required "global.connectivity.dns.mode required" .Values.global.connectivity.dns.mode) "public") }}
33
{{- fail "global.connectivity.dns.mode=public cannot be combined with a '*.internal' baseDomain since reserved-as-private TLDs are not propagated to public DNS servers and therefore crucial DNS records such as api.<baseDomain> cannot be looked up" }}
44
{{- end }}
55
{{- $region := include "aws-region" . }}
@@ -65,51 +65,51 @@ spec:
6565
cidrBlocks: {{- toYaml ((concat .Values.global.controlPlane.loadBalancerIngressAllowCidrBlocks (list "95.179.153.65/32" "185.102.95.187/32")) | uniq) | nindent 6 }}
6666
{{- end }}
6767
network:
68-
{{- if eq (required "global.connectivity.cilium.ipamMode is required" .Values.global.connectivity.cilium.ipamMode) "eni" }}
68+
{{- if eq .Values.global.connectivity.cilium.ipamMode "eni" }}
6969
additionalControlPlaneIngressRules:
7070
- description: "Allow traffic from pods to control plane nodes for access of applications to Kubernetes API"
7171
protocol: "-1" # all
7272
fromPort: -1
7373
toPort: -1
7474

7575
# We could also use `sourceSecurityGroupIds` here, but the ID of the "<cluster>-pods" security group isn't known yet
76-
cidrBlocks: {{ required "global.connectivity.network.pods.cidrBlocks is required" .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
76+
cidrBlocks: {{ .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
7777
additionalNodeIngressRules:
7878
- description: "Allow traffic from Pods to the Cilium Relay port running on the nodes"
7979
protocol: "tcp"
8080
fromPort: 4244
8181
toPort: 4244
82-
cidrBlocks: {{ required "global.connectivity.network.pods.cidrBlocks is required" .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
82+
cidrBlocks: {{ .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
8383
- description: "Allow traffic from Pods to Chart Operator running on the nodes"
8484
protocol: "tcp"
8585
fromPort: 8000
8686
toPort: 8000
87-
cidrBlocks: {{ required "global.connectivity.network.pods.cidrBlocks is required" .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
87+
cidrBlocks: {{ .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
8888
- description: "Allow traffic from Pods to EBS CSI Controller running on the nodes"
8989
protocol: "tcp"
9090
fromPort: 8610
9191
toPort: 8610
92-
cidrBlocks: {{ required "global.connectivity.network.pods.cidrBlocks is required" .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
92+
cidrBlocks: {{ .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
9393
- description: "Allow traffic from Pods to Cilium Operator and Envoy running on the nodes"
9494
protocol: "tcp"
9595
fromPort: 9963
9696
toPort: 9964
97-
cidrBlocks: {{ required "global.connectivity.network.pods.cidrBlocks is required" .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
97+
cidrBlocks: {{ .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
9898
- description: "Allow traffic from Pods to the Kubelet API running on the nodes"
9999
protocol: "tcp"
100100
fromPort: 10250
101101
toPort: 10250
102-
cidrBlocks: {{ required "global.connectivity.network.pods.cidrBlocks is required" .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
102+
cidrBlocks: {{ .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
103103
- description: "Allow traffic from Pods to Node Exporter running on the nodes"
104104
protocol: "tcp"
105105
fromPort: 10300
106106
toPort: 10300
107-
cidrBlocks: {{ required "global.connectivity.network.pods.cidrBlocks is required" .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
107+
cidrBlocks: {{ .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
108108
- description: "Allow traffic from Pods to Kubernetes Resource Count Exporter running on the nodes"
109109
protocol: "tcp"
110110
fromPort: 10999
111111
toPort: 10999
112-
cidrBlocks: {{ required "global.connectivity.network.pods.cidrBlocks is required" .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
112+
cidrBlocks: {{ .Values.global.connectivity.network.pods.cidrBlocks | toYaml | nindent 10 }}
113113
{{- end }}
114114
cni:
115115
cniIngressRules:
@@ -139,10 +139,10 @@ spec:
139139
{{- if .Values.global.connectivity.network.internetGatewayId }}
140140
internetGatewayId: {{ .Values.global.connectivity.network.internetGatewayId }}
141141
{{- end }}
142-
{{- if eq (required "global.connectivity.cilium.ipamMode is required" .Values.global.connectivity.cilium.ipamMode) "eni" }}
142+
{{- if eq .Values.global.connectivity.cilium.ipamMode "eni" }}
143143
secondaryCidrBlocks:
144144
# Managed by Cilium in ENI mode
145-
{{- if not (required "global.connectivity.network.pods.cidrBlocks is required" .Values.global.connectivity.network.pods.cidrBlocks | first | regexMatch "/(1[6-9]|2[0-8])$") }}
145+
{{- if not (.Values.global.connectivity.network.pods.cidrBlocks | first | regexMatch "/(1[6-9]|2[0-8])$") }}
146146
{{ fail (printf "You have set `global.connectivity.cilium.ipamMode=eni`, but the pod CIDR %s is not supported as AWS VPC CIDR (see https://docs.aws.amazon.com/vpc/latest/userguide/vpc-cidr-blocks.html: /16 to /28 sizes are supported). Please change `global.connectivity.network.pods.cidrBlocks` to a valid value (see https://github.com/giantswarm/cluster-aws/tree/main/helm/cluster-aws#connectivity)." (.Values.global.connectivity.network.pods.cidrBlocks | first | quote)) }}
147147
{{- end }}
148148
- ipv4CidrBlock: {{ .Values.global.connectivity.network.pods.cidrBlocks | first | quote }}
@@ -163,7 +163,7 @@ spec:
163163
{{ end }}
164164
{{- end }}
165165
{{- $allCidrs := concat $vpcCidrs ($.Values.global.connectivity.network.nodePortIngressRuleCidrBlocks | default (list)) }}
166-
{{- if eq (required "global.connectivity.cilium.ipamMode is required" .Values.global.connectivity.cilium.ipamMode) "eni" }}
166+
{{- if eq .Values.global.connectivity.cilium.ipamMode "eni" }}
167167
{{- $allCidrs = concat $allCidrs ($.Values.global.connectivity.network.pods.cidrBlocks | default (list)) }}
168168
{{- end }}
169169
{{- $seen := dict }}
@@ -230,7 +230,7 @@ spec:
230230
{{- end }}
231231
{{- end }}
232232
233-
{{- if eq (required "global.connectivity.cilium.ipamMode is required" .Values.global.connectivity.cilium.ipamMode) "eni" }}
233+
{{- if eq .Values.global.connectivity.cilium.ipamMode "eni" }}
234234
{{- range $j, $subnet := .Values.global.connectivity.eniModePodSubnets }}
235235
{{- range $i, $cidr := $subnet.cidrBlocks }}
236236
- id: "{{ include "resource.default.name" $ }}-subnet-secondary-{{ if eq (len $cidr.availabilityZone) 1 }}{{ include "aws-region" $ }}{{ end }}{{ $cidr.availabilityZone }}"

0 commit comments

Comments
 (0)