Skip to content

Commit c71dcb9

Browse files
Merge pull request #140 from tmshort/helm-config-maybe
OPRUN-4079: Use helm to generate manifests
2 parents d1182c7 + eca3547 commit c71dcb9

File tree

1,286 files changed

+306376
-906
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,286 files changed

+306376
-906
lines changed

.bingo/Variables.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@ $(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
2929
@echo "(re)installing $(GOBIN)/golangci-lint-v1.62.2"
3030
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.62.2 "github.com/golangci/golangci-lint/cmd/golangci-lint"
3131

32+
HELM := $(GOBIN)/helm-v3.19.0
33+
$(HELM): $(BINGO_DIR)/helm.mod
34+
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
35+
@echo "(re)installing $(GOBIN)/helm-v3.19.0"
36+
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=helm.mod -o=$(GOBIN)/helm-v3.19.0 "helm.sh/helm/v3/cmd/helm"
37+

.bingo/helm.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
2+
3+
go 1.24.4
4+
5+
require helm.sh/helm/v3 v3.19.0 // cmd/helm

.bingo/helm.sum

Lines changed: 301 additions & 0 deletions
Large diffs are not rendered by default.

.bingo/variables.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ BINGO="${GOBIN}/bingo-v0.9.0"
1212

1313
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.62.2"
1414

15+
HELM="${GOBIN}/helm-v3.19.0"
16+

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,11 @@ clean: ## Remove binaries and test artifacts
2626
lint: $(GOLANGCI_LINT) ## Run golangci linter.
2727
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_ARGS)
2828

29-
29+
HELM_OUTPUT := $(shell mktemp -d)
30+
export HELM_OUTPUT
31+
.PHONY: helm-test-output
32+
helm-test-output: $(HELM)
33+
@echo Output helm to $(HELM_OUTPUT)
34+
$(HELM) template olmv1 testdata/olmv1 --values testdata/openshift.yaml > $(HELM_OUTPUT)/hello-world.yaml
35+
36+
test-unit: helm-test-output

cmd/cluster-olm-operator/main.go

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ import (
3838
)
3939

4040
const (
41-
olmProxyController = "OLMProxyController"
42-
assetPath = "/operand-assets"
43-
standardAssetPath = "/operand-assets/standard"
44-
experimentalAssetPath = "/operand-assets/experimental"
41+
olmProxyController = "OLMProxyController"
42+
assetPath = "/operand-assets"
4543
)
4644

4745
func main() {
4846
pflag.CommandLine.SetNormalizeFunc(utilflag.WordSepNormalizeFunc)
4947
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
5048

49+
klog.InitFlags(goflag.CommandLine)
50+
5151
command := newRootCommand()
5252
code := cli.Run(command)
5353
os.Exit(code)
@@ -93,45 +93,16 @@ func runOperator(ctx context.Context, cc *controllercmd.ControllerContext) error
9393
return err
9494
}
9595

96-
var featureSet configv1.FeatureSet
97-
9896
log := klog.FromContext(ctx)
99-
assets := assetPath
100-
if _, err := os.Stat(standardAssetPath); err == nil {
101-
log.Info("Standard manifest location available")
102-
assets = standardAssetPath
103-
}
104-
if _, err := os.Stat(experimentalAssetPath); err == nil {
105-
// experimental Path exists
106-
log.Info("Experimental manifest location available")
107-
fg, err := cl.ConfigClient.ConfigV1().FeatureGates().Get(ctx, "cluster", metav1.GetOptions{})
108-
if err != nil {
109-
return fmt.Errorf("unable to retrieve featureSet: %w", err)
110-
}
111-
112-
featureSet = fg.Spec.FeatureSet
113-
useExperimental := false
114-
switch featureSet {
115-
case configv1.CustomNoUpgrade:
116-
useExperimental = true
117-
case configv1.DevPreviewNoUpgrade:
118-
useExperimental = true
119-
case configv1.TechPreviewNoUpgrade:
120-
useExperimental = true
121-
case configv1.Default:
122-
default:
123-
log.Info("Unknown featureSet value, using standard manifests", "featureSet", fg.Spec.FeatureSet)
124-
}
125-
126-
if useExperimental {
127-
log.Info("Using experimental manifests", "featureSet", fg.Spec.FeatureSet)
128-
assets = experimentalAssetPath
129-
}
97+
98+
fg, err := cl.ConfigClient.ConfigV1().FeatureGates().Get(ctx, "cluster", metav1.GetOptions{})
99+
if err != nil {
100+
return fmt.Errorf("unable to retrieve featureSet: %w", err)
130101
}
131102

132103
clusterCatalogGvk := catalogdv1.GroupVersion.WithKind("ClusterCatalog")
133104
cb := controller.Builder{
134-
Assets: os.DirFS(assets),
105+
Assets: assetPath,
135106
Clients: cl,
136107
ControllerContext: cc,
137108
KnownRESTMappings: map[schema.GroupVersionKind]*meta.RESTMapping{
@@ -141,7 +112,7 @@ func runOperator(ctx context.Context, cc *controllercmd.ControllerContext) error
141112
Scope: meta.RESTScopeRoot,
142113
},
143114
},
144-
FeatureSet: featureSet,
115+
FeatureGate: *fg,
145116
}
146117

