1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

feat: add cleanup controller makefile targets (#5327)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2022-11-14 12:00:40 +01:00 committed by GitHub
parent ce21ac50b3
commit 217d77d670
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 4 deletions

1
.gitignore vendored
View file

@ -6,6 +6,7 @@ coverage.txt
.idea
cmd/initContainer/kyvernopre
cmd/kyverno/kyverno
cmd/cleanup-controller/cleanup-controller
/release
.DS_Store
.tools

View file

@ -25,9 +25,11 @@ BUILD_WITH ?= ko
KYVERNOPRE_IMAGE := kyvernopre
KYVERNO_IMAGE := kyverno
CLI_IMAGE := kyverno-cli
CLEANUP_IMAGE := cleanup-controller
REPO_KYVERNOPRE := $(REGISTRY)/$(REPO)/$(KYVERNOPRE_IMAGE)
REPO_KYVERNO := $(REGISTRY)/$(REPO)/$(KYVERNO_IMAGE)
REPO_CLI := $(REGISTRY)/$(REPO)/$(CLI_IMAGE)
REPO_CLEANUP := $(REGISTRY)/$(REPO)/$(KYVERNO_CLEANUP)
#########
# TOOLS #
@ -138,9 +140,11 @@ CMD_DIR := ./cmd
KYVERNO_DIR := $(CMD_DIR)/kyverno
KYVERNOPRE_DIR := $(CMD_DIR)/initContainer
CLI_DIR := $(CMD_DIR)/cli/kubectl-kyverno
CLEANUP_DIR := $(CMD_DIR)/cleanup-controller
KYVERNO_BIN := $(KYVERNO_DIR)/kyverno
KYVERNOPRE_BIN := $(KYVERNOPRE_DIR)/kyvernopre
CLI_BIN := $(CLI_DIR)/kubectl-kyverno
CLEANUP_BIN := $(CLEANUP_DIR)/cleanup-controller
PACKAGE ?= github.com/kyverno/kyverno
CGO_ENABLED ?= 0
LD_FLAGS = "-s -w -X $(PACKAGE)/pkg/version.BuildVersion=$(GIT_VERSION) -X $(PACKAGE)/pkg/version.BuildHash=$(GIT_HASH) -X $(PACKAGE)/pkg/version.BuildTime=$(TIMESTAMP)"
@ -175,6 +179,10 @@ $(CLI_BIN): fmt vet
@echo Build cli binary... >&2
@CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) go build -o $(CLI_BIN) -ldflags=$(LD_FLAGS) $(CLI_DIR)
$(CLEANUP_BIN): fmt vet
@echo Build cleanup controller binary... >&2
@CGO_ENABLED=$(CGO_ENABLED) GOOS=$(GOOS) go build -o $(CLEANUP_BIN) -ldflags=$(LD_FLAGS) $(CLEANUP_DIR)
.PHONY: build-kyvernopre
build-kyvernopre: $(KYVERNOPRE_BIN) ## Build kyvernopre binary
@ -184,7 +192,10 @@ build-kyverno: $(KYVERNO_BIN) ## Build kyverno binary
.PHONY: build-cli
build-cli: $(CLI_BIN) ## Build cli binary
build-all: build-kyvernopre build-kyverno build-cli ## Build all binaries
.PHONY: build-cleanup-controller
build-cleanup-controller: $(CLEANUP_BIN) ## Build cleanup controller binary
build-all: build-kyvernopre build-kyverno build-cli build-cleanup-controller ## Build all binaries
##############
# BUILD (KO) #
@ -210,8 +221,13 @@ ko-build-cli: $(KO) ## Build cli local image (with ko)
@echo Build cli local image with ko... >&2
@LD_FLAGS=$(LD_FLAGS_DEV) KOCACHE=$(KOCACHE) KO_DOCKER_REPO=ko.local $(KO) build $(CLI_DIR) --preserve-import-paths --tags=$(KO_TAGS_DEV) --platform=$(LOCAL_PLATFORM)
.PHONY: ko-build-cleanup-controller
ko-build-cleanup-controller: $(KO) ## Build cleanup controller local image (with ko)
@echo Build cleanup controller local image with ko... >&2
@LD_FLAGS=$(LD_FLAGS_DEV) KOCACHE=$(KOCACHE) KO_DOCKER_REPO=ko.local $(KO) build $(CLEANUP_DIR) --preserve-import-paths --tags=$(KO_TAGS_DEV) --platform=$(LOCAL_PLATFORM)
.PHONY: ko-build-all
ko-build-all: ko-build-kyvernopre ko-build-kyverno ko-build-cli ## Build all local images (with ko)
ko-build-all: ko-build-kyvernopre ko-build-kyverno ko-build-cli ko-build-cleanup-controller ## Build all local images (with ko)
################
# PUBLISH (KO) #

View file

@ -0,0 +1,4 @@
package main
func main() {
}

View file

@ -5,7 +5,7 @@ import (
"github.com/go-logr/logr"
kyvernov1alpha1 "github.com/kyverno/kyverno/api/kyverno/v1alpha1"
"github.com/kyverno/kyverno/cmd/cleanup/logger"
"github.com/kyverno/kyverno/cmd/cleanup-controller/logger"
"github.com/kyverno/kyverno/pkg/clients/dclient"
"github.com/kyverno/kyverno/pkg/engine/variables"
"github.com/kyverno/kyverno/pkg/logging"

View file

@ -1 +0,0 @@
package main