Skip to content

Commit 66a063b

Browse files
⚠️ Bump rukpak (#905)
* Bump rukpak * debugging tests Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com> * Use tar for manifests Signed-off-by: Todd Short <tshort@redhat.com> * fix e2e Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com> * Remove unpack Signed-off-by: Todd Short <tshort@redhat.com> * rebase with main Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com> * Fix webhooks package name and remove unstructured Make the webhooks package name consistent with oterhs Revert the use of unstructured Signed-off-by: Todd Short <tshort@redhat.com> * ext-dev-e2e passes Signed-off-by: Todd Short <tshort@redhat.com> * bump to latest rukpak Signed-off-by: Todd Short <tshort@redhat.com> * review fixups Signed-off-by: Todd Short <tshort@redhat.com> * Additional fixes from reviews Signed-off-by: Todd Short <tshort@redhat.com> * Remove DNS_NAME Signed-off-by: Todd Short <tshort@redhat.com> * Put back InsecureSkipTLSVerify: true for now Signed-off-by: Todd Short <tshort@redhat.com> * Add annotation to set insecureSkipTLSVerify Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com> * Rename back to package-with-webhooks Signed-off-by: Todd Short <tshort@redhat.com> * Used labeled rukpak Signed-off-by: Todd Short <tshort@redhat.com> * Fix error message for unknown unpack state Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com> --------- Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com> Signed-off-by: Todd Short <tshort@redhat.com> Co-authored-by: Todd Short <tshort@redhat.com>
1 parent 5687a69 commit 66a063b

File tree

20 files changed

+389
-253
lines changed

20 files changed

+389
-253
lines changed

.goreleaser.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,6 @@ 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
3219
dockers:
3320
- image_templates:
3421
- "{{ .Env.IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-amd64"

Dockerfile

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
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:
84
FROM gcr.io/distroless/static:nonroot
95

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-
146
WORKDIR /
157

168
COPY manager manager
17-
COPY unpack unpack
189

1910
EXPOSE 8080
2011

Makefile

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ e2e: #EXHELP Run the e2e tests.
122122

123123
E2E_REGISTRY_NAME := docker-registry
124124
E2E_REGISTRY_NAMESPACE := operator-controller-e2e
125+
125126
export REG_PKG_NAME := registry-operator
126-
export CATALOG_IMG := $(E2E_REGISTRY_NAME).$(E2E_REGISTRY_NAMESPACE).svc:5000/test-catalog:e2e
127+
export REGISTRY_ROOT := $(E2E_REGISTRY_NAME).$(E2E_REGISTRY_NAMESPACE).svc:5000
128+
export CATALOG_IMG := $(REGISTRY_ROOT)/test-catalog:e2e
127129
.PHONY: test-ext-dev-e2e
128130
test-ext-dev-e2e: $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run extension create, upgrade and delete tests.
129131
test/extension-developer-e2e/setup.sh $(OPERATOR_SDK) $(CONTAINER_RUNTIME) $(KUSTOMIZE) $(KIND) $(KIND_CLUSTER_NAME) $(E2E_REGISTRY_NAMESPACE)
@@ -150,7 +152,7 @@ build-push-e2e-catalog: ## Build the testdata catalog used for e2e tests and pus
150152
test-e2e: KIND_CLUSTER_NAME := operator-controller-e2e
151153
test-e2e: KUSTOMIZE_BUILD_DIR := config/e2e
152154
test-e2e: GO_BUILD_FLAGS := -cover
153-
test-e2e: run image-registry build-push-e2e-catalog kind-load-test-artifacts e2e e2e-coverage kind-clean #HELP Run e2e test suite on local kind cluster
155+
test-e2e: run image-registry build-push-e2e-catalog registry-load-bundles e2e e2e-coverage kind-clean #HELP Run e2e test suite on local kind cluster
154156

155157
.PHONY: extension-developer-e2e
156158
extension-developer-e2e: KIND_CLUSTER_NAME := operator-controller-ext-dev-e2e #EXHELP Run extension-developer e2e on local kind cluster
@@ -186,19 +188,12 @@ kind-cluster: $(KIND) #EXHELP Standup a kind cluster.
186188
kind-clean: $(KIND) #EXHELP Delete the kind cluster.
187189
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)
188190

