Skip to content

Commit

Permalink
Merge pull request #54 from timuthy/feature.cp-restart
Browse files Browse the repository at this point in the history
Allow Gardener to restart CCM & MCM
  • Loading branch information
rfranzke authored Mar 31, 2020
2 parents 57c28cd + 9b3b148 commit a3fd444
Show file tree
Hide file tree
Showing 59 changed files with 868 additions and 132 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: cloud-controller-manager
namespace: {{ .Release.Namespace }}
labels:
app: kubernetes
role: cloud-controller-manager
spec:
type: ClusterIP
clusterIP: None
ports:
- name: metrics
port: {{ include "cloud-controller-manager.port" . }}
protocol: TCP
selector:
app: kubernetes
role: cloud-controller-manager
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
apiVersion: v1
kind: Service
metadata:
name: cloud-controller-manager
namespace: {{ .Release.Namespace }}
labels:
app: kubernetes
role: cloud-controller-manager
spec:
type: ClusterIP
clusterIP: None
ports:
- name: metrics
port: {{ include "cloud-controller-manager.port" . }}
protocol: TCP
selector:
app: kubernetes
role: cloud-controller-manager
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -48,6 +29,9 @@ spec:
networking.gardener.cloud/to-private-networks: allowed
networking.gardener.cloud/to-shoot-apiserver: allowed
networking.gardener.cloud/from-prometheus: allowed
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels | indent 8 }}
{{- end }}
spec:
tolerations:
- effect: NoExecute
Expand Down
1 change: 1 addition & 0 deletions charts/internal/cloud-controller-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ clusterName: shoot-foo-bar
kubernetesVersion: 1.7.5
podNetwork: 192.168.0.0/16
podAnnotations: {}
podLabels: {}
featureGates: {}
# CustomResourceValidation: true
# RotateKubeletServerCertificate: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ spec:
networking.gardener.cloud/to-seed-apiserver: allowed
networking.gardener.cloud/to-shoot-apiserver: allowed
networking.gardener.cloud/from-prometheus: allowed
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels | indent 8 }}
{{- end }}
spec:
serviceAccountName: machine-controller-manager
terminationGracePeriodSeconds: 5
Expand Down
2 changes: 2 additions & 0 deletions charts/internal/machine-controller-manager/seed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ replicas: 1

podAnnotations: {}

podLabels: {}

providerName: provider-foo

namespace:
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/ahmetb/gen-crd-api-reference-docs v0.1.5
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
github.com/gardener/etcd-druid v0.1.3
github.com/gardener/gardener v1.1.1-0.20200323102039-58593d8be86a
github.com/gardener/gardener-extensions v1.5.0
github.com/gardener/gardener v1.1.1-0.20200330051317-a326f96cf32b
github.com/gardener/gardener-extensions v1.5.1-0.20200330101454-c65957bd80b5
github.com/gardener/machine-controller-manager v0.26.0
github.com/go-logr/logr v0.1.0
github.com/gobuffalo/packr/v2 v2.1.0
Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,10 @@ github.com/gardener/etcd-druid v0.1.3 h1:uiPKUHubieRziHR7lr7I0WzIglf2aNVWf94Gm5N
github.com/gardener/etcd-druid v0.1.3/go.mod h1:/A8kSp7DSo7oOhsOhD9Se/xF6BOD9TQJMawf6k7AOsU=
github.com/gardener/external-dns-management v0.7.3 h1:SAW9ur2mjZ+x89xbmcplJgqNUmFGYIZLI2E+PaBhhG0=
github.com/gardener/external-dns-management v0.7.3/go.mod h1:Y3om11E865x4aQ7cmcHjknb8RMgCO153huRb/SvP+9o=
github.com/gardener/gardener v1.1.1-0.20200311075931-7f7e52b986e7 h1:UD25lsw3fYBK7pUlXkGwUXmlpnksG9JbdwC75XZTBOQ=
github.com/gardener/gardener v1.1.1-0.20200311075931-7f7e52b986e7/go.mod h1:lGAx5NkFDWoC4hPIL+lHJamafBxmOt5MrHq9hGtp5VI=
github.com/gardener/gardener v1.1.1-0.20200323102039-58593d8be86a h1:TkMIvx1xRmd3xLuORXEqsQhpni49+wfuT4keC6d3Tsc=
github.com/gardener/gardener v1.1.1-0.20200323102039-58593d8be86a/go.mod h1:lGAx5NkFDWoC4hPIL+lHJamafBxmOt5MrHq9hGtp5VI=
github.com/gardener/gardener-extensions v1.5.0 h1:6JkU0/DV2bJvwkuPoP7/nPlyCrzPGKfw5j4f+wtXBeI=
github.com/gardener/gardener-extensions v1.5.0/go.mod h1:yCdFgMAz++ex3d1fmhN3Yti9MR9HN9iKTUjz5eI0uIQ=
github.com/gardener/gardener v1.1.1-0.20200330051317-a326f96cf32b h1:MkEDp9PdrZPkIAPGj6oNcKl0fBaOcJ1ddKsAA7bVWnI=
github.com/gardener/gardener v1.1.1-0.20200330051317-a326f96cf32b/go.mod h1:lGAx5NkFDWoC4hPIL+lHJamafBxmOt5MrHq9hGtp5VI=
github.com/gardener/gardener-extensions v1.5.1-0.20200330101454-c65957bd80b5 h1:zDXG4369jfXvZlPNQe4YX38VA0h5SDq2xk8dqLg73e4=
github.com/gardener/gardener-extensions v1.5.1-0.20200330101454-c65957bd80b5/go.mod h1:+0MkNqbRaTvPMfEe/MoS31L5FM8W32WYvhpH4Y53Y5s=
github.com/gardener/gardener-resource-manager v0.10.0 h1:6OUKoWI3oha42F0oJN8OEo3UR+D3onOCel4Th+zgotU=
github.com/gardener/gardener-resource-manager v0.10.0/go.mod h1:0pKTHOhvU91eQB0EYr/6Ymd7lXc/5Hi8P8tF/gpV0VQ=
github.com/gardener/hvpa-controller v0.0.0-20191014062307-fad3bdf06a25 h1:nOFITmV7vt4fcYPEXgj66Qs83FdDEMvL/LQcR0diRRE=
Expand Down
3 changes: 3 additions & 0 deletions pkg/controller/controlplane/valuesprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ func getCCMChartValues(
"checksum/secret-cloudprovider": checksums[v1beta1constants.SecretNameCloudProvider],
"checksum/configmap-cloud-provider-config-cloud-controller-manager": checksums[openstacktypes.CloudProviderConfigCloudControllerManagerName],
},
"podLabels": map[string]interface{}{
v1beta1constants.LabelPodMaintenanceRestart: "true",
},
}

