Skip to content

Commit

Permalink
Remove old kubernetes defaultings (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 authored Sep 3, 2024
1 parent 8799930 commit 74739b8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "tag=latest" >> $GITHUB_ENV || true
- name: Build and push image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
push: true
Expand Down
6 changes: 1 addition & 5 deletions pkg/admission/mutator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import (

type config struct{}

func (c *config) allowedPrivilegedContainers() bool {
return c.bool("DEFAULTER_ALLOWEDPRIVILEGEDCONTAINERS", true)
}

func (c *config) maxPods() int32 {
return c.int32("DEFAULTER_MAXPODS", 250)
}
Expand Down Expand Up @@ -126,5 +122,5 @@ func (c *config) int32(key string, fallback int32) int32 {
return fallback
}

return int32(parsed)
return int32(parsed) // nolint:gosec
}
11 changes: 1 addition & 10 deletions pkg/admission/mutator/defaulter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal"
"github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal/helper"
metalv1alpha1 "github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal/v1alpha1"
"github.com/metal-stack/metal-lib/pkg/k8s"
"github.com/metal-stack/metal-lib/pkg/pointer"

"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -27,14 +26,6 @@ type defaulter struct {
}

func (d *defaulter) defaultShoot(shoot *gardenv1beta1.Shoot) error {
lessThan125, err := k8s.LessThan(shoot.Spec.Kubernetes.Version, k8s.KubernetesV125)
if err != nil {
return err
}
if shoot.Spec.Kubernetes.AllowPrivilegedContainers == nil && lessThan125 {
shoot.Spec.Kubernetes.AllowPrivilegedContainers = pointer.Pointer(d.c.allowedPrivilegedContainers())
}

if shoot.Spec.Kubernetes.KubeControllerManager == nil {
shoot.Spec.Kubernetes.KubeControllerManager = &gardenv1beta1.KubeControllerManagerConfig{}
}
Expand All @@ -51,7 +42,7 @@ func (d *defaulter) defaultShoot(shoot *gardenv1beta1.Shoot) error {
shoot.Spec.Kubernetes.Kubelet.MaxPods = pointer.Pointer(d.c.maxPods())
}

err = d.defaultInfrastructureConfig(shoot)
err := d.defaultInfrastructureConfig(shoot)
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/admission/mutator/defaulter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ func Test_defaulter_defaultShoot(t *testing.T) {
want: &gardenv1beta1.Shoot{
Spec: gardenv1beta1.ShootSpec{
Kubernetes: gardenv1beta1.Kubernetes{
Version: "1.24.0",
AllowPrivilegedContainers: pointer.Pointer(true),
Version: "1.24.0",
KubeControllerManager: &gardenv1beta1.KubeControllerManagerConfig{
NodeCIDRMaskSize: pointer.Pointer(int32(23)),
},
Expand Down

0 comments on commit 74739b8

Please sign in to comment.