189-
.PHONY: kind-load-test-artifacts
190-
kind-load-test-artifacts: $(KIND) #EXHELP Load the e2e testdata container images into a kind cluster.
191-
$(CONTAINER_RUNTIME) build testdata/bundles/registry-v1/prometheus-operator.v1.0.0 -t localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.0
192-
$(CONTAINER_RUNTIME) tag localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.0 localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.1
193-
$(CONTAINER_RUNTIME) tag localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.0 localhost/testdata/bundles/registry-v1/prometheus-operator:v1.2.0
194-
$(CONTAINER_RUNTIME) tag localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.0 localhost/testdata/bundles/registry-v1/prometheus-operator:v2.0.0
195-
$(KIND) load docker-image localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.0 --name $(KIND_CLUSTER_NAME)
196-
$(KIND) load docker-image localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.1 --name $(KIND_CLUSTER_NAME)
197-
$(KIND) load docker-image localhost/testdata/bundles/registry-v1/prometheus-operator:v1.2.0 --name $(KIND_CLUSTER_NAME)
198-
$(KIND) load docker-image localhost/testdata/bundles/registry-v1/prometheus-operator:v2.0.0 --name $(KIND_CLUSTER_NAME)
199-
$(CONTAINER_RUNTIME) build testdata/bundles/registry-v1/package-with-webhooks.v1.0.0 -t localhost/testdata/bundles/registry-v1/package-with-webhooks:v1.0.0
200-
$(KIND) load docker-image localhost/testdata/bundles/registry-v1/package-with-webhooks:v1.0.0 --name $(KIND_CLUSTER_NAME)
201-
191+
registry-load-bundles: ## Load selected e2e testdata container images created in kind-load-bundles into registry
192+
testdata/bundles/registry-v1/build-push-e2e-bundle.sh ${E2E_REGISTRY_NAMESPACE} $(REGISTRY_ROOT)/bundles/registry-v1/prometheus-operator:v1.0.0 prometheus-operator.v1.0.0 prometheus-operator.v1.0.0
193+
testdata/bundles/registry-v1/build-push-e2e-bundle.sh ${E2E_REGISTRY_NAMESPACE} $(REGISTRY_ROOT)/bundles/registry-v1/prometheus-operator:v1.0.1 prometheus-operator.v1.0.1 prometheus-operator.v1.0.0
194+
testdata/bundles/registry-v1/build-push-e2e-bundle.sh ${E2E_REGISTRY_NAMESPACE} $(REGISTRY_ROOT)/bundles/registry-v1/prometheus-operator:v1.2.0 prometheus-operator.v1.2.0 prometheus-operator.v1.0.0
195+
testdata/bundles/registry-v1/build-push-e2e-bundle.sh ${E2E_REGISTRY_NAMESPACE} $(REGISTRY_ROOT)/bundles/registry-v1/prometheus-operator:v2.0.0 prometheus-operator.v2.0.0 prometheus-operator.v1.0.0
196+
testdata/bundles/registry-v1/build-push-e2e-bundle.sh ${E2E_REGISTRY_NAMESPACE} $(REGISTRY_ROOT)/bundles/registry-v1/package-with-webhooks:v1.0.0 package-with-webhooks.v1.0.0 package-with-webhooks.v1.0.0
202197

203198
#SECTION Build
204199

@@ -220,7 +215,7 @@ export GO_BUILD_FLAGS :=
220215
export GO_BUILD_LDFLAGS := -s -w \
221216
-X '$(VERSION_PATH).version=$(VERSION)' \
222217

223-
BINARIES=manager unpack
218+
BINARIES=manager
224219

225220
$(BINARIES):
226221
go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$@ ./cmd/$@

cmd/manager/main.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"net/http"
2424
"net/url"
2525
"os"
26+
"path/filepath"
2627
"time"
2728

2829
"github.com/spf13/pflag"
@@ -33,11 +34,13 @@ import (
3334
ctrl "sigs.k8s.io/controller-runtime"
3435
crcache "sigs.k8s.io/controller-runtime/pkg/cache"
3536
"sigs.k8s.io/controller-runtime/pkg/client"
37+
crfinalizer "sigs.k8s.io/controller-runtime/pkg/finalizer"
3638
"sigs.k8s.io/controller-runtime/pkg/healthz"
3739
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3840
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
3941

4042
helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
43+
"github.com/operator-framework/rukpak/pkg/finalizer"
4144
"github.com/operator-framework/rukpak/pkg/source"
4245
"github.com/operator-framework/rukpak/pkg/storage"
4346

@@ -54,7 +57,6 @@ import (
5457

5558
var (
5659
setupLog = ctrl.Log.WithName("setup")
57-
defaultUnpackImage = "quay.io/operator-framework/operator-controller:latest"
5860
defaultSystemNamespace = "operator-controller-system"
5961
)
6062

@@ -78,7 +80,6 @@ func main() {
7880
cachePath string
7981
operatorControllerVersion bool
8082
systemNamespace string
81-
unpackImage string
8283
provisionerStorageDirectory string
8384
)
8485
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
@@ -89,7 +90,6 @@ func main() {
8990
flag.StringVar(&cachePath, "cache-path", "/var/cache", "The local directory path used for filesystem based caching")
9091
flag.BoolVar(&operatorControllerVersion, "version", false, "Prints operator-controller version information")
9192
flag.StringVar(&systemNamespace, "system-namespace", "", "Configures the namespace that gets used to deploy system resources.")
92-
flag.StringVar(&unpackImage, "unpack-image", defaultUnpackImage, "Configures the container image that gets used to unpack Bundle contents.")
9393
flag.StringVar(&provisionerStorageDirectory, "provisioner-storage-dir", storage.DefaultBundleCacheDir, "The directory that is used to store bundle contents.")
9494
opts := zap.Options{
9595
Development: true,
@@ -169,17 +169,28 @@ func main() {
169169
os.Exit(1)
170170
}
171171

172-
unpacker, err := source.NewDefaultUnpacker(mgr, systemNamespace, unpackImage, (*x509.CertPool)(nil))
172+
bundleFinalizers := crfinalizer.NewFinalizers()
173+
unpacker, err := source.NewDefaultUnpacker(mgr, systemNamespace, filepath.Join(cachePath, "unpack"), (*x509.CertPool)(nil))
173174
if err != nil {
174175
setupLog.Error(err, "unable to create unpacker")
175176
os.Exit(1)
176177
}
177178

179+
if err := bundleFinalizers.Register(finalizer.CleanupUnpackCacheKey, &finalizer.CleanupUnpackCache{Unpacker: unpacker}); err != nil {
180+
setupLog.Error(err, "unable to register finalizer", "finalizerKey", finalizer.CleanupUnpackCacheKey)
181+
os.Exit(1)
182+
}
183+
178184
localStorage := &storage.LocalDirectory{
179185
RootDirectory: provisionerStorageDirectory,
180186
URL: url.URL{},
181187
}
182188

189+
if err := bundleFinalizers.Register(finalizer.DeleteCachedBundleKey, &finalizer.DeleteCachedBundle{Storage: localStorage}); err != nil {
190+
setupLog.Error(err, "unable to register finalizer", "finalizerKey", finalizer.DeleteCachedBundleKey)
191+
os.Exit(1)
192+
}
193+
183194
if err = (&controllers.ClusterExtensionReconciler{
184195
Client: cl,
185196
ReleaseNamespace: systemNamespace,
@@ -205,7 +216,8 @@ func main() {
205216
}
206217

207218
setupLog.Info("starting manager")
208-
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
219+
ctx := ctrl.SetupSignalHandler()
220+
if err := mgr.Start(ctx); err != nil {
209221
setupLog.Error(err, "problem running manager")
210222
os.Exit(1)
211223
}

cmd/unpack/main.go

Lines changed: 0 additions & 122 deletions
This file was deleted.

config/manager/kustomization.yaml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,4 @@ kind: Kustomization
55
images:
66
- name: controller
77
newName: quay.io/operator-framework/operator-controller
8-
newTag: devel
9-
replacements:
10-
- source: # replaces UNPACK_IMAGE in manager.yaml with image set by kustomize above
11-
kind: Deployment
12-
group: apps
13-
version: v1
14-
name: controller-manager
15-
namespace: system
16-
fieldPath: spec.template.spec.containers.[name=manager].image
17-
targets:
18-
- select:
19-
kind: Deployment
20-
group: apps
21-
version: v1
22-
name: controller-manager
23-
namespace: system
24-
fieldPaths:
25-
- spec.template.spec.containers.[name=manager].args.0
26-
options:
27-
delimiter: "="
28-
index: 1
8+
newTag: devel

config/manager/manager.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ spec:
5252
- command:
5353
- /manager
5454
args:
55-
# The unpack-image arg must remain at index 0 for the kustomize replacement to work
56-
- "--unpack-image=UNPACK_IMAGE"
5755
- "--health-probe-bind-address=:8081"
5856
- "--metrics-bind-address=127.0.0.1:8080"
5957
- "--leader-elect"

0 commit comments

Comments
 (0)