Skip to content

Commit f73c095

Browse files
Merge pull request #37 from abays/def_imgs_via_webhooks
Webhook for default images
2 parents 8b93b56 + fb19fcb commit f73c095

32 files changed

+1018
-22
lines changed

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ build: generate fmt vet ## Build manager binary.
126126
go build -o bin/manager main.go
127127

128128
.PHONY: run
129+
run: export ENABLE_WEBHOOKS?=false
129130
run: manifests generate fmt vet ## Run a controller from your host.
131+
/bin/bash hack/clean_local_webhook.sh
130132
go run ./main.go
131133

132134
.PHONY: docker-build
@@ -310,3 +312,20 @@ gowork: ## Generate go.work file to support our multi module repository
310312
operator-lint: gowork ## Runs operator-lint
311313
GOBIN=$(LOCALBIN) go install github.com/gibizer/operator-lint@v0.3.0
312314
go vet -vettool=$(LOCALBIN)/operator-lint ./... ./api/...
315+
316+
# Used for webhook testing
317+
# Please ensure the ovn-controller-manager deployment and
318+
# webhook definitions are removed from the csv before running
319+
# this. Also, cleanup the webhook configuration for local testing
320+
# before deplying with olm again.
321+
# $oc delete validatingwebhookconfiguration/vovndbcluster.kb.io
322+
# $oc delete mutatingwebhookconfiguration/movndbcluster.kb.io
323+
# $oc delete validatingwebhookconfiguration/vovnnorthd.kb.io
324+
# $oc delete mutatingwebhookconfiguration/movnnorthd.kb.io
325+
SKIP_CERT ?=false
326+
.PHONY: run-with-webhook
327+
run-with-webhook: export OVN_DBCLUSTER_IMAGE_URL_DEFAULT=quay.io/tripleozedcentos9/openstack-ovn-nb-db-server:current-tripleo
328+
run-with-webhook: export OVN_NORTHD_IMAGE_URL_DEFAULT=quay.io/tripleozedcentos9/openstack-ovn-northd:current-tripleo
329+
run-with-webhook: manifests generate fmt vet ## Run a controller from your host.
330+
/bin/bash hack/configure_local_webhook.sh
331+
go run ./main.go

PROJECT

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ resources:
4343
kind: OVNNorthd
4444
path: github.com/openstack-k8s-operators/ovn-operator/api/v1beta1
4545
version: v1beta1
46+
webhooks:
47+
defaulting: true
48+
validation: true
49+
webhookVersion: v1
4650
- api:
4751
crdVersion: v1
4852
namespaced: true
@@ -52,4 +56,8 @@ resources:
5256
kind: OVNDBCluster
5357
path: github.com/openstack-k8s-operators/ovn-operator/api/v1beta1
5458
version: v1beta1
59+
webhooks:
60+
defaulting: true
61+
validation: true
62+
webhookVersion: v1
5563
version: "3"

api/bases/ovn.openstack.org_ovndbclusters.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ spec:
4949
description: OVNDBClusterSpec defines the desired state of OVNDBCluster
5050
properties:
5151
containerImage:
52-
default: quay.io/tripleozedcentos9/openstack-ovn-nb-db-server:current-tripleo
52+
description: ContainerImage - Container Image URL (will be set to
53+
environmental default if empty)
5354
type: string
5455
dbType:
5556
default: NB
@@ -129,6 +130,7 @@ spec:
129130
description: StorageRequest
130131
type: string
131132
required:
133+
- containerImage
132134
- dbType
133135
- storageRequest
134136
type: object

api/bases/ovn.openstack.org_ovnnorthds.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ spec:
4949
description: OVNNorthdSpec defines the desired state of OVNNorthd
5050
properties:
5151
containerImage:
52-
default: quay.io/tripleozedcentos9/openstack-ovn-northd:current-tripleo
52+
description: ContainerImage - Container Image URL (will be set to
53+
environmental default if empty)
5354
type: string
5455
logLevel:
5556
default: info
@@ -100,6 +101,8 @@ spec:
100101
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
101102
type: object
102103
type: object
104+
required:
105+
- containerImage
103106
type: object
104107
status:
105108
description: OVNNorthdStatus defines the observed state of OVNNorthd

