Skip to content

Commit 165086d

Browse files
author
Per Goncalves da Silva
committed
Add webhook support
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent 48a8e6f commit 165086d

18 files changed

+2238
-299
lines changed

go.mod

+8-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require (
66
github.com/BurntSushi/toml v1.5.0
77
github.com/Masterminds/semver/v3 v3.3.1
88
github.com/blang/semver/v4 v4.0.0
9+
github.com/cert-manager/cert-manager v1.17.1
910
github.com/containerd/containerd v1.7.27
1011
github.com/containers/image/v5 v5.35.0
1112
github.com/fsnotify/fsnotify v1.9.0
@@ -45,7 +46,7 @@ require (
4546

4647
require (
4748
k8s.io/component-helpers v0.32.3 // indirect
48-
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
49+
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 // indirect
4950
)
5051

5152
require (
@@ -61,7 +62,7 @@ require (
6162
github.com/Microsoft/hcsshim v0.12.9 // indirect
6263
github.com/VividCortex/ewma v1.2.0 // indirect
6364
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
64-
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
65+
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
6566
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
6667
github.com/beorn7/perks v1.0.1 // indirect
6768
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
@@ -96,7 +97,7 @@ require (
9697
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
9798
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
9899
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
99-
github.com/fatih/color v1.15.0 // indirect
100+
github.com/fatih/color v1.16.0 // indirect
100101
github.com/felixge/httpsnoop v1.0.4 // indirect
101102
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
102103
github.com/go-errors/errors v1.4.2 // indirect
@@ -127,7 +128,7 @@ require (
127128
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
128129
github.com/google/uuid v1.6.0 // indirect
129130
github.com/gorilla/mux v1.8.1 // indirect
130-
github.com/gorilla/websocket v1.5.0 // indirect
131+
github.com/gorilla/websocket v1.5.3 // indirect
131132
github.com/gosuri/uitable v0.0.4 // indirect
132133
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
133134
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 // indirect
@@ -217,7 +218,7 @@ require (
217218
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect
218219
go.opentelemetry.io/otel v1.34.0 // indirect
219220
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 // indirect
220-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0 // indirect
221+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 // indirect
221222
go.opentelemetry.io/otel/metric v1.34.0 // indirect
222223
go.opentelemetry.io/otel/sdk v1.34.0 // indirect
223224
go.opentelemetry.io/otel/trace v1.34.0 // indirect
@@ -242,7 +243,8 @@ require (
242243
k8s.io/controller-manager v0.32.3 // indirect
243244
k8s.io/kubectl v0.32.3 // indirect
244245
oras.land/oras-go v1.2.5 // indirect
245-
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 // indirect
246+
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.1 // indirect
247+
sigs.k8s.io/gateway-api v1.1.0 // indirect
246248
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
247249
sigs.k8s.io/kustomize/api v0.18.0 // indirect
248250
sigs.k8s.io/kustomize/kyaml v0.18.1 // indirect

go.sum

+24-20
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpH
3434
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
3535
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
3636
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
37-
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
38-
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
37+
github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ=
38+
github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw=
3939
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
4040
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
4141
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
@@ -51,6 +51,8 @@ github.com/bshuster-repo/logrus-logstash-hook v1.0.0/go.mod h1:zsTqEiSzDgAa/8GZR
5151
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
5252
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
5353
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
54+
github.com/cert-manager/cert-manager v1.17.1 h1:Aig+lWMoLsmpGd9TOlTvO4t0Ah3D+/vGB37x/f+ZKt0=
55+
github.com/cert-manager/cert-manager v1.17.1/go.mod h1:zeG4D+AdzqA7hFMNpYCJgcQ2VOfFNBa+Jzm3kAwiDU4=
5456
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
5557
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
5658
github.com/chai2010/gettext-go v1.0.2 h1:1Lwwip6Q2QGsAdl/ZKPCwTe9fe0CjlUbqj5bFNSjIRk=
@@ -140,8 +142,8 @@ github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjT
140142
github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM=
141143
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f h1:Wl78ApPPB2Wvf/TIe2xdyJxTlb6obmF18d8QdkxNDu4=
142144
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f/go.mod h1:OSYXu++VVOHnXeitef/D8n/6y4QV8uLHSFXX4NeXMGc=
143-
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
144-
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
145+
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
146+
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
145147
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
146148
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
147149
github.com/foxcpp/go-mockdns v1.1.0 h1:jI0rD8M0wuYAxL7r/ynTrCQQq0BVqfB99Vgk7DlmewI=
@@ -260,8 +262,8 @@ github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyE
260262
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
261263
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
262264
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
263-
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
264-
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
265+
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
266+
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
265267
github.com/gosuri/uitable v0.0.4 h1:IG2xLKRvErL3uhY6e1BylFzG+aJiwQviDDTfOKeKTpY=
266268
github.com/gosuri/uitable v0.0.4/go.mod h1:tKR86bXuXPZazfOTG1FIzvjIdXzd0mo4Vtn16vt0PJo=
267269
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA=
@@ -340,8 +342,8 @@ github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxU
340342
github.com/mattn/go-sqlite3 v1.14.27 h1:drZCnuvf37yPfs95E5jd9s3XhdVWLal+6BOK6qrv6IU=
341343
github.com/mattn/go-sqlite3 v1.14.27/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
342344
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
343-
github.com/miekg/dns v1.1.58 h1:ca2Hdkz+cDg/7eNF6V56jjzuZ4aCAE+DbVkILdQWG/4=
344-
github.com/miekg/dns v1.1.58/go.mod h1:Ypv+3b/KadlvW9vJfXOTf300O4UqaHFzFCuHz+rPkBY=
345+
github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ=
346+
github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ=
345347
github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU=
346348
github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
347349
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
@@ -528,12 +530,12 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
528530
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
529531
go.etcd.io/bbolt v1.4.0 h1:TU77id3TnN/zKr7CO/uk+fBCwF2jGcMuw2B/FMAzYIk=
530532
go.etcd.io/bbolt v1.4.0/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk=
531-
go.etcd.io/etcd/api/v3 v3.5.16 h1:WvmyJVbjWqK4R1E+B12RRHz3bRGy9XVfh++MgbN+6n0=
532-
go.etcd.io/etcd/api/v3 v3.5.16/go.mod h1:1P4SlIP/VwkDmGo3OlOD7faPeP8KDIFhqvciH5EfN28=
533-
go.etcd.io/etcd/client/pkg/v3 v3.5.16 h1:ZgY48uH6UvB+/7R9Yf4x574uCO3jIx0TRDyetSfId3Q=
534-
go.etcd.io/etcd/client/pkg/v3 v3.5.16/go.mod h1:V8acl8pcEK0Y2g19YlOV9m9ssUe6MgiDSobSoaBAM0E=
535-
go.etcd.io/etcd/client/v3 v3.5.16 h1:sSmVYOAHeC9doqi0gv7v86oY/BTld0SEFGaxsU9eRhE=
536-
go.etcd.io/etcd/client/v3 v3.5.16/go.mod h1:X+rExSGkyqxvu276cr2OwPLBaeqFu1cIl4vmRjAD/50=
533+
go.etcd.io/etcd/api/v3 v3.5.17 h1:cQB8eb8bxwuxOilBpMJAEo8fAONyrdXTHUNcMd8yT1w=
534+
go.etcd.io/etcd/api/v3 v3.5.17/go.mod h1:d1hvkRuXkts6PmaYk2Vrgqbv7H4ADfAKhyJqHNLJCB4=
535+
go.etcd.io/etcd/client/pkg/v3 v3.5.17 h1:XxnDXAWq2pnxqx76ljWwiQ9jylbpC4rvkAeRVOUKKVw=
536+
go.etcd.io/etcd/client/pkg/v3 v3.5.17/go.mod h1:4DqK1TKacp/86nJk4FLQqo6Mn2vvQFBmruW3pP14H/w=
537+
go.etcd.io/etcd/client/v3 v3.5.17 h1:o48sINNeWz5+pjy/Z0+HKpj/xSnBkuVhVvXkjEXbqZY=
538+
go.etcd.io/etcd/client/v3 v3.5.17/go.mod h1:j2d4eXTHWkT2ClBgnnEPm/Wuu7jsqku41v9DZ3OtjQo=
537539
go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80=
538540
go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c=
539541
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
@@ -560,8 +562,8 @@ go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.32.0 h1:t/Q
560562
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.32.0/go.mod h1:Rl61tySSdcOJWoEgYZVtmnKdA0GeKrSqkHC1t+91CH8=
561563
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 h1:Vh5HayB/0HHfOQA7Ctx69E/Y/DcQSMPpKANYVMQ7fBA=
562564
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0/go.mod h1:cpgtDBaqD/6ok/UG0jT15/uKjAY8mRA53diogHBg3UI=
563-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0 h1:9kV11HXBHZAvuPUZxmMWrH8hZn/6UnHX4K0mu36vNsU=
564-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0/go.mod h1:JyA0FHXe22E1NeNiHmVp7kFHglnexDQ7uRWDiiJ1hKQ=
565+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 h1:5pojmb1U1AogINhN3SurB+zm/nIcusopeBNp42f45QM=
566+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0/go.mod h1:57gTHJSE5S1tqg+EKsLPlTWhpHMsWlVmer+LA926XiA=
565567
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 h1:wpMfgF8E1rkrT1Z6meFh1NDtownE9Ii3n3X2GJYjsaU=
566568
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0/go.mod h1:wAy0T/dUbs468uOlkT31xjvqQgEVXv58BRFWEgn5v/0=
567569
go.opentelemetry.io/otel/exporters/prometheus v0.54.0 h1:rFwzp68QMgtzu9PgP3jm9XaMICI6TsofWWPcBDKwlsU=
@@ -793,8 +795,8 @@ k8s.io/controller-manager v0.32.3 h1:jBxZnQ24k6IMeWLyxWZmpa3QVS7ww+osAIzaUY/jqyc
793795
k8s.io/controller-manager v0.32.3/go.mod h1:out1L3DZjE/p7JG0MoMMIaQGWIkt3c+pKaswqSHgKsI=
794796
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
795797
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
796-
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y=
797-
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4=
798+
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 h1:hcha5B1kVACrLujCKLbr8XWMxCxzQx42DY8QKYJrDLg=
799+
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7/go.mod h1:GewRfANuJ70iYzvn+i4lezLDAFzvjxZYK1gn1lWcfas=
798800
k8s.io/kubectl v0.32.3 h1:VMi584rbboso+yjfv0d8uBHwwxbC438LKq+dXd5tOAI=
799801
k8s.io/kubectl v0.32.3/go.mod h1:6Euv2aso5GKzo/UVMacV6C7miuyevpfI91SvBvV9Zdg=
800802
k8s.io/kubernetes v1.32.3 h1:2A58BlNME8NwsMawmnM6InYo3Jf35Nw5G79q46kXwoA=
@@ -803,10 +805,12 @@ k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJ
803805
k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
804806
oras.land/oras-go v1.2.5 h1:XpYuAwAb0DfQsunIyMfeET92emK8km3W4yEzZvUbsTo=
805807
oras.land/oras-go v1.2.5/go.mod h1:PuAwRShRZCsZb7g8Ar3jKKQR/2A/qN+pkYxIOd/FAoo=
806-
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo=
807-
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
808+
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.1 h1:uOuSLOMBWkJH0TWa9X6l+mj5nZdm6Ay6Bli8HL8rNfk=
809+
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.1/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
808810
sigs.k8s.io/controller-runtime v0.20.4 h1:X3c+Odnxz+iPTRobG4tp092+CvBU9UK0t/bRf+n0DGU=
809811
sigs.k8s.io/controller-runtime v0.20.4/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY=
812+
sigs.k8s.io/gateway-api v1.1.0 h1:DsLDXCi6jR+Xz8/xd0Z1PYl2Pn0TyaFMOPPZIj4inDM=
813+
sigs.k8s.io/gateway-api v1.1.0/go.mod h1:ZH4lHrL2sDi0FHZ9jjneb8kKnGzFWyrTya35sWUTrRs=
810814
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE=
811815
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
812816
sigs.k8s.io/kustomize/api v0.18.0 h1:hTzp67k+3NEVInwz5BHyzc9rGxIauoXferXyjv5lWPo=

internal/operator-controller/features/features.go

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const (
1313
// Ex: SomeFeature featuregate.Feature = "SomeFeature"
1414
PreflightPermissions featuregate.Feature = "PreflightPermissions"
1515
SingleOwnNamespaceInstallSupport featuregate.Feature = "SingleOwnNamespaceInstallSupport"
16+
WebhookSupport featuregate.Feature = "WebhookSupport"
1617
)
1718

1819
var operatorControllerFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
@@ -32,6 +33,15 @@ var operatorControllerFeatureGates = map[featuregate.Feature]featuregate.Feature
3233
PreRelease: featuregate.Alpha,
3334
LockToDefault: false,
3435
},
36+
37+
// WebhookSupport enables support for installing
38+
// registry+v1 cluster extensions that include validating,
39+
// mutating, and/or conversion webhooks
40+
WebhookSupport: {
41+
Default: false,
42+
PreRelease: featuregate.Alpha,
43+
LockToDefault: false,
44+
},
3545
}
3646

3747
var OperatorControllerFeatureGate featuregate.MutableFeatureGate = featuregate.NewFeatureGate()

internal/operator-controller/rukpak/convert/registryv1.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ import (
2020
"github.com/operator-framework/api/pkg/operators/v1alpha1"
2121
"github.com/operator-framework/operator-registry/alpha/property"
2222

23+
"github.com/operator-framework/operator-controller/internal/operator-controller/features"
2324
registry "github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/operator-registry"
2425
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render"
26+
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render/certproviders"
2527
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render/generators"
2628
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render/validators"
2729
)
@@ -220,6 +222,10 @@ var PlainConverter = Converter{
220222
generators.BundleCRDGenerator,
221223
generators.BundleAdditionalResourcesGenerator,
222224
generators.BundleCSVDeploymentGenerator,
225+
generators.BundleValidatingWebhookResourceGenerator,
226+
generators.BundleMutatingWebhookResourceGenerator,
227+
generators.BundleWebhookServiceResourceGenerator,
228+
generators.CertProviderResourceGenerator,
223229
},
224230
},
225231
}
@@ -257,11 +263,11 @@ func (c Converter) Convert(rv1 render.RegistryV1, installNamespace string, targe
257263
return nil, fmt.Errorf("apiServiceDefintions are not supported")
258264
}
259265

260-
if len(rv1.CSV.Spec.WebhookDefinitions) > 0 {
266+
if !features.OperatorControllerFeatureGate.Enabled(features.WebhookSupport) && len(rv1.CSV.Spec.WebhookDefinitions) > 0 {
261267
return nil, fmt.Errorf("webhookDefinitions are not supported")
262268
}
263269

264-
objs, err := c.BundleRenderer.Render(rv1, installNamespace, targetNamespaces)
270+
objs, err := c.BundleRenderer.Render(rv1, installNamespace, targetNamespaces, certproviders.WithCertManagerCertificateProvider())
265271
if err != nil {
266272
return nil, err
267273
}

internal/operator-controller/rukpak/convert/registryv1_test.go

+48
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ import (
1818
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1919
"k8s.io/apimachinery/pkg/runtime"
2020
"k8s.io/apimachinery/pkg/runtime/schema"
21+
featuregatetesting "k8s.io/component-base/featuregate/testing"
2122
"k8s.io/utils/ptr"
2223
"sigs.k8s.io/controller-runtime/pkg/client"
2324

2425
"github.com/operator-framework/api/pkg/operators/v1alpha1"
2526
"github.com/operator-framework/operator-registry/alpha/property"
2627

28+
"github.com/operator-framework/operator-controller/internal/operator-controller/features"
2729
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/convert"
2830
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render"
2931
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/render/validators"
@@ -560,6 +562,52 @@ func TestRegistryV1SuiteGenerateNoWebhooks(t *testing.T) {
560562
require.Nil(t, plainBundle)
561563
}
562564

565+
func TestRegistryV1SuiteGenerateWebhooks_WebhookSupportFGEnabled(t *testing.T) {
566+
featuregatetesting.SetFeatureGateDuringTest(t, features.OperatorControllerFeatureGate, features.WebhookSupport, true)
567+
t.Log("RegistryV1 Suite Convert")
568+
t.Log("It should generate objects successfully based on target namespaces")
569+
570+
t.Log("It should enforce limitations")
571+
t.Log("It should allow bundles with webhooks")
572+
t.Log("By creating a registry v1 bundle")
573+
registryv1Bundle := render.RegistryV1{
574+
PackageName: "testPkg",
575+
CRDs: []apiextensionsv1.CustomResourceDefinition{
576+
{
577+
ObjectMeta: metav1.ObjectMeta{
578+
Name: "fake-webhook.package-with-webhooks.io",
579+
},
580+
},
581+
},
582+
CSV: MakeCSV(
583+
WithName("testCSV"),
584+
WithInstallModeSupportFor(v1alpha1.InstallModeTypeAllNamespaces),
585+
WithOwnedCRDs(
586+
v1alpha1.CRDDescription{
587+
Name: "fake-webhook.package-with-webhooks.io",
588+
},
589+
),
590+
WithStrategyDeploymentSpecs(
591+
v1alpha1.StrategyDeploymentSpec{
592+
Name: "some-deployment",
593+
},
594+
),
595+
WithWebhookDefinitions(
596+
v1alpha1.WebhookDescription{
597+
Type: v1alpha1.ConversionWebhook,
598+
ConversionCRDs: []string{"fake-webhook.package-with-webhooks.io"},
599+
DeploymentName: "some-deployment",
600+
},
601+
),
602+
),
603+
}
604+
605+
t.Log("By converting to plain")
606+
plainBundle, err := convert.PlainConverter.Convert(registryv1Bundle, installNamespace, []string{metav1.NamespaceAll})
607+
require.NoError(t, err)
608+
require.NotNil(t, plainBundle)
609+
}
610+
563611
func TestRegistryV1SuiteGenerateNoAPISerciceDefinitions(t *testing.T) {
564612
t.Log("RegistryV1 Suite Convert")
565613
t.Log("It should generate objects successfully based on target namespaces")

0 commit comments

Comments
 (0)