Skip to content

Commit

Permalink
Alternative subnet values
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Noble <[email protected]>
  • Loading branch information
AverageMarcus committed Jan 10, 2023
1 parent 01be7c9 commit f479ac0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 42 deletions.
8 changes: 5 additions & 3 deletions helm/cluster-aws/templates/_aws_cluster.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ spec:
availabilityZoneUsageLimit: {{ .Values.network.availabilityZoneUsageLimit }}
cidrBlock: {{ .Values.network.vpcCIDR }}
subnets:
{{- range $i, $subnet := .Values.network.subnets }}
- cidrBlock: "{{ $subnet.cidrBlock }}"
{{- range $j, $subnet := .Values.network.subnets }}
{{- range $i, $cidr := $subnet.cidrBlocks }}
- cidrBlock: "{{ $cidr }}"
availabilityZone: "{{ include "aws-region" $ }}{{ add 97 $i | printf "%c" }}"
isPublic: {{ $subnet.isPublic }}
isPublic: {{ $subnet.isPublic | default false }}
tags:
{{- toYaml $subnet.tags | nindent 8 }}
{{- end }}
{{- end }}
sshKeyName: ssh-key
region: {{ include "aws-region" . }}
{{ end }}
7 changes: 7 additions & 0 deletions helm/cluster-aws/templates/_validation.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ Instead this is used to perform some validation checks on values that dont make
{{- fail "`.Values.network.apiMode` cannot be 'public' if `.Values.network.vpcMode` is set to 'private'" }}
{{ end }}

{{- range $i, $subnet := .Values.network.subnets }}
{{ if neq (len $subnet.cidrBlocks) .Values.network.availabilityZoneUsageLimit }}
{{- fail "`cidrBlocks` must contain the same number of entries as specified by `.network.availabilityZoneUsageLimit`" }}
{{ end }}
{{- end }}


{{- end -}}
42 changes: 3 additions & 39 deletions helm/cluster-aws/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,54 +49,18 @@ network:
# subnets defines all the subnets for a cluster.
# There must be at least as many as the value of `availabilityZoneUsageLimit` and all subnets must be within the `vpcCIDR` range.
subnets:
- cidrBlock: 10.0.0.0/23
availabilityZone: eu-west-1a
- cidrBlocks: ["10.0.0.0/23", "10.0.2.0/23", "10.0.4.0/23"]
isPublic: true
tags:
subnet.giantswarm.io/role: load-balancers
- cidrBlock: 10.0.2.0/23
availabilityZone: eu-west-1b
isPublic: true
tags:
subnet.giantswarm.io/role: load-balancers
- cidrBlock: 10.0.4.0/23
availabilityZone: eu-west-1c
isPublic: true
tags:
subnet.giantswarm.io/role: load-balancers

- cidrBlock: 10.0.6.0/23
availabilityZone: eu-west-1a
- cidrBlocks: ["10.0.6.0/23", "10.0.8.0/23", "10.0.10.0/23"]
isPublic: false
tags:
subnet.giantswarm.io/role: control-plane
- cidrBlock: 10.0.8.0/23
availabilityZone: eu-west-1b
isPublic: false
tags:
subnet.giantswarm.io/role: control-plane
- cidrBlock: 10.0.10.0/23
availabilityZone: eu-west-1c
isPublic: false
tags:
subnet.giantswarm.io/role: control-plane

- cidrBlock: 10.0.64.0/18
availabilityZone: eu-west-1a
isPublic: false
tags:
subnet.giantswarm.io/role: workers
- cidrBlock: 10.0.128.0/18
availabilityZone: eu-west-1b
- cidrBlocks: ["10.0.64.0/18", "10.0.128.0/18", "10.0.192.0/18"]
isPublic: false
tags:
subnet.giantswarm.io/role: workers
- cidrBlock: 10.0.192.0/18
availabilityZone: eu-west-1c
isPublic: false
tags:
subnet.giantswarm.io/role: workers


bastion:
enabled: true
Expand Down

0 comments on commit f479ac0

Please sign in to comment.