Skip to content

Commit 41dc738

Browse files
refactor: poddefaults-webhooks manifests similar to notebooks v2 (#198)
* refactor(poddefaults-webhooks): restructure kustomize manifests - Create kustomize/ directory structure with base, components, overlays - Create common component with high-level labels (managed-by, name, part-of) - Move app-specific labels (app, component) to base - Replace deprecated bases/commonLabels/patchesStrategicMerge with modern patterns - Keep existing replacements and nameReference/namespace configurations Signed-off-by: alokdangre <alokdangre@gmail.com> * refactor(poddefaults-webhooks): split cert-manager overlay into reusable component Move certificate, deployment patch, webhook patch, and params config from the cert-manager overlay into components/cert-manager. Keep cert-manager replacements in the overlay and compose the new component from overlays/cert-manager/kustomization.yaml. Signed-off-by: alokdangre <alokdangre@gmail.com> * ci(poddefaults): fix workflow manifest paths after kustomize move Signed-off-by: alokdangre <alokdangre@gmail.com> * refactor(poddefaults-webhooks): remove prefix placeholders and split istio patching Remove namePrefix-based naming and placeholder tokens by using explicit resource names and updated references. Move sidecar injection disablement into a dedicated istio component, reorder overlay components with common last, and clean up cert-manager/base replacements and generator options. Signed-off-by: alokdangre <alokdangre@gmail.com> * fix(poddefaults-webhooks): wire deployment secretName from certificate Add a replacement in cert-manager overlay so Deployment webhook volume secretName is sourced from Certificate.spec.secretName. Signed-off-by: alokdangre <alokdangre@gmail.com> * mathew: 1 Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> * mathew: 2 Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> * mathew: 3 Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> * mathew: 4 Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> --------- Signed-off-by: alokdangre <alokdangre@gmail.com> Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> Co-authored-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
1 parent 18454fd commit 41dc738

32 files changed

Lines changed: 4956 additions & 2340 deletions

.github/workflows/poddefaults_intergration_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
"components/poddefaults-webhooks" \
5353
"${IMG}" \
5454
"${TAG}" \
55-
"manifests" \
55+
"manifests/kustomize" \
5656
"overlays/cert-manager"
5757
5858
- name: Wait for Admission Webhook to be Ready

.github/workflows/poddefaults_unit_test.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,26 @@ jobs:
1818
- name: Install Go
1919
uses: actions/setup-go@v5
2020
with:
21-
go-version: "1.20"
21+
go-version-file: components/poddefaults-webhooks/go.mod
2222
check-latest: true
23+
cache-dependency-path: components/poddefaults-webhooks/go.sum
24+
25+
- name: Build
26+
working-directory: components/poddefaults-webhooks
27+
run: make build
2328

2429
- name: Run unit tests
30+
working-directory: components/poddefaults-webhooks
31+
run: make test
32+
33+
- name: Check if there are uncommitted file changes
34+
working-directory: components/poddefaults-webhooks
2535
run: |
26-
cd components/poddefaults-webhooks
27-
make test
36+
clean=$(git status --porcelain)
37+
if [[ -z "$clean" ]]; then
38+
echo "Empty git status --porcelain: $clean"
39+
else
40+
echo "Uncommitted file changes detected: $clean"
41+
git diff
42+
exit 1
43+
fi
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
bin
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
bin/*
8+
Dockerfile.cross
9+
10+
# Test binary, built with `go test -c`
11+
*.test
12+
13+
# Output of the go coverage tool, specifically when used with LiteIDE
14+
*.out
15+
16+
# Go workspace file
17+
go.work
18+
19+
# Kubernetes Generated files - skip generated files, except for vendored files
20+
!vendor/**/zz_generated.*

components/poddefaults-webhooks/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
ARG GOLANG_VERSION=1.21
2+
ARG GOLANG_VERSION=1.22
33
FROM golang:${GOLANG_VERSION} as builder
44

55
# Copy in the go src

components/poddefaults-webhooks/Makefile

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,50 @@
22
IMG ?= ghcr.io/kubeflow/dashboard/poddefaults-webhook
33
TAG ?= $(shell git describe --tags --always --dirty)
44
ARCH ?= linux/amd64
5+
56
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
67
ifeq (,$(shell go env GOBIN))
78
GOBIN=$(shell go env GOPATH)/bin
89
else
910
GOBIN=$(shell go env GOBIN)
1011
endif
1112

12-
generate: controller-gen
13+
##@ Development
14+
15+
.PHONY: manifests
16+
manifests: controller-gen ## Generate CustomResourceDefinition objects.
17+
$(CONTROLLER_GEN) crd paths="./..." \
18+
output:crd:artifacts:config=manifests/kustomize/base
19+
20+
mv manifests/kustomize/base/kubeflow.org_poddefaults.yaml manifests/kustomize/base/crd.yaml
21+
22+
.PHONY: generate
23+
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
1324
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
1425

15-
manifests: controller-gen
16-
$(CONTROLLER_GEN) crd:crdVersions=v1,maxDescLen=0 output:crd:artifacts:config=manifests/base paths="./..."
17-
mv manifests/base/kubeflow.org_poddefaults.yaml manifests/base/crd.yaml
26+
.PHONY: fmt
27+
fmt: ## Run go fmt against code.
28+
go fmt ./...
29+
30+
.PHONY: vet
31+
vet: ## Run go vet against code.
32+
go vet ./...
1833

19-
test:
34+
.PHONY: test
35+
test: manifests generate fmt vet ## Run tests.
2036
go test -coverprofile cover.out
2137

22-
build:
23-
go build -gcflags 'all=-N -l' -o bin/webhook .
38+
##@ Build
2439

40+
.PHONY: build
41+
build: manifests generate fmt vet ## Build the manager binary.
42+
go build -o bin/webhook .
43+
44+
.PHONY: docker-build
2545
docker-build:
2646
docker build -t ${IMG}:${TAG} -f Dockerfile .
2747

48+
.PHONY: docker-push
2849
docker-push:
2950
docker push ${IMG}:${TAG}
3051

@@ -36,19 +57,36 @@ docker-build-multi-arch: ## Build multi-arch docker images with docker buildx
3657
docker-build-push-multi-arch: ## Build multi-arch docker images with docker buildx and push to docker registry
3758
docker buildx build --platform ${ARCH} --tag ${IMG}:${TAG} --push .
3859

39-
image: docker-build docker-push
60+
##@ Dependencies
61+
62+
## Location to install dependencies to
63+
LOCALBIN ?= $(shell pwd)/bin
64+
$(LOCALBIN):
65+
mkdir -p $(LOCALBIN)
66+
67+
## Tool Binaries
68+
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
69+
70+
## Tool Versions
71+
CONTROLLER_TOOLS_VERSION ?= v0.16.4
4072

41-
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
4273
.PHONY: controller-gen
43-
controller-gen: ## Download controller-gen locally if necessary.
44-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0)
45-
46-
# go-get-tool will 'go get' any package $2 and install it to $1.
47-
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
48-
define go-get-tool
49-
@[ -f $(1) ] || { \
50-
set -e ;\
51-
echo "Downloading $(2)" ;\
52-
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
53-
}
74+
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
75+
$(CONTROLLER_GEN): $(LOCALBIN)
76+
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
77+
78+
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
79+
# $1 - target path with name of binary
80+
# $2 - package url which can be installed
81+
# $3 - specific version of package
82+
define go-install-tool
83+
@[ -f "$(1)-$(3)" ] || { \
84+
set -e; \
85+
package=$(2)@$(3) ;\
86+
echo "Downloading $${package}" ;\
87+
rm -f $(1) || true ;\
88+
GOBIN=$(LOCALBIN) go install $${package} ;\
89+
mv $(1) $(1)-$(3) ;\
90+
} ;\
91+
ln -sf $(1)-$(3) $(1)
5492
endef

