Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/apis/metal/types_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ type ControlPlaneFeatures struct {
// DisableCsiLvm disables the deployment of the csi-lvm driver for the control plane.
// In order to deploy the new csi-driver-lvm, the feature gate must be enabled so the old driver is removed.
// +optional
DisableCsiLvm *bool `json:"disableCsiLvm,omitempty"`
DisableCsiLvm *bool

// DisableDuros disables the deployment of the duros controller for the control plane.
// In order to deploy the duros-controller, use the "gardener-extension-duros".
// +optional
DisableDuros *bool
}

// CloudControllerManagerConfig contains configuration settings for the cloud-controller-manager.
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/metal/v1alpha1/types_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ type ControlPlaneFeatures struct {
// In order to deploy the new csi-driver-lvm, the feature gate must be enabled so the old driver is removed.
// +optional
DisableCsiLvm *bool `json:"disableCsiLvm,omitempty"`

// DisableDuros disables the deployment of the duros controller for the control plane.
// In order to deploy the duros-controller, use the "gardener-extension-duros".
// +optional
DisableDuros *bool `json:"disableDuros,omitempty"`
}

// CloudControllerManagerConfig contains configuration settings for the cloud-controller-manager.
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/metal/v1alpha1/zz_generated.conversion.go

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

5 changes: 5 additions & 0 deletions pkg/apis/metal/v1alpha1/zz_generated.deepcopy.go

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

5 changes: 5 additions & 0 deletions pkg/apis/metal/zz_generated.deepcopy.go

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

