Skip to content

Commit 6838e2f

Browse files
committed
add MTUCustomizer feature gate and wire it into config and webhooks
1 parent b3e73ff commit 6838e2f

16 files changed

Lines changed: 96 additions & 3 deletions

File tree

charts/gardener-extension-provider-aws/templates/configmap-custom-mtu.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{ if and (eq (include "seed.provider" .) "aws") (index .Values.config.featureGates "MTUCustomizer") }}
12
apiVersion: v1
23
kind: ConfigMap
34
metadata:
@@ -21,3 +22,4 @@ data:
2122
echo changing mtu of non-virtual interface: ${interface}
2223
ip link set dev ${interface} mtu 1460
2324
done
25+
{{ end }}

charts/gardener-extension-provider-aws/templates/configmap.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,9 @@ data:
2323
{{- if .Values.config.etcd.backup }}
2424
backup: {{- toYaml .Values.config.etcd.backup | nindent 8 }}
2525
{{- end }}
26+
{{- if .Values.config.featureGates }}
27+
featureGates:
28+
{{- range $feature, $enabled := .Values.config.featureGates }}
29+
{{ $feature }}: {{ $enabled }}
30+
{{- end }}
31+
{{- end }}

charts/gardener-extension-provider-aws/templates/daemonset-custom-mtu.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{ if eq (include "seed.provider" .) "aws" }}
1+
{{ if and (eq (include "seed.provider" .) "aws") (index .Values.config.featureGates "MTUCustomizer") }}
22
kind: DaemonSet
33
apiVersion: apps/v1
44
metadata:

charts/gardener-extension-provider-aws/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ config:
8888
encrypted: true
8989
# backup:
9090
# schedule: "0 */1 * * *"
91+
featureGates:
92+
MTUCustomizer: true
9193

9294
gardener:
9395
version: ""

cmd/gardener-extension-provider-aws/app/app.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import (
4747
"github.com/gardener/gardener-extension-provider-aws/pkg/controller/healthcheck"
4848
awsinfrastructure "github.com/gardener/gardener-extension-provider-aws/pkg/controller/infrastructure"
4949
awsworker "github.com/gardener/gardener-extension-provider-aws/pkg/controller/worker"
50+
"github.com/gardener/gardener-extension-provider-aws/pkg/features"
5051
awsseedprovider "github.com/gardener/gardener-extension-provider-aws/pkg/webhook/seedprovider"
5152
)
5253

@@ -165,6 +166,10 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
165166
return fmt.Errorf("error completing options: %w", err)
166167
}
167168

169+
if err := features.FeatureGate.SetFromMap(configFileOpts.Completed().Config.FeatureGates); err != nil {
170+
return fmt.Errorf("error setting feature gates: %w", err)
171+
}
172+
168173
if err := heartbeatCtrlOpts.Validate(); err != nil {
169174
return err
170175
}

cmd/gardener-extension-provider-aws/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import (
1212
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
1313

1414
"github.com/gardener/gardener-extension-provider-aws/cmd/gardener-extension-provider-aws/app"
15+
"github.com/gardener/gardener-extension-provider-aws/pkg/features"
1516
)
1617

1718
func main() {
19+
features.RegisterFeatureGates()
1820
logf.SetLogger(logger.MustNewZapLogger(logger.InfoLevel, logger.FormatJSON))
1921
cmd := app.NewControllerManagerCommand(signals.SetupSignalHandler())
2022

example/controller-registration.yaml

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

hack/api-reference/config.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ github.com/gardener/gardener/extensions/pkg/apis/config/v1alpha1.HealthCheckConf
8484
<p>HealthCheckConfig is the config for the health check controller</p>
8585
</td>
8686
</tr>
87+
<tr>
88+
<td>
89+
<code>featureGates</code></br>
90+
<em>
91+
map[string]bool
92+
</em>
93+
</td>
94+
<td>
95+
<em>(Optional)</em>
96+
<p>FeatureGates contains information about enabled feature gates.</p>
97+
</td>
98+
</tr>
8799
</tbody>
88100
</table>
89101
<h3 id="aws.provider.extensions.config.gardener.cloud/v1alpha1.ETCD">ETCD

pkg/apis/config/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ type ControllerConfiguration struct {
2424
ETCD ETCD
2525
// HealthCheckConfig is the config for the health check controller
2626
HealthCheckConfig *apisconfigv1alpha1.HealthCheckConfig
27+
// FeatureGates contains information about enabled feature gates.
28+
// +optional
29+
FeatureGates map[string]bool
2730
}
2831

2932
// ETCD is an etcd configuration.

pkg/apis/config/v1alpha1/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ type ControllerConfiguration struct {
2727
// HealthCheckConfig is the config for the health check controller
2828
// +optional
2929
HealthCheckConfig *healthcheckconfigv1alpha1.HealthCheckConfig `json:"healthCheckConfig,omitempty"`
30+
// FeatureGates contains information about enabled feature gates.
31+
// +optional
32+
FeatureGates map[string]bool `json:"featureGates,omitempty"`
3033
}
3134

3235
// ETCD is an etcd configuration.

0 commit comments

Comments
 (0)