diff --git a/Dockerfile b/Dockerfile index 872f1334..84ee6f8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ COPY . . ARG EFFECTIVE_VERSION ARG TARGETARCH -RUN make install EFFECTIVE_VERSION=$EFFECTIVE_VERSION GOARCH=$TARGETARCH +RUN make install EFFECTIVE_VERSION=$EFFECTIVE_VERSION ############# base FROM gcr.io/distroless/static-debian11:nonroot AS base diff --git a/Makefile b/Makefile index 4763fe25..b545d737 100644 --- a/Makefile +++ b/Makefile @@ -2,16 +2,15 @@ # # SPDX-License-Identifier: Apache-2.0 -EXTENSION_PREFIX := gardener-extension -NAME_ADMISSION := shoot-rsyslog-relp-admission NAME := shoot-rsyslog-relp -REGISTRY := eu.gcr.io/gardener-project/gardener -IMAGE_PREFIX := $(REGISTRY)/extensions +NAME_ADMISSION := $(NAME)-admission +IMAGE := eu.gcr.io/gardener-project/gardener/extensions/shoot-rsyslog-relp REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) HACK_DIR := $(REPO_ROOT)/hack VERSION := $(shell cat "$(REPO_ROOT)/VERSION") EFFECTIVE_VERSION := $(VERSION)-$(shell git rev-parse HEAD) -GOARCH ?= $(shell go env GOARCH) +IMAGE_TAG := $(EFFECTIVE_VERSION) +LD_FLAGS := "-w $(shell EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/get-build-ld-flags.sh k8s.io/component-base $(REPO_ROOT)/VERSION $(NAME))" PARALLEL_E2E_TESTS := 2 ifndef ARTIFACTS @@ -35,8 +34,8 @@ include $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/tools.mk .PHONY: install install: - @LD_FLAGS="-w $(shell EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/get-build-ld-flags.sh k8s.io/component-base $(REPO_ROOT)/VERSION $(EXTENSION_PREFIX)-$(NAME))" \ - $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/install.sh ./... + @LD_FLAGS=$(LD_FLAGS) \ + $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/install.sh ./cmd/... .PHONY: docker-login docker-login: @@ -44,8 +43,8 @@ docker-login: .PHONY: docker-images docker-images: - @docker build --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --build-arg TARGETARCH=$(GOARCH) -t $(IMAGE_PREFIX)/$(NAME):$(EFFECTIVE_VERSION) -t $(IMAGE_PREFIX)/$(NAME):latest -f Dockerfile -m 6g --target $(EXTENSION_PREFIX)-$(NAME) . - @docker build --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) --build-arg TARGETARCH=$(GOARCH) -t $(IMAGE_PREFIX)/$(NAME_ADMISSION):$(EFFECTIVE_VERSION) -t $(IMAGE_PREFIX)/$(NAME_ADMISSION):latest -f Dockerfile -m 6g --target $(EXTENSION_PREFIX)-$(NAME_ADMISSION) . + @docker build --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) -t $(IMAGE):$(IMAGE_TAG) -f Dockerfile -m 6g --target $(NAME) . + @docker build --build-arg EFFECTIVE_VERSION=$(EFFECTIVE_VERSION) -t $(IMAGE)-admission:$(IMAGE_TAG) -f Dockerfile -m 6g --target $(NAME_ADMISSION) . ##################################################################### # Rules for verification, formatting, linting, testing and cleaning # @@ -123,7 +122,7 @@ ci-e2e-kind: $(KIND) $(YQ) extension-up extension-down: export SKAFFOLD_LABEL = skaffold.dev/run-id=extension-local extension-up: $(SKAFFOLD) $(HELM) $(KUBECTL) - $(SKAFFOLD) run + @LD_FLAGS=$(LD_FLAGS) $(SKAFFOLD) run extension-dev: $(SKAFFOLD) $(HELM) $(KUBECTL) $(SKAFFOLD) dev --cleanup=false --trigger=manual diff --git a/example/local/charts/rsyslog-relp-echo-server/templates/secret.yaml b/example/local/charts/rsyslog-relp-echo-server/templates/secret.yaml index 3973502d..39b4b858 100644 --- a/example/local/charts/rsyslog-relp-echo-server/templates/secret.yaml +++ b/example/local/charts/rsyslog-relp-echo-server/templates/secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: name: rsyslog-relp-tls - namepace: {{ .Release.Namespace }} + namespace: {{ .Release.Namespace }} labels: app.kubernetes.io/name: rsyslog-relp-echo-server app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/skaffold.yaml b/skaffold.yaml index b75d19e4..b3f66887 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -45,6 +45,8 @@ build: - pkg/utils - vendor - VERSION + ldflags: + - '{{.LD_FLAGS}}' main: ./cmd/gardener-extension-shoot-rsyslog-relp resourceSelector: allow: @@ -78,6 +80,8 @@ build: - pkg/utils - vendor - VERSION + ldflags: + - '{{.LD_FLAGS}}' main: ./cmd/gardener-extension-shoot-rsyslog-relp-admission deploy: helm: