Skip to content

Commit 057c207

Browse files
Changes required for ClusterExtension to install an operator (#789)
* Add relevant RBAC to enable controller to watch resources * Debugging iteration - one * ClusterExtension installing the operator - working --------- Co-authored-by: [email protected] <[email protected]>
1 parent cb9de39 commit 057c207

File tree

9 files changed

+65
-61
lines changed

9 files changed

+65
-61
lines changed

cmd/manager/main.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ func main() {
9999

100100
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts), zap.StacktraceLevel(zapcore.DPanicLevel)))
101101

102+
fmt.Println("set up manager")
102103
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
103104
Scheme: scheme,
104105
Metrics: server.Options{BindAddress: metricsAddr},
@@ -172,13 +173,13 @@ func main() {
172173
os.Exit(1)
173174
}
174175

175-
if err = (&controllers.ExtensionReconciler{
176-
Client: cl,
177-
BundleProvider: catalogClient,
178-
}).SetupWithManager(mgr); err != nil {
179-
setupLog.Error(err, "unable to create controller", "controller", "Extension")
180-
os.Exit(1)
181-
}
176+
// if err = (&controllers.ExtensionReconciler{
177+
// Client: cl,
178+
// BundleProvider: catalogClient,
179+
// }).SetupWithManager(mgr); err != nil {
180+
// setupLog.Error(err, "unable to create controller", "controller", "Extension")
181+
// os.Exit(1)
182+
// }
182183
//+kubebuilder:scaffold:builder
183184

184185
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {

config/manager/manager.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ spec:
6161
volumeMounts:
6262
- name: cache
6363
mountPath: /var/cache
64+
- name: bundle-cache
65+
mountPath: /var/cache/bundles
6466
securityContext:
6567
allowPrivilegeEscalation: false
6668
capabilities:
@@ -109,3 +111,5 @@ spec:
109111
volumes:
110112
- name: cache
111113
emptyDir: {}
114+
- name: bundle-cache
115+
emptyDir: {}

go.mod

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
go.uber.org/zap v1.27.0
2323
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a
2424
gopkg.in/yaml.v2 v2.4.0
25-
helm.sh/helm/v3 v3.14.3
25+
helm.sh/helm/v3 v3.14.4
2626
k8s.io/api v0.29.3
2727
k8s.io/apiextensions-apiserver v0.29.3
2828
k8s.io/apimachinery v0.29.3
@@ -82,7 +82,7 @@ require (
8282
github.com/go-errors/errors v1.4.2 // indirect
8383
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
8484
github.com/go-git/go-billy/v5 v5.5.0 // indirect
85-
github.com/go-git/go-git/v5 v5.11.0 // indirect
85+
github.com/go-git/go-git/v5 v5.12.0 // indirect
8686
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
8787
github.com/go-logr/stdr v1.2.2 // indirect
8888
github.com/go-logr/zapr v1.3.0 // indirect
@@ -128,6 +128,7 @@ require (
128128
github.com/mattn/go-isatty v0.0.19 // indirect
129129
github.com/mattn/go-runewidth v0.0.15 // indirect
130130
github.com/mattn/go-sqlite3 v1.14.22 // indirect
131+
github.com/miekg/dns v1.1.43 // indirect
131132
github.com/mitchellh/copystructure v1.2.0 // indirect
132133
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
133134
github.com/mitchellh/reflectwalk v1.0.2 // indirect
@@ -151,9 +152,9 @@ require (
151152
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
152153
github.com/pkg/errors v0.9.1 // indirect
153154
github.com/pmezard/go-difflib v1.0.0 // indirect
154-
github.com/prometheus/client_golang v1.18.0 // indirect
155+
github.com/prometheus/client_golang v1.19.0 // indirect
155156
github.com/prometheus/client_model v0.6.0 // indirect
156-
github.com/prometheus/common v0.47.0 // indirect
157+
github.com/prometheus/common v0.48.0 // indirect
157158
github.com/prometheus/procfs v0.12.0 // indirect
158159
github.com/rivo/uniseg v0.4.4 // indirect
159160
github.com/rubenv/sql-migrate v1.5.2 // indirect
@@ -172,6 +173,7 @@ require (
172173
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
173174
github.com/xlab/treeprint v1.2.0 // indirect
174175
go.etcd.io/bbolt v1.3.9 // indirect
176+
go.etcd.io/etcd/api/v3 v3.5.12 // indirect
175177
go.opencensus.io v0.24.0 // indirect
176178
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect
177179
go.opentelemetry.io/otel v1.23.1 // indirect
@@ -183,13 +185,13 @@ require (
183185
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
184186
go.starlark.net v0.0.0-20230612165344-9532f5667272 // indirect
185187
go.uber.org/multierr v1.11.0 // indirect
186-
golang.org/x/crypto v0.21.0 // indirect
188+
golang.org/x/crypto v0.22.0 // indirect
187189
golang.org/x/mod v0.16.0 // indirect
188190
golang.org/x/net v0.22.0 // indirect
189191
golang.org/x/oauth2 v0.17.0 // indirect
190-
golang.org/x/sync v0.6.0 // indirect
191-
golang.org/x/sys v0.18.0 // indirect
192-
golang.org/x/term v0.18.0 // indirect
192+
golang.org/x/sync v0.7.0 // indirect
193+
golang.org/x/sys v0.19.0 // indirect
194+
golang.org/x/term v0.19.0 // indirect
193195
golang.org/x/text v0.14.0 // indirect
194196
golang.org/x/time v0.5.0 // indirect
195197
golang.org/x/tools v0.18.0 // indirect

go.sum

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+
152152
github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
153153
github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw=
154154
github.com/go-git/go-git/v5 v5.3.0/go.mod h1:xdX4bWJ48aOrdhnl2XqHYstHbbp6+LFS4r4X+lNVprw=
155-
github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4=
156-
github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY=
155+
github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys=
157156
github.com/go-gorp/gorp/v3 v3.1.0 h1:ItKF/Vbuj31dmV4jxA1qblpSwkl9g1typ24xoe70IGs=
158157
github.com/go-gorp/gorp/v3 v3.1.0/go.mod h1:dLEjIyyRNiXvNZ8PSmzpt1GsWAUK8kjVhEpjH8TixEw=
159158
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
@@ -340,8 +339,7 @@ github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A
340339
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
341340
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
342341
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
343-
github.com/miekg/dns v1.1.25 h1:dFwPR6SfLtrSwgDcIq2bcU/gVutB4sNApq2HBdqcakg=
344-
github.com/miekg/dns v1.1.25/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
342+
github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg=
345343
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
346344
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
347345
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
@@ -424,17 +422,15 @@ github.com/poy/onpar v1.1.2/go.mod h1:6X8FLNoxyr9kkmnlqpK6LSoiOtrO6MICtWwEuWkLjz
424422
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
425423
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
426424
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
427-
github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk=
428-
github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA=
425+
github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
429426
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
430427
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
431428
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
432429
github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos=
433430
github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8=
434431
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
435432
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
436-
github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k=
437-
github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc=
433+
github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE=
438434
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
439435
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
440436
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
@@ -457,8 +453,7 @@ github.com/rubenv/sql-migrate v1.5.2/go.mod h1:H38GW8Vqf8F0Su5XignRyaRcbXbJunSWx
457453
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
458454
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
459455
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
460-
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
461-
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
456+
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
462457
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
463458
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
464459
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
@@ -518,8 +513,7 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
518513
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
519514
go.etcd.io/bbolt v1.3.9 h1:8x7aARPEXiXbHmtUwAIv7eV2fQFHrLLavdiJ3uzJXoI=
520515
go.etcd.io/bbolt v1.3.9/go.mod h1:zaO32+Ti0PK1ivdPtgMESzuzL2VPoIG1PCQNvOdo/dE=
521-
go.etcd.io/etcd/api/v3 v3.5.10 h1:szRajuUUbLyppkhs9K6BRtjY37l66XQQmw7oZRANE4k=
522-
go.etcd.io/etcd/api/v3 v3.5.10/go.mod h1:TidfmT4Uycad3NM/o25fG3J07odo4GBB9hoxaodFCtI=
516+
go.etcd.io/etcd/api/v3 v3.5.12 h1:W4sw5ZoU2Juc9gBWuLk5U6fHfNVyY1WC5g9uiXZio/c=
523517
go.etcd.io/etcd/client/pkg/v3 v3.5.12 h1:EYDL6pWwyOsylrQyLp2w+HkQ46ATiOvoEdMarindU2A=
524518
go.etcd.io/etcd/client/pkg/v3 v3.5.12/go.mod h1:seTzl2d9APP8R5Y2hFL3NVlD6qC/dOT+3kvrqPyTas4=
525519
go.etcd.io/etcd/client/v3 v3.5.12 h1:v5lCPXn1pf1Uu3M4laUE2hp/geOTc5uPcYYsNe1lDxg=
@@ -578,8 +572,7 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
578572
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
579573
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
580574
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
581-
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
582-
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
575+
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
583576
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
584577
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE=
585578
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
@@ -619,8 +612,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
619612
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
620613
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
621614
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
622-
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
623-
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
615+
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
624616
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
625617
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
626618
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -645,14 +637,12 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
645637
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
646638
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
647639
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
648-
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
649-
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
640+
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
650641
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
651642
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
652643
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
653644
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
654-
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
655-
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
645+
golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
656646
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
657647
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
658648
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
@@ -738,8 +728,7 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
738728
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
739729
gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY=
740730
gotest.tools/v3 v3.5.0/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
741-
helm.sh/helm/v3 v3.14.3 h1:HmvRJlwyyt9HjgmAuxHbHv3PhMz9ir/XNWHyXfmnOP4=
742-
helm.sh/helm/v3 v3.14.3/go.mod h1:v6myVbyseSBJTzhmeE39UcPLNv6cQK6qss3dvgAySaE=
731+
helm.sh/helm/v3 v3.14.4 h1:6FSpEfqyDalHq3kUr4gOMThhgY55kXUEjdQoyODYnrM=
743732
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
744733
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
745734
k8s.io/api v0.29.3 h1:2ORfZ7+bGC3YJqGpV0KSDDEVf8hdGQ6A03/50vj8pmw=

internal/controllers/clusterextension_controller.go

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ type ClusterExtensionReconciler struct {
102102
//+kubebuilder:rbac:groups=catalogd.operatorframework.io,resources=catalogmetadata,verbs=list;watch
103103

104104
func (r *ClusterExtensionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
105+
fmt.Println("start reconciling")
106+
105107
l := log.FromContext(ctx).WithName("operator-controller")
106108
l.V(1).Info("starting")
107109
defer l.V(1).Info("ending")
@@ -157,18 +159,21 @@ func checkForUnexpectedFieldChange(a, b ocv1alpha1.ClusterExtension) bool {
157159
//nolint:unparam
158160
func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alpha1.ClusterExtension) (ctrl.Result, error) {
159161
// run resolution
162+
fmt.Println("reconciling!!!")
160163
bundle, err := r.resolve(ctx, *ext)
161164
if err != nil {
162165
// set right statuses
163-
return ctrl.Result{}, err
166+
return ctrl.Result{}, fmt.Errorf("error resolving: %v", err)
164167
}
165168

166169
bundleVersion, err := bundle.Version()
167170
if err != nil {
168171
setInstalledStatusConditionFailed(&ext.Status.Conditions, fmt.Sprintf("%s:%v", "unable to get resolved bundle version", err), ext.Generation)
169-
return ctrl.Result{}, err
172+
return ctrl.Result{}, fmt.Errorf("error bundleVersion: %v", err)
170173
}
171174

175+
fmt.Printf("bundle Version %q", bundleVersion)
176+
172177
// Now we can set the Resolved Condition, and the resolvedBundleSource field to the bundle.Image value.
173178
ext.Status.ResolvedBundle = bundleMetadataFor(bundle)
174179
setResolvedStatusConditionSuccess(&ext.Status.Conditions, fmt.Sprintf("resolved to %q", bundle.Image), ext.GetGeneration())
@@ -183,6 +188,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
183188
return ctrl.Result{}, updateStatusUnpackFailing(&ext.Status, fmt.Errorf("source bundle content: %v", err))
184189
}
185190

191+
fmt.Println("unpack state", unpackResult.State)
186192
switch unpackResult.State {
187193
case rukpaksource.StatePending:
188194
updateStatusUnpackPending(&ext.Status, unpackResult)
@@ -254,6 +260,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1alp
254260
case stateNeedsInstall:
255261
rel, err = ac.Install(ext.GetName(), r.ReleaseNamespace, chrt, values, func(install *action.Install) error {
256262
install.CreateNamespace = false
263+
install.Labels = map[string]string{util.BundleNameKey: bundle.Name, util.PackageNameKey: bundle.Package, util.BundleVersionKey: bundleVersion.String()}
257264
return nil
258265
}, helmclient.AppendInstallPostRenderer(post))
259266
if err != nil {
@@ -554,7 +561,7 @@ func clusterExtensionRequestsForCatalog(c client.Reader, logger logr.Logger) crh
554561
func (r *ClusterExtensionReconciler) resolve(ctx context.Context, clusterExtension ocv1alpha1.ClusterExtension) (*catalogmetadata.Bundle, error) {
555562
allBundles, err := r.BundleProvider.Bundles(ctx)
556563
if err != nil {
557-
return nil, err
564+
return nil, fmt.Errorf("error listing bundles: %v", err)
558565
}
559566

560567
// TODO: change clusterExtension spec to contain a source field.
@@ -583,7 +590,7 @@ func (r *ClusterExtensionReconciler) resolve(ctx context.Context, clusterExtensi
583590
if clusterExtension.Spec.UpgradeConstraintPolicy != ocv1alpha1.UpgradeConstraintPolicyIgnore {
584591
installedVersionSemver, err := r.getInstalledVersion(clusterExtension)
585592
if err != nil && !apierrors.IsNotFound(err) {
586-
return nil, err
593+
return nil, fmt.Errorf("err: %v", err)
587594
}
588595
if installedVersionSemver != nil {
589596
installedVersion = installedVersionSemver.String()
@@ -628,27 +635,22 @@ func (r *ClusterExtensionReconciler) getInstalledVersion(clusterExtension ocv1al
628635
// If not, the other option is to get the Helm secret in the release namespace, list all the releases,
629636
// get the chart annotations.
630637
release, err := cl.Get(clusterExtension.GetName())
631-
if err != nil {
632-
return nil, err
638+
if err != nil && !errors.Is(err, driver.ErrReleaseNotFound) {
639+
return nil, fmt.Errorf("error fetching chart: %v", err)
633640
}
634641
if release == nil {
635642
return nil, nil
636643
}
637644

638-
chart := release.Chart
639-
if chart == nil {
640-
return nil, errors.New("empty chart associated with the release")
641-
}
642-
643645
// TODO: when the chart is created these annotations are to be added.
644-
existingVersion, ok := chart.Metadata.Annotations[util.BundleVersionKey]
646+
existingVersion, ok := release.Labels[util.BundleVersionKey]
645647
if !ok {
646-
return nil, fmt.Errorf("chart %q: missing bundle version", chart.Name())
648+
return nil, fmt.Errorf("release %q: missing bundle version", release.Name)
647649
}
648650

649651
existingVersionSemver, err := bsemver.New(existingVersion)
650652
if err != nil {
651-
return nil, fmt.Errorf("could not determine bundle version for the chart %q: %w", chart.Name(), err)
653+
return nil, fmt.Errorf("could not determine bundle version for the chart %q: %w", release.Name, err)
652654
}
653655
return existingVersionSemver, nil
654656
}
@@ -670,6 +672,7 @@ func (r *ClusterExtensionReconciler) getReleaseState(cl helmclient.ActionInterfa
670672
if errors.Is(err, driver.ErrReleaseNotFound) {
671673
return nil, stateNeedsInstall, nil
672674
}
675+
673676
desiredRelease, err := cl.Upgrade(obj.GetName(), r.ReleaseNamespace, chrt, values, func(upgrade *action.Upgrade) error {
674677
upgrade.DryRun = true
675678
return nil
@@ -731,12 +734,12 @@ func (p *postrenderer) Run(renderedManifests *bytes.Buffer) (*bytes.Buffer, erro
731734
break
732735
}
733736
if err != nil {
734-
return nil, err
737+
return nil, fmt.Errorf("error decoding objeccts %v", err)
735738
}
736739
obj.SetLabels(util.MergeMaps(obj.GetLabels(), p.labels))
737740
b, err := obj.MarshalJSON()
738741
if err != nil {
739-
return nil, err
742+
return nil, fmt.Errorf("error marshalling: %v", err)
740743
}
741744
buf.Write(b)
742745
}

internal/rukpak/convert/registryv1.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,9 @@ func Convert(in RegistryV1, installNamespace string, targetNamespaces []string)
336336
obj := obj
337337
objs = append(objs, &obj)
338338
}
339-
return &Plain{Objects: objs}, nil
339+
340+
p := &Plain{Objects: objs}
341+
return p, nil
340342
}
341343

342344
const maxNameLength = 63

internal/rukpak/handler/registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88
"io/fs"
99
"path/filepath"
1010

11-
"gopkg.in/yaml.v2"
1211
"helm.sh/helm/v3/pkg/chart"
1312
"helm.sh/helm/v3/pkg/chartutil"
1413
"sigs.k8s.io/controller-runtime/pkg/client"
14+
"sigs.k8s.io/yaml"
1515

1616
ocv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
1717
"github.com/operator-framework/operator-controller/internal/rukpak/convert"

0 commit comments

Comments
 (0)