Skip to content

Commit 0058054

Browse files
bentitotmshortdtfranzvarshaprasad96
authored
✨ Modify ClusterExtension to use Helm under the hood to apply contents into the cluster (#846)
* Helm POC rebase-a-thon * Unpack Image (#811) Builds and loads the unpacker binary into the operator-controller image so we don't need to use the rukpak image. Signed-off-by: dtfranz <[email protected]> * ✨ OPRUN-3293 Fixes several unit tests - not cache ones (#831) * Fix, rm or skip BundleDeployment related tests Signed-off-by: Brett Tofel <[email protected]> * Address lint errors Signed-off-by: Brett Tofel <[email protected]> --------- Signed-off-by: Brett Tofel <[email protected]> * Fix e2e (#843) Signed-off-by: Varsha Prasad Narsing <[email protected]> * Make goreleaser build unpack Signed-off-by: Brett Tofel <[email protected]> * Rm commented code Signed-off-by: Brett Tofel <[email protected]> * Rebase required changes Signed-off-by: Brett Tofel <[email protected]> * Cleanups (#854) Signed-off-by: Varsha Prasad Narsing <[email protected]> * Expand comments in Dockerfile Signed-off-by: Brett Tofel <[email protected]> * Address Reviews Signed-off-by: Varsha Prasad Narsing <[email protected]> * Back out packagerrors It's agreed that this makes debugging and reasoning about log messages and runtime errors much harder. Signed-off-by: Brett Tofel <[email protected]> * Helm POC e2e fixes (#870) Fixes the e2e tests in helm-poc branch and restores feature-gate switching. Signed-off-by: dtfranz <[email protected]> * Fix defer location (#883) Fixes the defer location to make sure that all resources are cleaned up properly. Signed-off-by: dtfranz <[email protected]> * Remove BundleDeployments gathering from e2e's gatherArtifacts (#886) When tests fail, gatherArtifacts is run to collect cluster state. This PR removes gathering of BundleDeployments since we don't use them anymore and it's generating additional misleading error messages. Signed-off-by: dtfranz <[email protected]> * Address reviews (#887) Signed-off-by: Varsha Prasad Narsing <[email protected]> * 🌱 Proposed way to unskip some tests (#874) * Proposed way to unskip some tests TestClusterExtensionChannelVersionExists mostly restored here Signed-off-by: Brett Tofel <[email protected]> * Refactors global variable names Signed-off-by: Brett Tofel <[email protected]> * Removes BundleDeployment related checking In just one test, for now. Signed-off-by: Brett Tofel <[email protected]> * fix unit test - TestClusterExtensionChannelVersionExists * Unskip all - failing tests (up|down)grade should err Unskips all in clusterextension_controller_test.go Signed-off-by: Brett Tofel <[email protected]> * Unskip all clusterextension_registryv1_validation_test.go Still failing tests (up|down)grade should err b/c we don't have an installedBundle to check against Signed-off-by: Brett Tofel <[email protected]> * debugging Signed-off-by: Varsha Prasad Narsing <[email protected]> * Fixes and additions pending & unpack path Signed-off-by: Brett Tofel <[email protected]> * Fix linter, remove debug logs and extraneous file Signed-off-by: dtfranz <[email protected]> * Fix e2e failure due to race condition Signed-off-by: dtfranz <[email protected]> --------- Signed-off-by: Brett Tofel <[email protected]> Signed-off-by: Varsha Prasad Narsing <[email protected]> Signed-off-by: dtfranz <[email protected]> Co-authored-by: Varsha Prasad Narsing <[email protected]> Co-authored-by: dtfranz <[email protected]> * Revert goreleaser to use buildx Signed-off-by: Brett Tofel <[email protected]> * Revert all of goreleaser to use buildx Signed-off-by: Brett Tofel <[email protected]> * Revert errorf->printf & rm some logging in tests Signed-off-by: Brett Tofel <[email protected]> --------- Signed-off-by: dtfranz <[email protected]> Signed-off-by: Brett Tofel <[email protected]> Signed-off-by: Varsha Prasad Narsing <[email protected]> Co-authored-by: Todd Short <[email protected]> Co-authored-by: Daniel Franz <[email protected]> Co-authored-by: Varsha <[email protected]>
1 parent 6060534 commit 0058054

32 files changed

+1996
-1493
lines changed

.github/workflows/tilt.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ jobs:
2222
- uses: actions/checkout@v4
2323
with:
2424
path: operator-controller
25-
- uses: actions/checkout@v4
26-
with:
27-
repository: operator-framework/rukpak
28-
path: rukpak
2925
- uses: actions/checkout@v4
3026
with:
3127
repository: operator-framework/catalogd

.goreleaser.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ builds:
1616
- arm64
1717
- ppc64le
1818
- s390x
19+
- id: unpack
20+
main: ./cmd/unpack/main.go # Update this path to the actual location of your unpack source
21+
binary: bin/unpack
22+
asmflags: "{{ .Env.GO_BUILD_ASMFLAGS }}"
23+
gcflags: "{{ .Env.GO_BUILD_GCFLAGS }}"
24+
ldflags: "{{ .Env.GO_BUILD_LDFLAGS }}"
25+
goos:
26+
- linux
27+
goarch:
28+
- amd64
29+
- arm64
30+
- ppc64le
31+
- s390x
1932
dockers:
2033
- image_templates:
2134
- "{{ .Env.IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-amd64"

CONTRIBUTING.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ The user experience captured in the OLM V1 PRD introduces many requirements that
1919
- [The Operator-Controller project](https://github.com/operator-framework/operator-controller/), which is the top level component allowing users to specify operators they'd like to install.
2020
- [The Catalogd project](https://github.com/operator-framework/catalogd/), which hosts operator content and helps users discover installable content.
2121
- [The Deppy project](https://github.com/operator-framework/deppy/), which enables the operator-controller to identify valid installs and upgrades from the list of installable content provided via the Catalogd project.
22-
- [The RukPak project](https://github.com/operator-framework/rukpak/), which facilitates the installation of operators.
2322

24-
Each of the projects listed above have their own governance, release milestones, and release cadence. However, from a technical perspective, the "OLM V1 experience" matches the experienced offered by the operator-controller project, the top level component which introduces dependencies on RukPak, Deppy, and the Catalogd projects.
23+
Each of the projects listed above have their own governance, release milestones, and release cadence. However, from a technical perspective, the "OLM V1 experience" matches the experienced offered by the operator-controller project, the top level component which introduces dependencies on Deppy and the Catalogd projects.
2524

2625
## How do we collaborate
2726

@@ -62,7 +61,7 @@ Ongoing or previous Operator-Controller milestones can always be found in the [m
6261

6362
### How are Subproject Issues Tracked?
6463

65-
As discussed earlier, the operator-controller adheres to a microservice architecture, where multiple projects contribute to the overall experience. As such, when designing an operator-controller milestone, the community may need to file an issue against RukPak, Deppy, or Catalogd. Unfortunately, the operator-controller milestone cannot contain issues from one of its subprojects. As such, we've introduced the concept of a "Dependency Issue", described below:
64+
As discussed earlier, the operator-controller adheres to a microservice architecture, where multiple projects contribute to the overall experience. As such, when designing an operator-controller milestone, the community may need to file an issue against Deppy or Catalogd. Unfortunately, the operator-controller milestone cannot contain issues from one of its subprojects. As such, we've introduced the concept of a "Dependency Issue", described below:
6665

6766
> Dependency Issues: An issue tracked in a milestone that "points" to an issue in another project with a URL.
6867
@@ -72,7 +71,6 @@ Unsure where to submit an issue?
7271
- [The Operator-Controller project](https://github.com/operator-framework/operator-controller/), which is the top level component allowing users to specify operators they'd like to install.
7372
- [The Catalogd project](https://github.com/operator-framework/catalogd/), which hosts operator content and helps users discover installable content.
7473
- [The Deppy project](https://github.com/operator-framework/deppy/), which enables the operator-controller to identify valid installs and upgrades from the list of installable content provided via the Catalogd project.
75-
- [The RukPak project](https://github.com/operator-framework/rukpak/), which facilitates the installation of operators.
7674

7775
Don't worry if you accidentally submit an issue against the wrong project, if we notice that an issue would fit better with a separate project we'll move it to the correct repository and mention it in the #olm-dev slack channel.
7876

Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
# Note: This dockerfile does not build the binaries
22
# required and is intended to be built only with the
33
# 'make build' or 'make release' targets.
4+
# Stage 1:
5+
FROM gcr.io/distroless/static:debug-nonroot AS builder
6+
7+
# Stage 2:
48
FROM gcr.io/distroless/static:nonroot
59

10+
# Grab the cp binary so we can cp the unpack
11+
# binary to a shared volume in the bundle image (rukpak library needs it)
12+
COPY --from=builder /busybox/cp /cp
13+
614
WORKDIR /
715

816
COPY manager manager
17+
COPY unpack unpack
918

1019
EXPOSE 8080
1120

1221
USER 65532:65532
13-
14-
ENTRYPOINT ["/manager"]

Makefile

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ IMG := $(IMAGE_REPO):$(IMAGE_TAG)
2222
# Define dependency versions (use go.mod if we also use Go code from dependency)
2323
export CERT_MGR_VERSION := v1.9.0
2424
export CATALOGD_VERSION := $(shell go list -mod=mod -m -f "{{.Version}}" github.com/operator-framework/catalogd)
25-
export RUKPAK_VERSION := $(shell go list -mod=mod -m -f "{{.Version}}" github.com/operator-framework/rukpak)
2625
export WAIT_TIMEOUT := 60s
2726

2827
# By default setup-envtest will write to $XDG_DATA_HOME, or $HOME/.local/share if that is not defined.
@@ -165,10 +164,16 @@ e2e-coverage:
165164
kind-load: $(KIND) #EXHELP Loads the currently constructed image onto the cluster.
166165
$(CONTAINER_RUNTIME) save $(IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME)
167166

168-
kind-deploy: export MANIFEST := ./operator-controller.yaml
167+
.PHONY: kind-deploy
168+
kind-deploy: export MANIFEST="./operator-controller.yaml"
169169
kind-deploy: manifests $(KUSTOMIZE) #EXHELP Install controller and dependencies onto the kind cluster.
170170
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) > operator-controller.yaml
171-
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh | bash -s
171+
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$MANIFEST' < scripts/install.tpl.sh | bash -s
172+
173+
.PHONY: kind-redeploy
174+
kind-redeploy: generate docker-build kind-load kind-deploy #EXHELP Redeploy newly built executables
175+
kubectl delete pod -l control-plane=controller-manager -n $(OPERATOR_CONTROLLER_NAMESPACE)
176+
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$MANIFEST' < scripts/install.tpl.sh | bash -s
172177

173178
.PHONY: kind-cluster
174179
kind-cluster: $(KIND) #EXHELP Standup a kind cluster.
@@ -215,22 +220,25 @@ export GO_BUILD_FLAGS :=
215220
export GO_BUILD_LDFLAGS := -s -w \
216221
-X '$(VERSION_PATH).version=$(VERSION)' \
217222

218-
BUILDCMD = go build $(GO_BUILD_FLAGS) -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/manager ./cmd/manager
223+
BINARIES=manager unpack
224+
225+
$(BINARIES):
226+
go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$@ ./cmd/$@
219227

220228
.PHONY: build-deps
221229
build-deps: manifests generate fmt vet
222230

223231
.PHONY: build go-build-local
224232
build: build-deps go-build-local #HELP Build manager binary for current GOOS and GOARCH. Default target.
225233
go-build-local: BUILDBIN := bin
226-
go-build-local:
227-
$(BUILDCMD)
234+
go-build-local: $(BINARIES)
228235

229236
.PHONY: build-linux go-build-linux
230237
build-linux: build-deps go-build-linux #EXHELP Build manager binary for GOOS=linux and local GOARCH.
231238
go-build-linux: BUILDBIN := bin/linux
232-
go-build-linux:
233-
GOOS=linux $(BUILDCMD)
239+
go-build-linux: export GOOS=linux
240+
go-build-linux: export GOARCH=amd64
241+
go-build-linux: $(BINARIES)
234242

235243
.PHONY: run
236244
run: docker-build kind-cluster kind-load kind-deploy #HELP Build the operator-controller then deploy it into a new kind cluster.
@@ -258,7 +266,7 @@ release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By d
258266
quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml
259267
quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the installation release manifests and scripts.
260268
$(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml
261-
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh > install.sh
269+
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$MANIFEST' < scripts/install.tpl.sh > install.sh
262270

263271
##@ Docs
264272

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ OLM v1 is the follow-up to OLM v0, located [here](https://github.com/operator-fr
1717
OLM v1 consists of four different components:
1818
* operator-controller (this repository)
1919
* [deppy](https://github.com/operator-framework/deppy)
20-
* [rukpak](https://github.com/operator-framework/rukpak)
2120
* [catalogd](https://github.com/operator-framework/catalogd)
2221

2322
For a more complete overview of OLM v1 and how it differs from OLM v0, see our [overview](./docs/olmv1_overview.md).
@@ -76,7 +75,7 @@ Install the CRDs and the operator-controller into a new [KIND cluster](https://k
7675
make run
7776
```
7877
This will build a local container image of the operator-controller, create a new KIND cluster and then deploy onto that cluster.
79-
This will also deploy the catalogd, rukpak and cert-manager dependencies.
78+
This will also deploy the catalogd and cert-manager dependencies.
8079

8180
### Modifying the API definitions
8281
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:

Tiltfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ load('../tilt-support/Tiltfile', 'deploy_repo')
55

66
config.define_string_list('repos', args=True)
77
cfg = config.parse()
8-
repos = cfg.get('repos', ['operator-controller', 'rukpak', 'catalogd'])
8+
repos = cfg.get('repos', ['operator-controller', 'catalogd'])
99

1010
repo = {
1111
'image': 'quay.io/operator-framework/operator-controller',

api/v1alpha1/clusterextension_types.go

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ import (
2222
"github.com/operator-framework/operator-controller/internal/conditionsets"
2323
)
2424

25+
var (
26+
ClusterExtensionGVK = SchemeBuilder.GroupVersion.WithKind("ClusterExtension")
27+
ClusterExtensionKind = ClusterExtensionGVK.Kind
28+
)
29+
2530
type UpgradeConstraintPolicy string
2631

2732
const (
@@ -77,47 +82,58 @@ type ClusterExtensionSpec struct {
7782

7883
const (
7984
// TODO(user): add more Types, here and into init()
80-
TypeInstalled = "Installed"
81-
TypeResolved = "Resolved"
85+
TypeInstalled = "Installed"
86+
TypeResolved = "Resolved"
87+
TypeHasValidBundle = "HasValidBundle"
88+
8289
// TypeDeprecated is a rollup condition that is present when
8390
// any of the deprecated conditions are present.
8491
TypeDeprecated = "Deprecated"
8592
TypePackageDeprecated = "PackageDeprecated"
8693
TypeChannelDeprecated = "ChannelDeprecated"
8794
TypeBundleDeprecated = "BundleDeprecated"
95+
TypeUnpacked = "Unpacked"
96+
97+
ReasonErrorGettingClient = "ErrorGettingClient"
98+
ReasonBundleLoadFailed = "BundleLoadFailed"
8899

89-
ReasonBundleLookupFailed = "BundleLookupFailed"
90100
ReasonInstallationFailed = "InstallationFailed"
91101
ReasonInstallationStatusUnknown = "InstallationStatusUnknown"
92102
ReasonInstallationSucceeded = "InstallationSucceeded"
93-
ReasonInvalidSpec = "InvalidSpec"
94103
ReasonResolutionFailed = "ResolutionFailed"
95-
ReasonResolutionUnknown = "ResolutionUnknown"
96-
ReasonSuccess = "Success"
97-
ReasonDeprecated = "Deprecated"
104+
105+
ReasonSuccess = "Success"
106+
ReasonDeprecated = "Deprecated"
107+
ReasonUpgradeFailed = "UpgradeFailed"
108+
ReasonHasValidBundleUnknown = "HasValidBundleUnknown"
109+
ReasonUnpackPending = "UnpackPending"
98110
)
99111

100112
func init() {
101113
// TODO(user): add Types from above
102114
conditionsets.ConditionTypes = append(conditionsets.ConditionTypes,
103115
TypeInstalled,
104116
TypeResolved,
117+
TypeHasValidBundle,
105118
TypeDeprecated,
106119
TypePackageDeprecated,
107120
TypeChannelDeprecated,
108121
TypeBundleDeprecated,
122+
TypeUnpacked,
109123
)
110124
// TODO(user): add Reasons from above
111125
conditionsets.ConditionReasons = append(conditionsets.ConditionReasons,
112126
ReasonInstallationSucceeded,
113127
ReasonResolutionFailed,
114-
ReasonResolutionUnknown,
115-
ReasonBundleLookupFailed,
116128
ReasonInstallationFailed,
117-
ReasonInstallationStatusUnknown,
118-
ReasonInvalidSpec,
119129
ReasonSuccess,
120130
ReasonDeprecated,
131+
ReasonUpgradeFailed,
132+
ReasonBundleLoadFailed,
133+
ReasonErrorGettingClient,
134+
ReasonInstallationStatusUnknown,
135+
ReasonHasValidBundleUnknown,
136+
ReasonUnpackPending,
121137
)
122138
}
123139

@@ -132,7 +148,6 @@ type ClusterExtensionStatus struct {
132148
InstalledBundle *BundleMetadata `json:"installedBundle,omitempty"`
133149
// +optional
134150
ResolvedBundle *BundleMetadata `json:"resolvedBundle,omitempty"`
135-
136151
// +patchMergeKey=type
137152
// +patchStrategy=merge
138153
// +listType=map

0 commit comments

Comments
 (0)