Skip to content

Commit

Permalink
Deploy ingress-gce only when dualstack networking is enabled.
Browse files Browse the repository at this point in the history
Signed-off-by: Artiom Diomin <[email protected]>
  • Loading branch information
kron4eg committed Oct 3, 2024
1 parent 190f8a7 commit 6195d5d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ rules:
- apiGroups: ["extensions", "networking.k8s.io"]
resources: ["ingresses"]
verbs: ["get", "list", "watch"]
# For now, GLBC annotates ingress resources with various state and statuses:
# https://github.com/kubernetes/ingress-gce/blob/50d49b077d9ab4362a02fae05f94e433cd3f08dc/pkg/controller/controller.go#L579
# TODO(rramkumar1): Remove unnecessary `update` permission once statuses are propagated through `ingresses/status`
- apiGroups: ["extensions", "networking.k8s.io"]
resources: ["ingresses"]
verbs: ["update"]
Expand Down
21 changes: 17 additions & 4 deletions pkg/controller/controlplane/valuesprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
extensionscontroller "github.com/gardener/gardener/extensions/pkg/controller"
"github.com/gardener/gardener/extensions/pkg/controller/controlplane/genericactuator"
extensionssecretsmanager "github.com/gardener/gardener/extensions/pkg/util/secret/manager"
"github.com/gardener/gardener/pkg/apis/core/v1beta1"
gardencorcorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1"
v1beta1constants "github.com/gardener/gardener/pkg/apis/core/v1beta1/constants"
gardencorev1beta1helper "github.com/gardener/gardener/pkg/apis/core/v1beta1/helper"
extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
Expand Down Expand Up @@ -412,10 +412,21 @@ func (vp *valuesProvider) getControlPlaneChartValues(
},
gcp.CloudControllerManagerName: ccm,
gcp.CSIControllerName: csi,
gcp.IngressGCEName: map[string]interface{}{"enabled": true},
gcp.IngressGCEName: map[string]interface{}{
"enabled": isDualstackEnabled(cluster.Shoot.Spec.Networking),
"replicas": extensionscontroller.GetControlPlaneReplicas(cluster, scaledDown, 1),
},
}, nil
}

func isDualstackEnabled(networking *gardencorcorev1beta1.Networking) bool {
if networking != nil {
return !gardencorcorev1beta1.IsIPv4SingleStack(networking.IPFamilies)
}

return false
}

// getCCMChartValues collects and returns the CCM chart values.
func (vp *valuesProvider) getCCMChartValues(
cpConfig *apisgcp.ControlPlaneConfig,
Expand Down Expand Up @@ -523,7 +534,9 @@ func getControlPlaneShootChartValues(
"caBundle": string(caSecret.Data[secretutils.DataKeyCertificateBundle]),
},
},
"default-http-backend": map[string]interface{}{"enabled": true},
gcp.DefaultHTTPBackendImageName: map[string]interface{}{
"enabled": isDualstackEnabled(cluster.Shoot.Spec.Networking),
},
}, nil
}

Expand Down Expand Up @@ -574,7 +587,7 @@ func getNetworkNames(
return networkName, subNetworkName
}

func (vp *valuesProvider) isOverlayEnabled(network *v1beta1.Networking) (bool, error) {
func (vp *valuesProvider) isOverlayEnabled(network *gardencorcorev1beta1.Networking) (bool, error) {
if network == nil || network.ProviderConfig == nil {
return true, nil
}
Expand Down

0 comments on commit 6195d5d

Please sign in to comment.