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

chore: refactor admission controller #77

Closed
wants to merge 1 commit into from
Closed
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
60 changes: 0 additions & 60 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ builds:
- arm64
env:
- CGO_ENABLED=0
- id: "kimup-admission-controller"
binary: kimup-admission-controller
main: ./cmd/admission-controller
goos:
- linux
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0

dockers:
# * KIMUP
Expand Down Expand Up @@ -128,45 +117,6 @@ dockers:
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}

# * KIMUP-ADMISSION-CONTROLLER
- goarch: amd64
image_templates:
- "ghcr.io/orange-cloudavenue/{{.ProjectName}}-admission-controller:v{{ .Version }}-amd64"
dockerfile: Dockerfile
use: buildx
ids:
- kimup-admission-controller
build_flag_templates:
- --platform=linux/amd64
- "--build-arg=BINNAME=kimup-admission-controller"
- --pull
- --label=org.opencontainers.image.title="kimup-admission-controller"
- --label=org.opencontainers.image.description="kube-image-updater-admission-controller"
- --label=org.opencontainers.image.url=https://github.com/orange-cloudavenue/kube-image-updater-admission-controller
- --label=org.opencontainers.image.source=https://github.com/orange-cloudavenue/kube-image-updater-admission-controller
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}

- goarch: arm64
image_templates:
- "ghcr.io/orange-cloudavenue/{{ .ProjectName }}-admission-controller:v{{ .Version }}-arm64v8"
dockerfile: Dockerfile
use: buildx
ids:
- kimup-admission-controller
build_flag_templates:
- --platform=linux/arm64/v8
- "--build-arg=BINNAME=kimup-admission-controller"
- --pull
- --label=org.opencontainers.image.title="kimup-admission-controller"
- --label=org.opencontainers.image.description="kube-image-updater-admission-controller"
- --label=org.opencontainers.image.url=https://github.com/orange-cloudavenue/kube-image-updater-admission-controller
- --label=org.opencontainers.image.source=https://github.com/orange-cloudavenue/kube-image-updater-admission-controller
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}

docker_manifests:
# * KIMUP
- name_template: "ghcr.io/orange-cloudavenue/{{ .ProjectName }}-controller:v{{ .Version }}"
Expand All @@ -187,13 +137,3 @@ docker_manifests:
image_templates:
- "ghcr.io/orange-cloudavenue/{{ .ProjectName }}-operator:v{{ .Version }}-amd64"
- "ghcr.io/orange-cloudavenue/{{ .ProjectName }}-operator:v{{ .Version }}-arm64v8"

# * KIMUP-ADMISSION-CONTROLLER
- name_template: "ghcr.io/orange-cloudavenue/{{ .ProjectName }}-admission-controller:v{{ .Version }}"
image_templates:
- "ghcr.io/orange-cloudavenue/{{ .ProjectName }}-admission-controller:v{{ .Version }}-amd64"
- "ghcr.io/orange-cloudavenue/{{ .ProjectName }}-admission-controller:v{{ .Version }}-arm64v8"
- name_template: "ghcr.io/orange-cloudavenue/{{ .ProjectName }}-admission-controller:latest"
image_templates:
- "ghcr.io/orange-cloudavenue/{{ .ProjectName }}-admission-controller:v{{ .Version }}-amd64"
- "ghcr.io/orange-cloudavenue/{{ .ProjectName }}-admission-controller:v{{ .Version }}-arm64v8"
28 changes: 19 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,38 @@ lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
build: manifests generate fmt vet ## Build manager binary.
go build -o bin/operator cmd/operator/main.go
go build -o bin/kimup cmd/kimup/*
go build -o bin/admission-controller cmd/admission-controller/*

.PHONY: build
build-admission-controller: manifests generate fmt vet
go build -o bin/admission-controller cmd/admission-controller/*

.PHONY: build-kimup
build-kimup: manifests generate fmt vet
go build -o bin/kimup cmd/kimup/*

.PHONY: generate-mutating-config
generate-mutating-config: ## Generate the mutating webhook configuration.
go run ./tools/admission-controller/main.go

.PHONY: run-operator
run-operator: manifests generate fmt vet ## Run a controller from your host.
go run ./cmd/operator/main.go

.PHONY: run-operator-in-cluster
run-operator-in-cluster: manifests generate fmt vet ## Run a controller from your host.
kubectl -n kimup-operator delete po kimup-operator || true
kubectl create ns kimup-operator || true
kubectl apply -k manifests/crd
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.1/cert-manager.yaml --wait=true
kubectl -n kimup-operator apply --filename="manifests/operator/role.yaml,manifests/operator/role_binding.yaml,manifests/operator/service_account.yaml,manifests/operator/webhook-certificate.yaml,manifests/operator/service.yaml" --wait=true
kubectl wait --for=condition=Available deployment/cert-manager -n cert-manager --timeout=300s
kubectl wait --for=condition=Ready certificate/kimup-webhook-serving-cert -n kimup-operator
kurun apply -f tools/env-dev/pod-operator.yaml
kubectl wait --for=condition=Ready pod/kimup-operator -n kimup-operator
kubectl apply -f tools/env-dev/whoami-deployment.yaml || true
kubectl -n kimup-operator logs kimup-operator -f
kubectl -n kimup-operator delete po kimup-operator

.PHONY: run-kimup
run-kimup: manifests generate fmt vet ## Run the image updater from your host.
go run ./cmd/kimup

.PHONY: run-admission-controller
run-admission-controller: manifests generate fmt vet ## Run the admission-controller from your host.
go run ./cmd/admission-controller/

.PHONY: run-mkdocs
run-mkdocs: ## Run mkdocs to serve the documentation locally.
mkdocs serve
Expand Down
222 changes: 0 additions & 222 deletions cmd/admission-controller/certificate.go

This file was deleted.

Loading