Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Shoots with Kubernetes version < 1.22 #23

Merged
merged 6 commits into from
Jul 20, 2023
Merged
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
4 changes: 2 additions & 2 deletions charts/lakom/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ spec:
- name: kubeconfig
mountPath: /etc/lakom/client
readOnly: true
{{- else if semverCompare ">= 1.20-0" .Capabilities.KubeVersion.GitVersion }}
{{- else }}
- name: kube-api-access-lakom
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
readOnly: true
Expand All @@ -124,7 +124,7 @@ spec:
- name: kubeconfig
secret:
secretName: lakom-target-kubeconfig
{{- else if semverCompare ">= 1.20-0" .Capabilities.KubeVersion.GitVersion }}
{{- else }}
- name: kube-api-access-lakom
projected:
defaultMode: 420
Expand Down
2 changes: 0 additions & 2 deletions charts/lakom/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ metadata:
labels:
app.kubernetes.io/name: {{ .Values.name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if semverCompare ">= 1.20-0" .Capabilities.KubeVersion.GitVersion }}
automountServiceAccountToken: false
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions cmd/lakom/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (o *Options) Run(ctx context.Context) error {
WithLogger(log.WithName("image-tag-resolver")).
WithCacheTTL(o.CacheTTL).
WithCacheRefreshInterval(o.CacheRefreshInterval).
Build(ctx)
Build()
if err != nil {
return err
}
Expand All @@ -216,7 +216,7 @@ func (o *Options) Run(ctx context.Context) error {
WithCosignPublicKeysReader(reader).
WithCacheTTL(o.CacheTTL).
WithCacheRefreshInterval(o.CacheRefreshInterval).
Build(ctx)
Build()
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion example/30-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
dns:
domain: foo.bar.example.com
kubernetes:
version: 1.18.2
version: 1.26.3
resources:
- name: issuer-custom-eab-hmackey
resourceRef:
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/ahmetb/gen-crd-api-reference-docs v0.3.0
github.com/gardener/gardener v1.71.3
github.com/gardener/gardener v1.74.0
github.com/gardener/service-account-issuer-discovery v0.2.0
github.com/go-logr/logr v1.2.4
github.com/google/go-containerregistry v0.14.1-0.20230409045903-ed5c185df419
Expand Down Expand Up @@ -83,7 +83,7 @@ require (
github.com/fluent/fluent-operator/v2 v2.2.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gardener/etcd-druid v0.15.3 // indirect
github.com/gardener/etcd-druid v0.18.1 // indirect
github.com/gardener/hvpa-controller/api v0.5.0 // indirect
github.com/gardener/machine-controller-manager v0.48.1 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
Expand Down Expand Up @@ -208,7 +208,6 @@ require (
istio.io/api v0.0.0-20230217221049-9d422bf48675 // indirect
istio.io/client-go v1.17.1 // indirect
k8s.io/apiextensions-apiserver v0.26.3 // indirect
k8s.io/apiserver v0.26.3 // indirect
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d // indirect
k8s.io/helm v2.16.1+incompatible // indirect
k8s.io/klog v1.0.0 // indirect
Expand Down
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
github.com/gardener/etcd-druid v0.15.3 h1:IMsJTaUaSOXusfgOOF5GX5eJ0o1CI/9XtKzgxwWJ0Eo=
github.com/gardener/etcd-druid v0.15.3/go.mod h1:VTxoQXmaE2RSP+LQS5qWUDoXzmdK6xlKLUdFhaGu6KM=
github.com/gardener/gardener v1.71.3 h1:AdIxFB30lGK7s94iwlXWRKBZ7pD8BYtwP2dme/osPQo=
github.com/gardener/gardener v1.71.3/go.mod h1:l6FaKO0wqF2qaUe4Zh05/CYGMNDAOuoqRGfHUnbjQ74=
github.com/gardener/etcd-druid v0.18.1 h1:dcId4WayxlZiKvDMxLZHmmvWFXjTBFVqQWmqB5/8mdM=
github.com/gardener/etcd-druid v0.18.1/go.mod h1:Bn4doVhryu6GWdXaYlVNy7TZMjUSMr5EjChei06KX0w=
github.com/gardener/gardener v1.74.0 h1:ckiij8W5F8LZSaycRDAZsL9PFt6mWuG8AhJOo54twno=
github.com/gardener/gardener v1.74.0/go.mod h1:uSkzPPoAEvdU1fvciTAsZFxPQ9vQpMbMFRJLMQgdfEQ=
github.com/gardener/hvpa-controller/api v0.5.0 h1:f4F3O7YUrenwh4S3TgPREPiB287JjjUiUL18OqPLyAA=
github.com/gardener/hvpa-controller/api v0.5.0/go.mod h1:QQl3ELkCaki+8RhXl0FZMfvnm0WCGwGJlGmrxJj6lvM=
github.com/gardener/machine-controller-manager v0.48.1 h1:Oxr5e6gRm7P40Ds4nGlga/0nmfF7cH4rOfjthR6Mm38=
Expand Down Expand Up @@ -1284,7 +1284,6 @@ k8s.io/apimachinery v0.19.0/go.mod h1:DnPGDnARWFvYa3pMHgSxtbZb7gpzzAZ1pTfaUNDVlm
k8s.io/apimachinery v0.26.3 h1:dQx6PNETJ7nODU3XPtrwkfuubs6w7sX0M8n61zHIV/k=
k8s.io/apimachinery v0.26.3/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I=
k8s.io/apiserver v0.26.3 h1:blBpv+yOiozkPH2aqClhJmJY+rp53Tgfac4SKPDJnU4=
k8s.io/apiserver v0.26.3/go.mod h1:CJe/VoQNcXdhm67EvaVjYXxR3QyfwpceKPuPaeLibTA=
k8s.io/autoscaler/vertical-pod-autoscaler v0.9.0/go.mod h1:PwWTGRRCxefhAezrDbG/tRYSAW7etHjjMPAr8fXKVAA=
k8s.io/autoscaler/vertical-pod-autoscaler v0.13.0 h1:pH6AsxeBZcyX6KBqcnl7SPIJqbN1d59RrEBuIE6Rq6c=
k8s.io/autoscaler/vertical-pod-autoscaler v0.13.0/go.mod h1:LraL5kR2xX7jb4VMCG6/tUH4I75uRHlnzC0VWQHcyWk=
Expand Down
2 changes: 1 addition & 1 deletion pkg/admission/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,6 @@ type brokenWriter struct {
http.ResponseWriter
}

func (bw *brokenWriter) Write(buf []byte) (int, error) {
func (bw *brokenWriter) Write(_ []byte) (int, error) {
return 0, fmt.Errorf("mock: write: broken pipe")
}
10 changes: 5 additions & 5 deletions pkg/lakom/resolvetag/admission.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (hb HandleBuilder) WithLogger(logger logr.Logger) HandleBuilder {
}

// Build builds a handler from the HandleBuilder.
func (hb HandleBuilder) Build(ctx context.Context) (*handler, error) {
func (hb HandleBuilder) Build() (*handler, error) {
var (
h = handler{logger: hb.logger}
resolver Resolver
Expand Down Expand Up @@ -167,7 +167,7 @@ func (h *handler) handlePod(ctx context.Context, p *corev1.Pod, logger logr.Logg
})

for idx, ic := range p.Spec.InitContainers {
image, err := h.handleContainer(ctx, ic.Name, ic.Image, kcr, logger.WithValues("initContainer", ic.Name))
image, err := h.handleContainer(ctx, ic.Image, kcr, logger.WithValues("initContainer", ic.Name))
if err != nil {
return err
}
Expand All @@ -177,7 +177,7 @@ func (h *handler) handlePod(ctx context.Context, p *corev1.Pod, logger logr.Logg
}

for idx, c := range p.Spec.Containers {
image, err := h.handleContainer(ctx, c.Name, c.Image, kcr, logger.WithValues("container", c.Name))
image, err := h.handleContainer(ctx, c.Image, kcr, logger.WithValues("container", c.Name))
if err != nil {
return err
}
Expand All @@ -187,7 +187,7 @@ func (h *handler) handlePod(ctx context.Context, p *corev1.Pod, logger logr.Logg
}

for idx, ec := range p.Spec.EphemeralContainers {
image, err := h.handleContainer(ctx, ec.Name, ec.Image, kcr, logger.WithValues("ephemeralContainer", ec.Name))
image, err := h.handleContainer(ctx, ec.Image, kcr, logger.WithValues("ephemeralContainer", ec.Name))
if err != nil {
return err
}
Expand All @@ -199,7 +199,7 @@ func (h *handler) handlePod(ctx context.Context, p *corev1.Pod, logger logr.Logg
return nil
}

func (h *handler) handleContainer(ctx context.Context, containerName, image string, kcr utils.KeyChainReader, logger logr.Logger) (string, error) {
func (h *handler) handleContainer(ctx context.Context, image string, kcr utils.KeyChainReader, logger logr.Logger) (string, error) {
logger = logger.WithValues("originalImage", image)

imageRef, err := name.ParseReference(image)
Expand Down
2 changes: 1 addition & 1 deletion pkg/lakom/resolvetag/admission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ var _ = Describe("Admission Handler", func() {
WithLogger(logger.WithName("test-image-tag-resolver")).
WithCacheTTL(time.Minute * 10).
WithCacheRefreshInterval(time.Second * 30).
Build(ctx)
Build()
Expect(err).ToNot(HaveOccurred())

err = h.InjectDecoder(decoder)
Expand Down
2 changes: 1 addition & 1 deletion pkg/lakom/resolvetag/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ type fakeCacheResolver struct {
}

// Resolve implements fake cache resolver that just counts the cache hits and misses
func (r *fakeCacheResolver) Resolve(ctx context.Context, tagRef name.Tag) (string, error) {
func (r *fakeCacheResolver) Resolve(_ context.Context, tagRef name.Tag) (string, error) {
image := tagRef.String()
digest, found := r.cache.GetDigest(image)
if found {
Expand Down
2 changes: 1 addition & 1 deletion pkg/lakom/verifysignature/admission.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (hb HandleBuilder) WithLogger(logger logr.Logger) HandleBuilder {
}

// Build builds a handler from the HandleBuilder.
func (hb HandleBuilder) Build(ctx context.Context) (*handler, error) {
func (hb HandleBuilder) Build() (*handler, error) {
var (
h = handler{logger: hb.logger}
verifier Verifier
Expand Down
2 changes: 1 addition & 1 deletion pkg/lakom/verifysignature/admission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var _ = Describe("Admission Handler", func() {
WithCosignPublicKeysReader(reader).
WithCacheTTL(time.Minute * 10).
WithCacheRefreshInterval(time.Second * 30).
Build(ctx)
Build()

Expect(err).ToNot(HaveOccurred())

Expand Down

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

Loading