147118
staticResourceControllers, deploymentControllers, clusterCatalogControllers, relatedObjects, err := cb.BuildControllers("catalogd", "operator-controller")
@@ -242,7 +213,6 @@ func runOperator(ctx context.Context, cc *controllercmd.ControllerContext) error
242213
featureGates, _ := cl.FeatureGatesAccessor.CurrentFeatureGates()
243214
log.Info("FeatureGates initialized", "knownFeatures", featureGates.KnownFeatures())
244215
case <-time.After(1 * time.Minute):
245-
log.Error(nil, "timed out waiting for FeatureGate detection")
246216
return errors.New("timed out waiting for FeatureGate detection")
247217
}
248218

go.mod

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.24.0
55
toolchain go1.24.4
66

77
require (
8+
github.com/TwiN/deepmerge v0.2.2
89
github.com/blang/semver/v4 v4.0.0
910
github.com/go-logr/logr v1.4.2
1011
github.com/openshift/api v0.0.0-20250710004639-926605d3338b
@@ -17,9 +18,10 @@ require (
1718
github.com/operator-framework/operator-registry v1.48.0
1819
github.com/spf13/cobra v1.9.1
1920
github.com/spf13/pflag v1.0.6
20-
github.com/stretchr/testify v1.10.0
21+
github.com/stretchr/testify v1.11.1
2122
golang.org/x/net v0.40.0
2223
golang.org/x/text v0.26.0
24+
gopkg.in/yaml.v3 v3.0.1
2325
helm.sh/helm/v3 v3.18.4
2426
k8s.io/api v0.33.2
2527
k8s.io/apiextensions-apiserver v0.33.2
@@ -33,68 +35,110 @@ require (
3335

3436
require (
3537
cel.dev/expr v0.19.1 // indirect
38+
dario.cat/mergo v1.0.1 // indirect
39+
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
40+
github.com/BurntSushi/toml v1.5.0 // indirect
41+
github.com/MakeNowJust/heredoc v1.0.0 // indirect
42+
github.com/Masterminds/goutils v1.1.1 // indirect
3643
github.com/Masterminds/semver/v3 v3.3.0 // indirect
44+
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
3745
github.com/Masterminds/squirrel v1.5.4 // indirect
3846
github.com/NYTimes/gziphandler v1.1.1 // indirect
3947
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
48+
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
4049
github.com/beorn7/perks v1.0.1 // indirect
4150
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
4251
github.com/cespare/xxhash/v2 v2.3.0 // indirect
52+
github.com/chai2010/gettext-go v1.0.2 // indirect
53+
github.com/containerd/containerd v1.7.27 // indirect
54+
github.com/containerd/errdefs v0.3.0 // indirect
55+
github.com/containerd/log v0.1.0 // indirect
56+
github.com/containerd/platforms v0.2.1 // indirect
4357
github.com/coreos/go-semver v0.3.1 // indirect
4458
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
4559
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
4660
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
4761
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
62+
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
63+
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
64+
github.com/fatih/color v1.15.0 // indirect
4865
github.com/felixge/fgprof v0.9.4 // indirect
4966
github.com/felixge/httpsnoop v1.0.4 // indirect
5067
github.com/fsnotify/fsnotify v1.8.0 // indirect
5168
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
69+
github.com/go-errors/errors v1.4.2 // indirect
5270
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
5371
github.com/go-logr/stdr v1.2.2 // indirect
5472
github.com/go-openapi/jsonpointer v0.21.0 // indirect
5573
github.com/go-openapi/jsonreference v0.21.0 // indirect
5674
github.com/go-openapi/swag v0.23.0 // indirect
75+
github.com/gobwas/glob v0.2.3 // indirect
5776
github.com/gogo/protobuf v1.3.2 // indirect
5877
github.com/golang/protobuf v1.5.4 // indirect
5978
github.com/google/btree v1.1.3 // indirect
6079
github.com/google/cel-go v0.23.2 // indirect
6180
github.com/google/gnostic-models v0.6.9 // indirect
6281
github.com/google/go-cmp v0.7.0 // indirect
6382
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
83+
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
6484
github.com/google/uuid v1.6.0 // indirect
85+
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
86+
github.com/gosuri/uitable v0.0.4 // indirect
87+
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
6588
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
6689
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect
90+
github.com/hashicorp/errwrap v1.1.0 // indirect
91+
github.com/hashicorp/go-multierror v1.1.1 // indirect
92+
github.com/huandu/xstrings v1.5.0 // indirect
6793
github.com/imdario/mergo v0.3.16 // indirect
6894
github.com/inconshreveable/mousetrap v1.1.0 // indirect
6995
github.com/jmoiron/sqlx v1.4.0 // indirect
7096
github.com/josharian/intern v1.0.0 // indirect
7197
github.com/json-iterator/go v1.1.12 // indirect
98+
github.com/klauspost/compress v1.18.0 // indirect
7299
github.com/kylelemons/godebug v1.1.0 // indirect
73100
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
74101
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
75102
github.com/lib/pq v1.10.9 // indirect
103+
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
76104
github.com/mailru/easyjson v0.7.7 // indirect
105+
github.com/mattn/go-colorable v0.1.13 // indirect
106+
github.com/mattn/go-isatty v0.0.20 // indirect
107+
github.com/mattn/go-runewidth v0.0.16 // indirect
77108
github.com/mitchellh/copystructure v1.2.0 // indirect
109+
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
78110
github.com/mitchellh/reflectwalk v1.0.2 // indirect
111+
github.com/moby/spdystream v0.5.0 // indirect
112+
github.com/moby/term v0.5.2 // indirect
79113
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
80114
github.com/modern-go/reflect2 v1.0.2 // indirect
115+
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
81116
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
117+
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
118+
github.com/opencontainers/go-digest v1.0.0 // indirect
119+
github.com/opencontainers/image-spec v1.1.1 // indirect
82120
github.com/operator-framework/api v0.27.0 // indirect
121+
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
83122
github.com/pkg/errors v0.9.1 // indirect
84123
github.com/pkg/profile v1.7.0 // indirect
85124
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
86125
github.com/prometheus/client_golang v1.22.0 // indirect
87126
github.com/prometheus/client_model v0.6.1 // indirect
88127
github.com/prometheus/common v0.62.0 // indirect
89128
github.com/prometheus/procfs v0.15.1 // indirect
129+
github.com/rivo/uniseg v0.4.7 // indirect
90130
github.com/robfig/cron v1.2.0 // indirect
91131
github.com/rubenv/sql-migrate v1.8.0 // indirect
132+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
133+
github.com/shopspring/decimal v1.4.0 // indirect
92134
github.com/sirupsen/logrus v1.9.3 // indirect
135+
github.com/spf13/cast v1.7.0 // indirect
93136
github.com/stoewer/go-strcase v1.3.0 // indirect
94137
github.com/x448/float16 v0.8.4 // indirect
95138
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
96139
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
97140
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
141+
github.com/xlab/treeprint v1.2.0 // indirect
98142
go.etcd.io/etcd/api/v3 v3.5.21 // indirect
99143
go.etcd.io/etcd/client/pkg/v3 v3.5.21 // indirect
100144
go.etcd.io/etcd/client/v3 v3.5.21 // indirect
@@ -124,14 +168,18 @@ require (
124168
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
125169
gopkg.in/inf.v0 v0.9.1 // indirect
126170
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
127-
gopkg.in/yaml.v3 v3.0.1 // indirect
128171
k8s.io/apiserver v0.33.2 // indirect
172+
k8s.io/cli-runtime v0.33.2 // indirect
129173
k8s.io/kms v0.33.2 // indirect
130174
k8s.io/kube-aggregator v0.33.2 // indirect
131175
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
176+
k8s.io/kubectl v0.33.2 // indirect
177+
oras.land/oras-go/v2 v2.6.0 // indirect
132178
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
133179
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
134180
sigs.k8s.io/kube-storage-version-migrator v0.0.6-0.20230721195810-5c8923c5ff96 // indirect
181+
sigs.k8s.io/kustomize/api v0.19.0 // indirect
182+
sigs.k8s.io/kustomize/kyaml v0.19.0 // indirect
135183
sigs.k8s.io/randfill v1.0.0 // indirect
136184
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
137185
sigs.k8s.io/yaml v1.4.0 // indirect

0 commit comments

Comments
 (0)