Skip to content

Commit 2d2ab3a

Browse files
authored
support switching of network overlay mode (#504)
1 parent e32fa3a commit 2d2ab3a

File tree

30 files changed

+1817
-2
lines changed

30 files changed

+1817
-2
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: admissionregistration.k8s.io/v1
2+
kind: MutatingWebhookConfiguration
3+
metadata:
4+
name: {{ include "name" . }}
5+
webhooks:
6+
- name: mutation.openstack.provider.extensions.gardener.cloud
7+
rules:
8+
- apiGroups:
9+
- "core.gardener.cloud"
10+
apiVersions:
11+
- v1alpha1
12+
- v1beta1
13+
operations:
14+
- CREATE
15+
- UPDATE
16+
resources:
17+
- shoots
18+
failurePolicy: Fail
19+
objectSelector:
20+
{{- if .Values.global.webhookConfig.useObjectSelector }}
21+
matchLabels:
22+
provider.extensions.gardener.cloud/openstack: "true"
23+
{{- end }}
24+
namespaceSelector: {}
25+
sideEffects: None
26+
admissionReviewVersions:
27+
- v1
28+
- v1beta1
29+
clientConfig:
30+
{{- if .Values.global.virtualGarden.enabled }}
31+
url: {{ printf "https://%s.%s/webhooks/mutate" (include "name" .) (.Release.Namespace) }}
32+
{{- else }}
33+
service:
34+
namespace: {{ .Release.Namespace }}
35+
name: {{ include "name" . }}
36+
path: /webhooks/mutate
37+
{{- end }}
38+
caBundle: {{ required ".Values.global.webhookConfig.caBundle is required" .Values.global.webhookConfig.caBundle | b64enc }}

charts/gardener-extension-admission-openstack/charts/application/templates/rbac.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ rules:
1111
resources:
1212
- cloudprofiles
1313
- secretbindings
14+
- shoots
1415
verbs:
1516
- get
1617
- list
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{- define "cloud-provider-config-route" -}}
2+
[Route]
3+
{{- if .Values.routerID }}
4+
router-id="{{ .Values.routerID }}"
5+
{{- end }}
6+
{{- end -}}

charts/internal/cloud-provider-config/templates/cloud-provider-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{{ include "cloud-provider-config-meta" . }}
55
{{ include "cloud-provider-config-loadbalancer" . }}
66
{{ include "cloud-provider-config-networking" . }}
7+
{{ include "cloud-provider-config-route" . }}
78
{{- end -}}
89
---
910
apiVersion: v1

charts/internal/cloud-provider-config/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ useOctavia: false
3232
# floatingNetworkID: "1234"
3333
# floatingSubnetTags: tag1,tag2
3434
# [Networking]
35+
# routerID: 25611bee-3143-4e81-be81-2d867fcd909f
3536
# internalNetworkName: shoot--my-project--my-cluster
3637
# [BlockStorage]
3738
rescanBlockStorageOnResize: false

docs/usage-as-end-user.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,17 @@ If you don't know which floating pools are available look it up in the respectiv
6363

6464
With `floatingPoolSubnetName` you can explicitly define to which subnet in the floating pool network (defined via `floatingPoolName`) the router should be attached to.
6565

66-
If `networks.id` is an optional field. If it is given, you can specify the uuid of an existing private Neutron network (created manually, by other tooling, ...) that should be reused. A new subnet for the Shoot will be created in it.
66+
`networks.id` is an optional field. If it is given, you can specify the uuid of an existing private Neutron network (created manually, by other tooling, ...) that should be reused. A new subnet for the Shoot will be created in it.
67+
68+
If a `networks.id` is given and calico shoot clusters are created without a network overlay within one network make sure that the pod CIDR specified in `shoot.spec.networking.pods` is not overlapping with any other pod CIDR used in that network.
69+
Overlapping pod CIDRs will lead to disfunctional shoot clusters.
6770