if cpConfig.CloudControllerManager != nil {
Expand Down
3 changes: 3 additions & 0 deletions pkg/controller/controlplane/valuesprovider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ var _ = Describe("ValuesProvider", func() {
"checksum/secret-cloudprovider": "8bafb35ff1ac60275d62e1cbd495aceb511fb354f74a20f7d06ecb48b3a68432",
"checksum/configmap-cloud-provider-config-cloud-controller-manager": "08a7bc7fe8f59b055f173145e211760a83f02cf89635cef26ebb351378635606",
},
"podLabels": map[string]interface{}{
"maintenance.gardener.cloud/restart": "true",
},
"featureGates": map[string]bool{
"CustomResourceValidation": true,
},
Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/worker/machine_controller_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/gardener/gardener-extension-provider-openstack/pkg/openstack"
extensionscontroller "github.com/gardener/gardener-extensions/pkg/controller"

v1beta1constants "github.com/gardener/gardener/pkg/apis/core/v1beta1/constants"
"github.com/gardener/gardener/pkg/utils/chart"
kutil "github.com/gardener/gardener/pkg/utils/kubernetes"
appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -65,6 +66,9 @@ func (w *workerDelegate) GetMachineControllerManagerChartValues(ctx context.Cont
"namespace": map[string]interface{}{
"uid": namespace.UID,
},
"podLabels": map[string]interface{}{
v1beta1constants.LabelPodMaintenanceRestart: "true",
},
}, nil
}

Expand Down
11 changes: 6 additions & 5 deletions pkg/controller/worker/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error {
}

for _, pool := range w.worker.Spec.Pools {
zoneLen := len(pool.Zones)
zoneLen := int32(len(pool.Zones))

workerPoolHash, err := worker.WorkerPoolHash(pool, w.cluster)
if err != nil {
Expand All @@ -134,6 +134,7 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error {
}

for zoneIndex, zone := range pool.Zones {
zoneIdx := int32(zoneIndex)
machineClassSpec := map[string]interface{}{
"region": w.worker.Spec.Region,
"availabilityZone": zone,
Expand Down Expand Up @@ -170,10 +171,10 @@ func (w *workerDelegate) generateMachineConfig(ctx context.Context) error {
Name: deploymentName,
ClassName: className,
SecretName: className,
Minimum: worker.DistributeOverZones(zoneIndex, pool.Minimum, zoneLen),
Maximum: worker.DistributeOverZones(zoneIndex, pool.Maximum, zoneLen),
MaxSurge: worker.DistributePositiveIntOrPercent(zoneIndex, pool.MaxSurge, zoneLen, pool.Maximum),
MaxUnavailable: worker.DistributePositiveIntOrPercent(zoneIndex, pool.MaxUnavailable, zoneLen, pool.Minimum),
Minimum: worker.DistributeOverZones(zoneIdx, pool.Minimum, zoneLen),
Maximum: worker.DistributeOverZones(zoneIdx, pool.Maximum, zoneLen),
MaxSurge: worker.DistributePositiveIntOrPercent(zoneIdx, pool.MaxSurge, zoneLen, pool.Maximum),
MaxUnavailable: worker.DistributePositiveIntOrPercent(zoneIdx, pool.MaxUnavailable, zoneLen, pool.Minimum),
Labels: pool.Labels,
Annotations: pool.Annotations,
Taints: pool.Taints,
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/worker/machines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ var _ = Describe("Machines", func() {
securityGroupName string

namePool1 string
minPool1 int
maxPool1 int
minPool1 int32
maxPool1 int32
maxSurgePool1 intstr.IntOrString
maxUnavailablePool1 intstr.IntOrString

namePool2 string
minPool2 int
maxPool2 int
minPool2 int32
maxPool2 int32
maxSurgePool2 intstr.IntOrString
maxUnavailablePool2 intstr.IntOrString

Expand Down

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

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

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

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

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

41 changes: 21 additions & 20 deletions vendor/github.com/gardener/gardener/pkg/api/extensions/accessor.go

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

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

Loading

0 comments on commit a3fd444

Please sign in to comment.