Skip to content

Commit

Permalink
⚠️ Bump rukpak (#905)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
varshaprasad96 and tmshort committed Jun 12, 2024
1 parent 5687a69 commit 66a063b
Show file tree
Hide file tree
Showing 20 changed files with 389 additions and 253 deletions.
13 changes: 0 additions & 13 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ builds:
- arm64
- ppc64le
- s390x
- id: unpack
main: ./cmd/unpack/main.go # Update this path to the actual location of your unpack source
binary: bin/unpack
asmflags: "{{ .Env.GO_BUILD_ASMFLAGS }}"
gcflags: "{{ .Env.GO_BUILD_GCFLAGS }}"
ldflags: "{{ .Env.GO_BUILD_LDFLAGS }}"
goos:
- linux
goarch:
- amd64
- arm64
- ppc64le
- s390x
dockers:
- image_templates:
- "{{ .Env.IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}-amd64"
Expand Down
9 changes: 0 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
# Note: This dockerfile does not build the binaries
# required and is intended to be built only with the
# 'make build' or 'make release' targets.
# Stage 1:
FROM gcr.io/distroless/static:debug-nonroot AS builder

# Stage 2:
FROM gcr.io/distroless/static:nonroot

# Grab the cp binary so we can cp the unpack
# binary to a shared volume in the bundle image (rukpak library needs it)
COPY --from=builder /busybox/cp /cp

WORKDIR /

COPY manager manager
COPY unpack unpack

EXPOSE 8080

Expand Down
27 changes: 11 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ e2e: #EXHELP Run the e2e tests.

E2E_REGISTRY_NAME := docker-registry
E2E_REGISTRY_NAMESPACE := operator-controller-e2e

export REG_PKG_NAME := registry-operator
export CATALOG_IMG := $(E2E_REGISTRY_NAME).$(E2E_REGISTRY_NAMESPACE).svc:5000/test-catalog:e2e
export REGISTRY_ROOT := $(E2E_REGISTRY_NAME).$(E2E_REGISTRY_NAMESPACE).svc:5000
export CATALOG_IMG := $(REGISTRY_ROOT)/test-catalog:e2e
.PHONY: test-ext-dev-e2e
test-ext-dev-e2e: $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run extension create, upgrade and delete tests.
test/extension-developer-e2e/setup.sh $(OPERATOR_SDK) $(CONTAINER_RUNTIME) $(KUSTOMIZE) $(KIND) $(KIND_CLUSTER_NAME) $(E2E_REGISTRY_NAMESPACE)
Expand All @@ -150,7 +152,7 @@ build-push-e2e-catalog: ## Build the testdata catalog used for e2e tests and pus
test-e2e: KIND_CLUSTER_NAME := operator-controller-e2e
test-e2e: KUSTOMIZE_BUILD_DIR := config/e2e
test-e2e: GO_BUILD_FLAGS := -cover
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
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

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

.PHONY: kind-load-test-artifacts
kind-load-test-artifacts: $(KIND) #EXHELP Load the e2e testdata container images into a kind cluster.
$(CONTAINER_RUNTIME) build testdata/bundles/registry-v1/prometheus-operator.v1.0.0 -t localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.0
$(CONTAINER_RUNTIME) tag localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.0 localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.1
$(CONTAINER_RUNTIME) tag localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.0 localhost/testdata/bundles/registry-v1/prometheus-operator:v1.2.0
$(CONTAINER_RUNTIME) tag localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.0 localhost/testdata/bundles/registry-v1/prometheus-operator:v2.0.0
$(KIND) load docker-image localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.0 --name $(KIND_CLUSTER_NAME)
$(KIND) load docker-image localhost/testdata/bundles/registry-v1/prometheus-operator:v1.0.1 --name $(KIND_CLUSTER_NAME)
$(KIND) load docker-image localhost/testdata/bundles/registry-v1/prometheus-operator:v1.2.0 --name $(KIND_CLUSTER_NAME)
$(KIND) load docker-image localhost/testdata/bundles/registry-v1/prometheus-operator:v2.0.0 --name $(KIND_CLUSTER_NAME)
$(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
$(KIND) load docker-image localhost/testdata/bundles/registry-v1/package-with-webhooks:v1.0.0 --name $(KIND_CLUSTER_NAME)

registry-load-bundles: ## Load selected e2e testdata container images created in kind-load-bundles into registry
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
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
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
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
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

#SECTION Build

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

BINARIES=manager unpack
BINARIES=manager

$(BINARIES):
go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$@ ./cmd/$@
Expand Down
22 changes: 17 additions & 5 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"net/http"
"net/url"
"os"
"path/filepath"
"time"

"github.com/spf13/pflag"
Expand All @@ -33,11 +34,13 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
crcache "sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
crfinalizer "sigs.k8s.io/controller-runtime/pkg/finalizer"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/metrics/server"

helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
"github.com/operator-framework/rukpak/pkg/finalizer"
"github.com/operator-framework/rukpak/pkg/source"
"github.com/operator-framework/rukpak/pkg/storage"

Expand All @@ -54,7 +57,6 @@ import (

var (
setupLog = ctrl.Log.WithName("setup")
defaultUnpackImage = "quay.io/operator-framework/operator-controller:latest"
defaultSystemNamespace = "operator-controller-system"
)

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

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

if err := bundleFinalizers.Register(finalizer.CleanupUnpackCacheKey, &finalizer.CleanupUnpackCache{Unpacker: unpacker}); err != nil {
setupLog.Error(err, "unable to register finalizer", "finalizerKey", finalizer.CleanupUnpackCacheKey)
os.Exit(1)
}

localStorage := &storage.LocalDirectory{
RootDirectory: provisionerStorageDirectory,
URL: url.URL{},
}

if err := bundleFinalizers.Register(finalizer.DeleteCachedBundleKey, &finalizer.DeleteCachedBundle{Storage: localStorage}); err != nil {
setupLog.Error(err, "unable to register finalizer", "finalizerKey", finalizer.DeleteCachedBundleKey)
os.Exit(1)
}

if err = (&controllers.ClusterExtensionReconciler{
Client: cl,
ReleaseNamespace: systemNamespace,
Expand All @@ -205,7 +216,8 @@ func main() {
}

setupLog.Info("starting manager")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
ctx := ctrl.SetupSignalHandler()
if err := mgr.Start(ctx); err != nil {
setupLog.Error(err, "problem running manager")
os.Exit(1)
}
Expand Down
122 changes: 0 additions & 122 deletions cmd/unpack/main.go

This file was deleted.

22 changes: 1 addition & 21 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,4 @@ kind: Kustomization
images:
- name: controller
newName: quay.io/operator-framework/operator-controller
newTag: devel
replacements:
- source: # replaces UNPACK_IMAGE in manager.yaml with image set by kustomize above
kind: Deployment
group: apps
version: v1
name: controller-manager
namespace: system
fieldPath: spec.template.spec.containers.[name=manager].image
targets:
- select:
kind: Deployment
group: apps
version: v1
name: controller-manager
namespace: system
fieldPaths:
- spec.template.spec.containers.[name=manager].args.0
options:
delimiter: "="
index: 1
newTag: devel
2 changes: 0 additions & 2 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ spec:
- command:
- /manager
args:
# The unpack-image arg must remain at index 0 for the kustomize replacement to work
- "--unpack-image=UNPACK_IMAGE"
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
Expand Down
Loading

0 comments on commit 66a063b

Please sign in to comment.