6871
The `networks.router` section describes whether you want to create the shoot cluster in an already existing router or whether to create a new one:
6972

7073
* If `networks.router.id` is given then you have to specify the router id of the existing router that was created by other means (manually, other tooling, ...).
7174
If you want to get a fresh router for the shoot then just omit the `networks.router` field.
7275

73-
* In any case, the shoot cluster will be created in a **new** subnet.
76+
* In any case, the shoot cluster will be created in a **new** subnet.
7477

7578
The `networks.workers` section describes the CIDR for a subnet that is used for all shoot worker nodes, i.e., VMs which later run your applications.
7679

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: admissionregistration.k8s.io/v1
2+
kind: MutatingWebhookConfiguration
3+
metadata:
4+
name: gardener-extension-admission-openstack
5+
webhooks:
6+
- name: mutation.openstack.provider.extensions.gardener.cloud
7+
rules:
8+
- apiGroups:
9+
- "core.gardener.cloud"
10+
apiVersions:
11+
- v1alpha1
12+
- v1beta1
13+
operations:
14+
- CREATE
15+
- UPDATE
16+
resources:
17+
- shoots
18+
failurePolicy: Fail
19+
# Please make sure you are running `gardener@v1.42` or later before enabling this object selector.
20+
objectSelector:
21+
matchLabels:
22+
provider.extensions.gardener.cloud/openstack: "true"
23+
namespaceSelector: {}
24+
sideEffects: None
25+
admissionReviewVersions:
26+
- v1
27+
- v1beta1
28+
clientConfig:
29+
url: "https://localhost:9443/webhooks/mutate"
30+
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMrekNDQWVPZ0F3SUJBZ0lSQUkxdHdSZGtOQnlLSnBzdkcwT0tOUGt3RFFZSktvWklodmNOQVFFTEJRQXcKRnpFVk1CTUdBMVVFQXhNTVoyRnlaR1Z1WlhJdFpHVjJNQjRYRFRJeE1ERXlNVEV3TXpJeE5sb1hEVE14TURFeQpNVEV3TXpJeE5sb3dGekVWTUJNR0ExVUVBeE1NWjJGeVpHVnVaWEl0WkdWMk1JSUJJakFOQmdrcWhraUc5dzBCCkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXNaZ2JqOXFXTE8zZnNHRUFWVkdKNi9iQ0dpdmZwa2FqUGhuWWdUODkKa3BPOTNkemFoOFdiYUUvYWFYRzY5MWJuMnpmb1pPUG9RdmNjL25QMWxrWUdYcGhUR21yN24yeTRQUHhDSVRqVgp5WC9BN2gvb1ZPVEFHWnhoUW14UTdrUDBwSStheTJpa2tVdW1WTjVnWVJkQ1hKMEI4TEhHYXBJTDBOcXI2M1paCm9LRUNWa3Z0ODNwdW9ybG5TL3Z2OU1adzZ6YmFDNjBWbC91NXM1anRRNDlUUXYvdUdGOUNxZmUrckVCZ3hrMzEKeTRXazNuMVVJUkxWLzFOY1hXTzh3T3JRWXp3TS9jbXFlV0w4a253SFh1ZzFVRDE3T2x1SS80TDF0b3M0dG5IYQo5V2tJcXlTRnYxS3lQWm40RGI5bTRuUU5aNTBQOWVNUUFpekZTWk9pZGVrOUl3SURBUUFCbzBJd1FEQU9CZ05WCkhROEJBZjhFQkFNQ0FhWXdEd1lEVlIwVEFRSC9CQVV3QXdFQi96QWRCZ05WSFE0RUZnUVVmRmFKQktzeWpkeUkKbjhkRWlwbGlSZEp3Zll3d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFId3RqcENLUDZ5T21TUXdKT01XUGVxcApveFB1Y0JWNi9MT3FQam1Ga1AvMUtXRlNTWGtWMUMvSVZ1OEtzci9OTnRlSTcxamJWdEx2cVdIUEp0SFdWMTF4CjE4bk9nUWVGbnl3aXF2UXQrZVBRQ3BPeGpaMEJONThINXp0b0w2NzlTczBrdEdNWTEyN2p5S3ZURXEvbE1KWVEKKzFLRStMbDUzRTVCejBTQ04rQVNoYWcvNlBvT2svUU5VNUI0VCsrVlg3VGxscXlScTVGS2k0RXY0RkJpYlFKLwpldlJ6NGg5OEpLandjOU9wRnRkNUtiR001UUp6d1pzN2hGMFNHMjhMa2szOFVhclR1cThTNFl1SnBQOTU1L1VQCnNXR1UrclFRZEx6ZG1vYnk4Qjd0bWU1a04xc08yVTF3U0w5MkdBajU5Tk50aTk1YmtGQjVhUUR2cTgvV3FKND0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
github.com/coreos/go-systemd/v22 v22.3.2
1010
github.com/gardener/etcd-druid v0.12.3
1111
github.com/gardener/gardener v1.59.0
12+
github.com/gardener/gardener-extension-networking-calico v1.27.0
1213
github.com/gardener/machine-controller-manager v0.45.0
1314
github.com/go-logr/logr v1.2.3
1415
github.com/golang/mock v1.6.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ github.com/gardener/etcd-druid v0.12.3 h1:FBpsEe+FrBwJ1a2VhaPlXjZsfIAcHGSsF5DvDO
163163
github.com/gardener/etcd-druid v0.12.3/go.mod h1:EJF6z4Ghv2FGUe1UzZWOEF1MxCA186fxvjBO44oSJX4=
164164
github.com/gardener/gardener v1.59.0 h1:9T8C2lPwaFTKxUi3afpVjmbao/uDcn5lfYRmFqMFoYw=
165165
github.com/gardener/gardener v1.59.0/go.mod h1:4vopE/Pg4LJud1CRg80rAcp94v83MJIgktlHNcSKO84=
166+
github.com/gardener/gardener-extension-networking-calico v1.27.0 h1:L51BcYbrcpQjmGl+E9HsW+xcJVZOfjbe403DRDwuUME=
167+
github.com/gardener/gardener-extension-networking-calico v1.27.0/go.mod h1:MURFRmYPHiXSfmJ82S3nXH3qGcszeYQwhMVKn/J5XoU=
166168
github.com/gardener/hvpa-controller/api v0.5.0 h1:f4F3O7YUrenwh4S3TgPREPiB287JjjUiUL18OqPLyAA=
167169
github.com/gardener/hvpa-controller/api v0.5.0/go.mod h1:QQl3ELkCaki+8RhXl0FZMfvnm0WCGwGJlGmrxJj6lvM=
168170
github.com/gardener/machine-controller-manager v0.45.0 h1:rpf0PHRXJMGY93oMruNP+tnMawKJXhhzCACyNJsT8Lo=

pkg/admission/cmd/options.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package cmd
1616

1717
import (
18+
"github.com/gardener/gardener-extension-provider-openstack/pkg/admission/mutator"
1819
"github.com/gardener/gardener-extension-provider-openstack/pkg/admission/validator"
1920

2021
webhookcmd "github.com/gardener/gardener/extensions/pkg/webhook/cmd"
@@ -25,5 +26,6 @@ func GardenWebhookSwitchOptions() *webhookcmd.SwitchOptions {
2526
return webhookcmd.NewSwitchOptions(
2627
webhookcmd.Switch(validator.Name, validator.New),
2728
webhookcmd.Switch(validator.SecretsValidatorName, validator.NewSecretsWebhook),
29+
webhookcmd.Switch(mutator.Name, mutator.New),
2830
)
2931
}

0 commit comments

Comments
 (0)