49 changes: 18 additions & 31 deletions pkg/controller/controlplane/valuesprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ import (
"github.com/gardener/gardener/pkg/utils/secrets"
secretsmanager "github.com/gardener/gardener/pkg/utils/secrets/manager"

"github.com/go-logr/logr"

apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
Expand Down Expand Up @@ -288,7 +286,6 @@ type valuesProvider struct {
genericactuator.NoopValuesProvider
client client.Client
decoder runtime.Decoder
logger logr.Logger
controllerConfig config.ControllerConfiguration
}

Expand All @@ -297,7 +294,7 @@ func (vp *valuesProvider) GetConfigChartValues(
ctx context.Context,
cp *extensionsv1alpha1.ControlPlane,
cluster *extensionscontroller.Cluster,
) (map[string]interface{}, error) {
) (map[string]any, error) {
return nil, nil
}

Expand Down Expand Up @@ -347,7 +344,6 @@ func (vp *valuesProvider) GetControlPlaneChartValues(

nws := networkMap{}
for _, n := range resp.Payload {
n := n
nws[*n.ID] = n
}

Expand Down Expand Up @@ -375,7 +371,7 @@ func (vp *valuesProvider) GetControlPlaneChartValues(
return nil, err
}

storageValues, err := getStorageControlPlaneChartValues(ctx, vp.client, vp.logger, vp.controllerConfig.Storage, cluster, infrastructureConfig, cpConfig, nws)
storageValues, err := getStorageControlPlaneChartValues(ctx, vp.client, vp.controllerConfig.Storage, cluster, infrastructureConfig, cpConfig, nws)
if err != nil {
return nil, err
}
Expand All @@ -387,7 +383,7 @@ func (vp *valuesProvider) GetControlPlaneChartValues(

values := map[string]any{
"imagePullPolicy": helper.ImagePullPolicyFromString(vp.controllerConfig.ImagePullPolicy),
"podAnnotations": map[string]interface{}{
"podAnnotations": map[string]any{
"checksum/secret-" + metal.FirewallControllerManagerDeploymentName: checksums[metal.FirewallControllerManagerDeploymentName],
"checksum/secret-cloudprovider": checksums[v1beta1constants.SecretNameCloudProvider],
},
Expand Down Expand Up @@ -472,7 +468,7 @@ func (vp *valuesProvider) GetControlPlaneShootChartValues(ctx context.Context, c

values, err := vp.getControlPlaneShootChartValues(ctx, cpConfig, cluster, partition, nws, infrastructure, infrastructureConfig, secretsReader, checksums)
if err != nil {
vp.logger.Error(err, "Error getting shoot control plane chart values")
logger.Error(err, "Error getting shoot control plane chart values")
return nil, err
}

Expand All @@ -488,10 +484,11 @@ func (vp *valuesProvider) getControlPlaneShootChartValues(ctx context.Context, c
return nil, err
}

durosValues := map[string]interface{}{
"enabled": vp.controllerConfig.Storage.Duros.Enabled,
}
durosEnabled := vp.controllerConfig.Storage.Duros.Enabled && (cpConfig.FeatureGates.DisableDuros == nil || !*cpConfig.FeatureGates.DisableDuros)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this only works for initial deployments due to the behavior of the chart applier, which was addressed in this PR: gardener/gardener#12251. When toggling the flag, the resources in the shoot namespace continue to exist.

Before writing complex logic to cleanup resources in the seed, maybe it's sufficient to let the seed components just continue to run. When enabling the duros-extension for the shoot, the extension can inherit the resources that are already running. However, we must be sure that all resources have equal names in this case.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then also we need to be aware of things like these:

 during apply of object "apps/v1/Deployment/shoot--pb4b7w--gerrit2/duros-controller": Deployment.apps "duros-controller" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app":"duros-controller", "app.kubernetes.io/instance":"gardener-extension-duros"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to proceed with this for now. Probably it's better not to add this to the upcoming metal-stack release and postpone again.

/cc @ostempel Is this ok for you?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to proceed with this for now. Probably it's better not to add this to the upcoming metal-stack release and postpone again.

/cc @ostempel Is this ok for you?

Yeah totally fine. We can revisite this when the time is right.


durosValues := map[string]any{
"enabled": durosEnabled,
}
ciliumValues := map[string]any{
"enabled": false,
}
Expand Down Expand Up @@ -628,7 +625,7 @@ func (vp *valuesProvider) getControlPlaneShootChartValues(ctx context.Context, c
}
}

if vp.controllerConfig.Storage.Duros.Enabled {
if durosEnabled {
partitionConfig, ok := vp.controllerConfig.Storage.Duros.PartitionConfig[infrastructureConfig.PartitionID]

found, err := hasDurosStorageNetwork(infrastructureConfig, nws)
Expand All @@ -646,22 +643,6 @@ func (vp *valuesProvider) getControlPlaneShootChartValues(ctx context.Context, c
return values, nil
}

// getSecret returns the secret with the given namespace/secretName
func (vp *valuesProvider) getSecret(ctx context.Context, namespace string, secretName string) (*corev1.Secret, error) {
key := client.ObjectKey{Namespace: namespace, Name: secretName}
secret := &corev1.Secret{}
err := vp.client.Get(ctx, key, secret)
if err != nil {
if apierrors.IsNotFound(err) {
vp.logger.Error(err, "error getting secret - not found")
return nil, err
}
vp.logger.Error(err, "error getting secret")
return nil, err
}
return secret, nil
}

// GetStorageClassesChartValues returns the values for the storage classes chart applied by the generic actuator.
func (vp *valuesProvider) GetStorageClassesChartValues(_ context.Context, controlPlane *extensionsv1alpha1.ControlPlane, cluster *extensionscontroller.Cluster) (map[string]interface{}, error) {
cp, err := helper.ControlPlaneConfigFromControlPlane(controlPlane)
Expand Down Expand Up @@ -764,13 +745,19 @@ func getCCMChartValues(
return values, nil
}

func getStorageControlPlaneChartValues(ctx context.Context, client client.Client, logger logr.Logger, storageConfig config.StorageConfiguration, cluster *extensionscontroller.Cluster, infrastructure *apismetal.InfrastructureConfig, cp *apismetal.ControlPlaneConfig, nws networkMap) (map[string]interface{}, error) {
disabledValues := map[string]interface{}{
"duros": map[string]interface{}{
func getStorageControlPlaneChartValues(ctx context.Context, client client.Client, storageConfig config.StorageConfiguration, cluster *extensionscontroller.Cluster, infrastructure *apismetal.InfrastructureConfig, cp *apismetal.ControlPlaneConfig, nws networkMap) (map[string]interface{}, error) {
disabledValues := map[string]any{
"duros": map[string]any{
"enabled": false,
},
}

durosEnabled := storageConfig.Duros.Enabled && (cp.FeatureGates.DisableDuros == nil || !*cp.FeatureGates.DisableDuros)

if !durosEnabled {
return disabledValues, nil
}

partitionConfig, ok := storageConfig.Duros.PartitionConfig[infrastructure.PartitionID]
if !ok {
logger.Info("skipping duros storage deployment because no storage configuration found for partition", "partition", infrastructure.PartitionID)
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/healthcheck/duros.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type DurosHealthChecker struct {
durosResourceName string
}

// CheckDuros is a healthCheck function to check Duross
// CheckDuros is a healthCheck function to check Duros
func CheckDuros(durosResourceName string) healthcheck.HealthCheck {
return &DurosHealthChecker{
durosResourceName: durosResourceName,
Expand Down