components/poddefaults-webhooks/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/kubeflow/dashboard/components/poddefaults-webhooks
22

3-
go 1.20
3+
go 1.22.12
44

55
require (
66
github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a

components/poddefaults-webhooks/go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
22
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
3+
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
34
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
45
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
56
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
@@ -11,6 +12,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
1112
github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE=
1213
github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
1314
github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U=
15+
github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
1416
github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww=
1517
github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4=
1618
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
@@ -27,6 +29,7 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En
2729
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
2830
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
2931
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
32+
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
3033
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
3134
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
3235
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
@@ -45,6 +48,7 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
4548
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
4649
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
4750
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
51+
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
4852
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
4953
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
5054
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
@@ -59,6 +63,7 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
5963
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
6064
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
6165
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
66+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
6267
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
6368
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
6469
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -77,6 +82,7 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
7782
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
7883
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
7984
github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU=
85+
github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM=
8086
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
8187
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
8288
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -93,6 +99,7 @@ github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO
9399
github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg=
94100
github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
95101
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
102+
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
96103
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
97104
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
98105
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -104,12 +111,14 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
104111
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
105112
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
106113
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
114+
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
107115
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
108116
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
109117
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
110118
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
111119
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
112120
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
121+
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
113122
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
114123
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
115124
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
@@ -167,6 +176,7 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
167176
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
168177
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
169178
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
179+
golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
170180
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
171181
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
172182
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

0 commit comments

Comments
 (0)