api/go.mod

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,66 @@ go 1.19
44

55
require (
66
github.com/go-logr/logr v1.2.3
7+
github.com/onsi/ginkgo/v2 v2.5.0
8+
github.com/onsi/gomega v1.24.1
79
github.com/openstack-k8s-operators/lib-common/modules/common v0.0.0-20230220103808-bd9bda2ad709
810
k8s.io/api v0.25.4
911
k8s.io/apimachinery v0.25.4
12+
k8s.io/client-go v0.25.4
1013
sigs.k8s.io/controller-runtime v0.13.1
1114
)
1215

1316
require (
1417
github.com/PuerkitoBio/purell v1.1.1 // indirect
1518
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
19+
github.com/beorn7/perks v1.0.1 // indirect
20+
github.com/cespare/xxhash/v2 v2.1.2 // indirect
1621
github.com/davecgh/go-spew v1.1.1 // indirect
1722
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
1823
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
24+
github.com/fsnotify/fsnotify v1.5.4 // indirect
25+
github.com/go-logr/zapr v1.2.3 // indirect
1926
github.com/go-openapi/jsonpointer v0.19.5 // indirect
2027
github.com/go-openapi/jsonreference v0.19.5 // indirect
2128
github.com/go-openapi/swag v0.19.14 // indirect
2229
github.com/gogo/protobuf v1.3.2 // indirect
30+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
2331
github.com/golang/protobuf v1.5.2 // indirect
2432
github.com/google/gnostic v0.5.7-v3refs // indirect
2533
github.com/google/go-cmp v0.5.9 // indirect
2634
github.com/google/gofuzz v1.1.0 // indirect
35+
github.com/google/uuid v1.1.2 // indirect
36+
github.com/imdario/mergo v0.3.12 // indirect
2737
github.com/josharian/intern v1.0.0 // indirect
2838
github.com/json-iterator/go v1.1.12 // indirect
2939
github.com/mailru/easyjson v0.7.6 // indirect
40+
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
3041
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
3142
github.com/modern-go/reflect2 v1.0.2 // indirect
3243
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
3344
github.com/pkg/errors v0.9.1 // indirect
45+
github.com/prometheus/client_golang v1.12.2 // indirect
46+
github.com/prometheus/client_model v0.2.0 // indirect
47+
github.com/prometheus/common v0.32.1 // indirect
48+
github.com/prometheus/procfs v0.7.3 // indirect
49+
github.com/spf13/pflag v1.0.5 // indirect
50+
go.uber.org/atomic v1.7.0 // indirect
51+
go.uber.org/multierr v1.6.0 // indirect
52+
go.uber.org/zap v1.21.0 // indirect
3453
golang.org/x/net v0.2.0 // indirect
3554
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
3655
golang.org/x/sys v0.2.0 // indirect
3756
golang.org/x/term v0.2.0 // indirect
3857
golang.org/x/text v0.4.0 // indirect
3958
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
59+
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
4060
google.golang.org/appengine v1.6.7 // indirect
4161
google.golang.org/protobuf v1.28.0 // indirect
4262
gopkg.in/inf.v0 v0.9.1 // indirect
4363
gopkg.in/yaml.v2 v2.4.0 // indirect
4464
gopkg.in/yaml.v3 v3.0.1 // indirect
45-
k8s.io/client-go v0.25.4 // indirect
65+
k8s.io/apiextensions-apiserver v0.25.0 // indirect
66+
k8s.io/component-base v0.25.0 // indirect
4667
k8s.io/klog/v2 v2.70.1 // indirect
4768
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
4869
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect

0 commit comments

Comments
 (0)