From 3c55b144959833dbb332122a9435a63e1bc2b8d9 Mon Sep 17 00:00:00 2001 From: Anik Bhattacharjee Date: Wed, 26 Jul 2023 16:47:26 -0400 Subject: [PATCH 01/11] Publish /docs to github pages (#265) Closes #291 Signed-off-by: Anik --- .github/workflows/pages.yaml | 24 ++++ .gitignore | 2 + docs/Tasks/adding-a-catalog.md | 85 ++++++++++++++ docs/Tasks/deleting-an-operator.md | 21 ++++ docs/Tasks/explore-available-packages.md | 142 +++++++++++++++++++++++ docs/Tasks/installing-an-operator.md | 69 +++++++++++ docs/components.md | 12 ++ docs/index.md | 35 ++++++ docs/olmv1_roadmap.md | 27 +---- mkdocs.yml | 8 ++ 10 files changed, 404 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/pages.yaml create mode 100644 docs/Tasks/adding-a-catalog.md create mode 100644 docs/Tasks/deleting-an-operator.md create mode 100644 docs/Tasks/explore-available-packages.md create mode 100644 docs/Tasks/installing-an-operator.md create mode 100644 docs/components.md create mode 100644 docs/index.md create mode 100644 mkdocs.yml diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml new file mode 100644 index 000000000..8436fe4da --- /dev/null +++ b/.github/workflows/pages.yaml @@ -0,0 +1,24 @@ +name: Deploy Documentation site +on: + push: + branches: + - main +permissions: + contents: write +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v3 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - run: pip install mkdocs-material + - run: mkdocs gh-deploy --force \ No newline at end of file diff --git a/.gitignore b/.gitignore index ecfd7f0f4..d6b142bfe 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ install.sh \#*\# .\#* +# documentation website asset folder +docs/_site \ No newline at end of file diff --git a/docs/Tasks/adding-a-catalog.md b/docs/Tasks/adding-a-catalog.md new file mode 100644 index 000000000..56235c404 --- /dev/null +++ b/docs/Tasks/adding-a-catalog.md @@ -0,0 +1,85 @@ +--- +layout: default +title: Adding a catalog of operators to the cluster +nav_order: 1 +parent: Tasks +--- + +Operator authors have the mechanisms to offer their product as part of a curated catalog of operators, that they can push updates to over-the-air (eg publish new versions, publish patched versions with CVEs, etc). Cluster admins can sign up to receive these updates on clusters, by adding the catalog to the cluster. When a catalog is added to a cluster, the kubernetes extension packages (operators, or any other extension package) in that catalog become available on cluster for installation and receiving updates. + +For example, the [k8s-operatorhub/community-operators](https://github.com/k8s-operatorhub/community-operators) is a catalog of curated operators that contains a list of operators being developed by the community. The list of operators can be viewed in [Operatorhub.io](https://operatorhub.io). This catalog is distributed as an image [quay.io/operatorhubio/catalog](https://quay.io/repository/operatorhubio/catalog?tag=latest&tab=tags) for consumption on clusters. + +To consume this catalog on cluster, create a `Catalog` Custom Resource(CR) with the image specified in the `spec.source.image` field: + +```bash +$ kubectl apply -f - < Date: Mon, 3 Jul 2023 09:59:46 +0100 Subject: [PATCH 02/11] Adds GO_BUILD_FLAGS param into build targets It will be used to optional flags such as -cover. Signed-off-by: Mikalai Radchuk --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 651640574..ed615c694 100644 --- a/Makefile +++ b/Makefile @@ -131,8 +131,9 @@ export GO_BUILD_ASMFLAGS ?= all=-trimpath=${PWD} export GO_BUILD_LDFLAGS ?= -s -w -X $(shell go list -m)/version.Version=$(VERSION) export GO_BUILD_GCFLAGS ?= all=-trimpath=${PWD} export GO_BUILD_TAGS ?= upstream +export GO_BUILD_FLAGS ?= -BUILDCMD = go build -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/manager ./cmd/manager +BUILDCMD = go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/manager ./cmd/manager .PHONY: build-deps build-deps: manifests generate fmt vet From 669c45157322368c2176a89b70a5285a70471223 Mon Sep 17 00:00:00 2001 From: Mikalai Radchuk Date: Mon, 3 Jul 2023 11:48:51 +0100 Subject: [PATCH 03/11] Adds E2E coverage reporting Signed-off-by: Mikalai Radchuk --- .github/workflows/e2e.yaml | 15 +++++++- .github/workflows/unit-test.yaml | 1 + .gitignore | 5 +-- Makefile | 19 +++++++--- config/e2e/kustomization.yaml | 9 +++++ config/e2e/manager_e2e_coverage_copy_pod.yaml | 36 +++++++++++++++++++ config/e2e/manager_e2e_coverage_patch.yaml | 21 +++++++++++ config/e2e/manager_e2e_coverage_pvc.yaml | 10 ++++++ hack/e2e-coverage.sh | 33 +++++++++++++++++ 9 files changed, 141 insertions(+), 8 deletions(-) create mode 100644 config/e2e/kustomization.yaml create mode 100644 config/e2e/manager_e2e_coverage_copy_pod.yaml create mode 100644 config/e2e/manager_e2e_coverage_patch.yaml create mode 100644 config/e2e/manager_e2e_coverage_pvc.yaml create mode 100755 hack/e2e-coverage.sh diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index d562d21fd..e92cdaf9c 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -22,4 +22,17 @@ jobs: - name: Run e2e tests run: | - make e2e + # By default make stops building on first non-zero exit code which + # in case of E2E tests will mean that code coverage will only be + # collected on successful runs. We want to collect coverage even + # after failing tests. + # With -k flag make will continue the build, but will return non-zero + # exit code in case of any errors. + make -k e2e + + - uses: codecov/codecov-action@v3 + with: + files: e2e-cover.out + flags: e2e + fail_ci_if_error: true + functionalities: fixes diff --git a/.github/workflows/unit-test.yaml b/.github/workflows/unit-test.yaml index a169f2960..bba7222ab 100644 --- a/.github/workflows/unit-test.yaml +++ b/.github/workflows/unit-test.yaml @@ -25,5 +25,6 @@ jobs: - uses: codecov/codecov-action@v3 with: files: cover.out + flags: unit fail_ci_if_error: true functionalities: fixes diff --git a/.gitignore b/.gitignore index d6b142bfe..10817bcdf 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,9 @@ Dockerfile.cross # Test binary, build with `go test -c` *.test -# Output of the go coverage tool, specifically when used with LiteIDE +# Output of the go coverage tools *.out +coverage # Release output dist/** @@ -35,4 +36,4 @@ install.sh .\#* # documentation website asset folder -docs/_site \ No newline at end of file +docs/_site diff --git a/Makefile b/Makefile index ed615c694..364a91439 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,8 @@ KIND_CLUSTER_NAME ?= operator-controller CONTAINER_RUNTIME ?= docker +KUSTOMIZE_BUILD_DIR ?= config/default + # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) GOBIN=$(shell go env GOPATH)/bin @@ -103,7 +105,13 @@ test-unit: $(SETUP_ENVTEST) ## Run the unit tests eval $$($(SETUP_ENVTEST) use -p env $(ENVTEST_VERSION)) && go test -tags $(GO_BUILD_TAGS) -count=1 -short $(UNIT_TEST_DIRS) -coverprofile cover.out e2e: KIND_CLUSTER_NAME=operator-controller-e2e -e2e: run kind-load-test-artifacts test-e2e kind-cluster-cleanup ## Run e2e test suite on local kind cluster +e2e: KUSTOMIZE_BUILD_DIR=config/e2e +e2e: GO_BUILD_FLAGS=-cover +e2e: run kind-load-test-artifacts test-e2e e2e-coverage kind-cluster-cleanup ## Run e2e test suite on local kind cluster + +.PHONY: e2e-coverage +e2e-coverage: + COVERAGE_OUTPUT=./e2e-cover.out ./hack/e2e-coverage.sh kind-load: $(KIND) ## Loads the currently constructed image onto the cluster $(KIND) load docker-image $(IMG) --name $(KIND_CLUSTER_NAME) @@ -115,6 +123,7 @@ kind-cluster: $(KIND) kind-cluster-cleanup ## Standup a kind cluster kind-cluster-cleanup: $(KIND) ## Delete the kind cluster $(KIND) delete cluster --name ${KIND_CLUSTER_NAME} +.PHONY: kind-load-test-artifacts kind-load-test-artifacts: $(KIND) ## Load the e2e testdata container images into a kind cluster $(CONTAINER_RUNTIME) build $(TESTDATA_DIR)/bundles/registry-v1/prometheus-operator.v0.47.0 -t localhost/testdata/bundles/registry-v1/prometheus-operator:v0.47.0 $(CONTAINER_RUNTIME) build $(TESTDATA_DIR)/bundles/plain-v0/plain.v0.1.0 -t localhost/testdata/bundles/plain-v0/plain:v0.1.0 @@ -174,7 +183,7 @@ release: $(GORELEASER) ## Runs goreleaser for the operator-controller. By defaul quickstart: export MANIFEST="https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml" quickstart: $(KUSTOMIZE) generate ## Generate the installation release manifests and scripts - $(KUSTOMIZE) build config/default | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml + $(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh > install.sh ##@ Deployment @@ -186,7 +195,7 @@ endif .PHONY: install install: export MANIFEST="./operator-controller.yaml" install: manifests $(KUSTOMIZE) generate ## Install CRDs into the K8s cluster specified in ~/.kube/config. - $(KUSTOMIZE) build config/default > operator-controller.yaml + $(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) > operator-controller.yaml envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh | bash -s .PHONY: uninstall @@ -196,8 +205,8 @@ uninstall: manifests $(KUSTOMIZE) ## Uninstall CRDs from the K8s cluster specifi .PHONY: deploy deploy: manifests $(KUSTOMIZE) ## Deploy controller to the K8s cluster specified in ~/.kube/config. cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/default | kubectl apply -f - + $(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | kubectl apply -f - .PHONY: undeploy undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f - + $(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | kubectl delete --ignore-not-found=$(ignore-not-found) -f - diff --git a/config/e2e/kustomization.yaml b/config/e2e/kustomization.yaml new file mode 100644 index 000000000..7d0ba86c5 --- /dev/null +++ b/config/e2e/kustomization.yaml @@ -0,0 +1,9 @@ +namespace: operator-controller-system + +resources: +- ../default +- manager_e2e_coverage_pvc.yaml +- manager_e2e_coverage_copy_pod.yaml + +patches: +- path: manager_e2e_coverage_patch.yaml diff --git a/config/e2e/manager_e2e_coverage_copy_pod.yaml b/config/e2e/manager_e2e_coverage_copy_pod.yaml new file mode 100644 index 000000000..45139d062 --- /dev/null +++ b/config/e2e/manager_e2e_coverage_copy_pod.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +kind: Pod +metadata: + name: e2e-coverage-copy-pod + labels: + app.kubernetes.io/name: e2e-coverage-copy-pod + app.kubernetes.io/instance: controller-manager + app.kubernetes.io/component: e2e-coverage + app.kubernetes.io/created-by: operator-controller + app.kubernetes.io/part-of: operator-controller + app.kubernetes.io/managed-by: kustomize +spec: + restartPolicy: Never + securityContext: + runAsNonRoot: true + runAsUser: 65532 + seccompProfile: + type: RuntimeDefault + containers: + - name: tar + image: busybox:1.36 + command: ["sleep", "infinity"] + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - "ALL" + volumeMounts: + - name: e2e-coverage-volume + mountPath: /e2e-coverage + readOnly: true + volumes: + - name: e2e-coverage-volume + persistentVolumeClaim: + claimName: e2e-coverage + readOnly: true diff --git a/config/e2e/manager_e2e_coverage_patch.yaml b/config/e2e/manager_e2e_coverage_patch.yaml new file mode 100644 index 000000000..bda011daf --- /dev/null +++ b/config/e2e/manager_e2e_coverage_patch.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: controller-manager + namespace: system +spec: + template: + spec: + containers: + - name: kube-rbac-proxy + - name: manager + env: + - name: GOCOVERDIR + value: /e2e-coverage + volumeMounts: + - name: e2e-coverage-volume + mountPath: /e2e-coverage + volumes: + - name: e2e-coverage-volume + persistentVolumeClaim: + claimName: e2e-coverage diff --git a/config/e2e/manager_e2e_coverage_pvc.yaml b/config/e2e/manager_e2e_coverage_pvc.yaml new file mode 100644 index 000000000..126d4d4e6 --- /dev/null +++ b/config/e2e/manager_e2e_coverage_pvc.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: e2e-coverage +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 64Mi diff --git a/hack/e2e-coverage.sh b/hack/e2e-coverage.sh new file mode 100755 index 000000000..4b24bfe33 --- /dev/null +++ b/hack/e2e-coverage.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -euo pipefail + +COVERAGE_OUTPUT="${COVERAGE_OUTPUT:-e2e-cover.out}" + +OPERATOR_CONTROLLER_NAMESPACE="operator-controller-system" +OPERATOR_CONTROLLER_MANAGER_DEPLOYMENT_NAME="operator-controller-controller-manager" +COPY_POD_NAME="e2e-coverage-copy-pod" + +# Create a temporary directory for coverage +COVERAGE_DIR=$(mktemp -d) + +# Trap to cleanup temporary directory on script exit +function cleanup { + rm -rf "$COVERAGE_DIR" +} +trap cleanup EXIT + +# Coverage-instrumented binary produces coverage on termination, +# so we scale down the manager before gathering the coverage +kubectl -n "$OPERATOR_CONTROLLER_NAMESPACE" scale deployment/"$OPERATOR_CONTROLLER_MANAGER_DEPLOYMENT_NAME" --replicas=0 + +# Wait for the copy pod to be ready +kubectl -n "$OPERATOR_CONTROLLER_NAMESPACE" wait --for=condition=ready pod "$COPY_POD_NAME" + +# Copy the coverage data from the temporary pod +kubectl -n "$OPERATOR_CONTROLLER_NAMESPACE" cp "$COPY_POD_NAME":/e2e-coverage/ "$COVERAGE_DIR" + +# Convert binary coverage data files into the textual format +go tool covdata textfmt -i "$COVERAGE_DIR" -o "$COVERAGE_OUTPUT" + +echo "Coverage report generated successfully at: $COVERAGE_OUTPUT" From cf47583fbb271e377cd837462f957d62f99decf4 Mon Sep 17 00:00:00 2001 From: Mikalai Radchuk Date: Thu, 27 Jul 2023 16:07:00 +0100 Subject: [PATCH 04/11] Fixes kind cluster cleanup in `e2e` make target Currently we have `kind-cluster-cleanup` as a dependency in `kind-cluster` target. Since `make` only builds a target once this means that `e2e` target performs cleanup before creating a new cluster and skips cleanup at the end leaving cluster hanging around. With this change, `make e2e` will be failing on cluster creation, if a cluster with the same name already exists, but the failure message will clearly indicate the issue. Signed-off-by: Mikalai Radchuk --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 364a91439..09303e755 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,7 @@ e2e-coverage: kind-load: $(KIND) ## Loads the currently constructed image onto the cluster $(KIND) load docker-image $(IMG) --name $(KIND_CLUSTER_NAME) -kind-cluster: $(KIND) kind-cluster-cleanup ## Standup a kind cluster +kind-cluster: $(KIND) ## Standup a kind cluster $(KIND) create cluster --name ${KIND_CLUSTER_NAME} $(KIND) export kubeconfig --name ${KIND_CLUSTER_NAME} From b5e9abf6dd8d8d00fb98534cbeeb45750ab0cf01 Mon Sep 17 00:00:00 2001 From: Andy Goldstein Date: Tue, 25 Jul 2023 14:01:13 -0400 Subject: [PATCH 05/11] Add initial Tilt support Signed-off-by: Andy Goldstein --- .gitignore | 2 ++ Tiltfile | 66 +++++++++++++++++++++++++++++++++++++++++++ tilt.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 Tiltfile create mode 100644 tilt.md diff --git a/.gitignore b/.gitignore index 10817bcdf..498367fda 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,5 @@ install.sh # documentation website asset folder docs/_site + +.tiltbuild/ diff --git a/Tiltfile b/Tiltfile new file mode 100644 index 000000000..12b931d62 --- /dev/null +++ b/Tiltfile @@ -0,0 +1,66 @@ +# This loads a helper function that isn't part of core Tilt that simplifies restarting the process in the container +# when files changes. +load('ext://restart_process', 'docker_build_with_restart') + +# Treat the main binary as a local resource, so we can automatically rebuild it when any of the deps change. This +# builds it locally, targeting linux, so it can run in a linux container. +local_resource( + 'manager_binary', + cmd=''' +mkdir -p .tiltbuild/bin +CGO_ENABLED=0 GOOS=linux go build -o .tiltbuild/bin/manager ./cmd/manager +''', + deps=['api', 'cmd/manager', 'internal', 'pkg', 'go.mod', 'go.sum'] +) + +# Configure our image build. If the file in live_update.sync (.tiltbuild/bin/manager) changes, Tilt +# copies it to the running container and restarts it. +docker_build_with_restart( + # This has to match an image in the k8s_yaml we call below, so Tilt knows to use this image for our Deployment, + # instead of the actual image specified in the yaml. + ref='quay.io/operator-framework/operator-controller:devel', + # This is the `docker build` context, and because we're only copying in the binary we've already had Tilt build + # locally, we set the context to the directory containing the binary. + context='.tiltbuild/bin', + # We use a slimmed-down Dockerfile that only has $binary in it. + dockerfile_contents=''' +FROM gcr.io/distroless/static:debug +EXPOSE 8080 +WORKDIR / +COPY manager manager +''', + # The set of files Tilt should include in the build. In this case, it's just the binary we built above. + only='manager', + # If .tiltbuild/bin/manager changes, Tilt will copy it into the running container and restart the process. + live_update=[ + sync('.tiltbuild/bin/manager', '/manager'), + ], + # The command to run in the container. + entrypoint="/manager", +) + +# Tell Tilt what to deploy by running kustomize and then doing some manipulation to make things work for Tilt. +objects = decode_yaml_stream(kustomize('config/default')) +for o in objects: + # For Tilt's live_update functionality to work, we have to run the container as root. Remove any PSA labels to allow + # this. + if o['kind'] == 'Namespace' and 'labels' in o['metadata']: + labels_to_delete = [label for label in o['metadata']['labels'] if label.startswith('pod-security.kubernetes.io')] + for label in labels_to_delete: + o['metadata']['labels'].pop(label) + + if o['kind'] != 'Deployment': + # We only need to modify Deployments, so we can skip this + continue + + # For Tilt's live_update functionality to work, we have to run the container as root. Otherwise, Tilt won't + # be able to untar the updated binary in the container's file system (this is how live update + # works). If there are any securityContexts, remove them. + if "securityContext" in o['spec']['template']['spec']: + o['spec']['template']['spec'].pop('securityContext') + for c in o['spec']['template']['spec']['containers']: + if "securityContext" in c: + c.pop('securityContext') + +# Now apply all the yaml +k8s_yaml(encode_yaml_stream(objects)) diff --git a/tilt.md b/tilt.md new file mode 100644 index 000000000..f9635d076 --- /dev/null +++ b/tilt.md @@ -0,0 +1,82 @@ +# Rapid iterative development with Tilt + +[Tilt](https://tilt.dev) is a tool that enables rapid iterative development of containerized workloads. + +Here is an example workflow without Tilt for modifying some source code and testing those changes in a cluster: + +1. Modify the source code. +2. Build the container image. +3. Either push the image to a registry or load it into your kind cluster. +4. Deploy all the appropriate Kubernetes manifests for your application. + 1. Or, if this is an update, you'd instead scale the Deployment to 0 replicas, scale back to 1, and wait for the + new pod to be running. + +This process can take minutes, depending on how long each step takes. + +Here is the same workflow with Tilt: + +1. Run `tilt up` +2. Modify the source code +3. Wait for Tilt to update the container with your changes + +This ends up taking a fraction of the time, sometimes on the order of a few seconds! + +## Installing Tilt + +Follow Tilt's [instructions](https://docs.tilt.dev/install.html) for installation. + +## Installing rukpak and catalogd + +operator-controller requires [rukpak](https://github.com/operator-framework/rukpak) and +[catalogd](https://github.com/operator-framework/catalogd). Please make sure they're installed, either normally or via +their own Tiltfiles, before proceeding. If you want to use Tilt, make sure you specify a unique `--port` flag to each +`tilt up` invocation. + +## Starting Tilt + +This is typically as short as: + +```shell +tilt up +``` + +**NOTE:** if you are using Podman, at least as of v4.5.1, you need to do this: + +```shell +DOCKER_BUILDKIT=0 tilt up +``` + +Otherwise, you'll see an error when Tilt tries to build your image that looks similar to: + +```text +Build Failed: ImageBuild: stat /var/tmp/libpod_builder2384046170/build/Dockerfile: no such file or directory +``` + +When Tilt starts, you'll see something like this in your terminal: + +```text +Tilt started on http://localhost:10350/ +v0.33.1, built 2023-06-28 + +(space) to open the browser +(s) to stream logs (--stream=true) +(t) to open legacy terminal mode (--legacy=true) +(ctrl-c) to exit +``` + +Typically, you'll want to press the space bar to have it open the UI in your web browser. + +Shortly after starting, Tilt processes the `Tiltfile`, resulting in: + +- Building the go binaries +- Building the images +- Loading the images into kind +- Running kustomize and applying everything except the Deployments that reference the images above +- Modifying the Deployments to use the just-built images +- Creating the Deployments + +## Making code changes + +Any time you change any of the files listed in the `deps` section in the `_binary` `local_resource`, +Tilt automatically rebuilds the go binary. As soon as the binary is rebuilt, Tilt pushes it (and only it) into the +appropriate running container, and then restarts the process. From 14c9a3d41bd373dd92e283a4ef9e2c46d0b962d3 Mon Sep 17 00:00:00 2001 From: Mikalai Radchuk Date: Fri, 28 Jul 2023 16:07:44 +0100 Subject: [PATCH 06/11] Makes codecov-action optional We do not want to fail the job if codecov fails to upload the report due to rate limiting. Signed-off-by: Mikalai Radchuk --- .github/workflows/e2e.yaml | 1 - .github/workflows/unit-test.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index e92cdaf9c..31adc3fb2 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -34,5 +34,4 @@ jobs: with: files: e2e-cover.out flags: e2e - fail_ci_if_error: true functionalities: fixes diff --git a/.github/workflows/unit-test.yaml b/.github/workflows/unit-test.yaml index bba7222ab..8a37190e8 100644 --- a/.github/workflows/unit-test.yaml +++ b/.github/workflows/unit-test.yaml @@ -26,5 +26,4 @@ jobs: with: files: cover.out flags: unit - fail_ci_if_error: true functionalities: fixes From 0be95ca0865f2c0dc8b2eaf1798ba282b219f526 Mon Sep 17 00:00:00 2001 From: Andy Goldstein Date: Fri, 28 Jul 2023 12:53:42 -0400 Subject: [PATCH 07/11] Enable merge_group events Signed-off-by: Andy Goldstein --- .github/workflows/e2e.yaml | 1 + .github/workflows/go-apidiff.yaml | 4 +++- .github/workflows/release.yaml | 1 + .github/workflows/sanity.yaml | 1 + .github/workflows/unit-test.yaml | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 31adc3fb2..6aaa95983 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -3,6 +3,7 @@ name: e2e on: workflow_dispatch: pull_request: + merge_group: push: branches: - main diff --git a/.github/workflows/go-apidiff.yaml b/.github/workflows/go-apidiff.yaml index 8b0741bb4..70a3bcc35 100644 --- a/.github/workflows/go-apidiff.yaml +++ b/.github/workflows/go-apidiff.yaml @@ -1,5 +1,7 @@ name: go-apidiff -on: [ pull_request ] +on: + pull_request: + merge_group: jobs: go-apidiff: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 92f3ed1ba..2888aed6e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,6 +10,7 @@ on: pull_request: branches: - main + merge_group: jobs: goreleaser: diff --git a/.github/workflows/sanity.yaml b/.github/workflows/sanity.yaml index f68d7ea25..3cbef5f88 100644 --- a/.github/workflows/sanity.yaml +++ b/.github/workflows/sanity.yaml @@ -3,6 +3,7 @@ name: sanity on: workflow_dispatch: pull_request: + merge_group: push: branches: - main diff --git a/.github/workflows/unit-test.yaml b/.github/workflows/unit-test.yaml index 8a37190e8..f0411b93e 100644 --- a/.github/workflows/unit-test.yaml +++ b/.github/workflows/unit-test.yaml @@ -3,6 +3,7 @@ name: unit-test on: workflow_dispatch: pull_request: + merge_group: push: branches: - main From d0f1b7a4ebb8d58c5993d2fa1c61b6dfd640dd23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Jul 2023 14:22:51 +0000 Subject: [PATCH 08/11] Bump github.com/docker/docker Bumps [github.com/docker/docker](https://github.com/docker/docker) from 20.10.21+incompatible to 20.10.24+incompatible. - [Release notes](https://github.com/docker/docker/releases) - [Commits](https://github.com/docker/docker/compare/v20.10.21...v20.10.24) --- updated-dependencies: - dependency-name: github.com/docker/docker dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2a41ee848..24c62a144 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/cli v20.10.21+incompatible // indirect github.com/docker/distribution v2.8.1+incompatible // indirect - github.com/docker/docker v20.10.21+incompatible // indirect + github.com/docker/docker v20.10.24+incompatible // indirect github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-metrics v0.0.1 // indirect diff --git a/go.sum b/go.sum index 9d3ad237b..e4dbab1da 100644 --- a/go.sum +++ b/go.sum @@ -310,8 +310,8 @@ github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4Kfc github.com/docker/docker v0.7.3-0.20190103212154-2b7e084dc98b/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v0.7.3-0.20190817195342-4760db040282/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v20.10.21+incompatible h1:UTLdBmHk3bEY+w8qeO5KttOhy6OmXWsl/FEet9Uswog= -github.com/docker/docker v20.10.21+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE= +github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= From 1a431d94df7222a928c330f2a9f3f1485b15ebbb Mon Sep 17 00:00:00 2001 From: Mikalai Radchuk Date: Thu, 27 Jul 2023 16:57:11 +0100 Subject: [PATCH 09/11] Tidies up Makefile * Fixes default target. It looks like target `all` was previously define first to implicitly set `build` to be default target, but since introduction `include` above the `all` target - now `BINGO` is default target. This change explicitly sets `build` to be default. * Sets several targets as phony as they are not targeting a file and moves `.PHONY` closer to target definition for better visibility. * Removes unused `wait` target Signed-off-by: Mikalai Radchuk --- Makefile | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 09303e755..a162f2114 100644 --- a/Makefile +++ b/Makefile @@ -41,8 +41,7 @@ SHELL = /usr/bin/env bash -o pipefail # Disable -j flag for make .NOTPARALLEL: -.PHONY: all -all: build +.DEFAULT_GOAL := build ##@ General @@ -91,19 +90,22 @@ fmt: ## Run go fmt against code. vet: ## Run go vet against code. go vet ./... -.PHONY: test test-e2e e2e kind-load kind-cluster kind-cluster-cleanup +.PHONY: test test: manifests generate fmt vet test-unit e2e ## Run all tests. +.PHONY: test-e2e FOCUS := $(if $(TEST),-v -focus "$(TEST)") E2E_FLAGS ?= "" test-e2e: $(GINKGO) ## Run the e2e tests $(GINKGO) --tags $(GO_BUILD_TAGS) $(E2E_FLAGS) -trace -progress $(FOCUS) test/e2e +.PHONY: test-unit ENVTEST_VERSION = $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\)\.[[:digit:]]\{1,\}$$/1.\1.x/') UNIT_TEST_DIRS=$(shell go list ./... | grep -v /test/) test-unit: $(SETUP_ENVTEST) ## Run the unit tests eval $$($(SETUP_ENVTEST) use -p env $(ENVTEST_VERSION)) && go test -tags $(GO_BUILD_TAGS) -count=1 -short $(UNIT_TEST_DIRS) -coverprofile cover.out +.PHONY: e2e e2e: KIND_CLUSTER_NAME=operator-controller-e2e e2e: KUSTOMIZE_BUILD_DIR=config/e2e e2e: GO_BUILD_FLAGS=-cover @@ -113,13 +115,16 @@ e2e: run kind-load-test-artifacts test-e2e e2e-coverage kind-cluster-cleanup ## e2e-coverage: COVERAGE_OUTPUT=./e2e-cover.out ./hack/e2e-coverage.sh +.PHONY: kind-load kind-load: $(KIND) ## Loads the currently constructed image onto the cluster $(KIND) load docker-image $(IMG) --name $(KIND_CLUSTER_NAME) +.PHONY: kind-cluster kind-cluster: $(KIND) ## Standup a kind cluster $(KIND) create cluster --name ${KIND_CLUSTER_NAME} $(KIND) export kubeconfig --name ${KIND_CLUSTER_NAME} +.PHONY: kind-cluster-cleanup kind-cluster-cleanup: $(KIND) ## Delete the kind cluster $(KIND) delete cluster --name ${KIND_CLUSTER_NAME} @@ -162,10 +167,6 @@ go-build-linux: .PHONY: run run: docker-build kind-cluster kind-load install ## Build the operator-controller then deploy it into a new kind cluster. -.PHONY: wait -wait: - kubectl wait --for=condition=Available --namespace=$(OPERATOR_CONTROLLER_NAMESPACE) deployment/operator-controller-controller-manager --timeout=$(WAIT_TIMEOUT) - .PHONY: docker-build docker-build: build-linux ## Build docker image for operator-controller with GOOS=linux and local GOARCH. docker build -t ${IMG} -f Dockerfile ./bin/linux @@ -178,9 +179,11 @@ docker-build: build-linux ## Build docker image for operator-controller with GOO export ENABLE_RELEASE_PIPELINE ?= false export GORELEASER_ARGS ?= --snapshot --clean +.PHONY: release release: $(GORELEASER) ## Runs goreleaser for the operator-controller. By default, this will run only as a snapshot and will not publish any artifacts unless it is run with different arguments. To override the arguments, run with "GORELEASER_ARGS=...". When run as a github action from a tag, this target will publish a full release. $(GORELEASER) $(GORELEASER_ARGS) +.PHONY: quickstart quickstart: export MANIFEST="https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml" quickstart: $(KUSTOMIZE) generate ## Generate the installation release manifests and scripts $(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml From 250ed68572fcb01662d831db68b0f2a14fb57681 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Jul 2023 14:22:55 +0000 Subject: [PATCH 10/11] Bump github.com/containerd/containerd from 1.6.15 to 1.6.18 Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.6.15 to 1.6.18. - [Release notes](https://github.com/containerd/containerd/releases) - [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md) - [Commits](https://github.com/containerd/containerd/compare/v1.6.15...v1.6.18) --- updated-dependencies: - dependency-name: github.com/containerd/containerd dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 24c62a144..c36045de8 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/containerd/cgroups v1.0.4 // indirect - github.com/containerd/containerd v1.6.15 // indirect + github.com/containerd/containerd v1.6.18 // indirect github.com/containerd/continuity v0.3.0 // indirect github.com/containerd/ttrpc v1.1.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/go.sum b/go.sum index e4dbab1da..55ec8304e 100644 --- a/go.sum +++ b/go.sum @@ -196,8 +196,8 @@ github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09Zvgq github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= -github.com/containerd/containerd v1.6.15 h1:4wWexxzLNHNE46aIETc6ge4TofO550v+BlLoANrbses= -github.com/containerd/containerd v1.6.15/go.mod h1:U2NnBPIhzJDm59xF7xB2MMHnKtggpZ+phKg8o2TKj2c= +github.com/containerd/containerd v1.6.18 h1:qZbsLvmyu+Vlty0/Ex5xc0z2YtKpIsb5n45mAMI+2Ns= +github.com/containerd/containerd v1.6.18/go.mod h1:1RdCUu95+gc2v9t3IL+zIlpClSmew7/0YS8O5eQZrOw= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= From 949c06a3e58f0a5520adcafd8802b90bdb7e71aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Jul 2023 19:13:43 +0000 Subject: [PATCH 11/11] Bump github.com/docker/distribution Bumps [github.com/docker/distribution](https://github.com/docker/distribution) from 2.8.1+incompatible to 2.8.2+incompatible. - [Release notes](https://github.com/docker/distribution/releases) - [Commits](https://github.com/docker/distribution/compare/v2.8.1...v2.8.2) --- updated-dependencies: - dependency-name: github.com/docker/distribution dependency-type: indirect ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c36045de8..005aad6e5 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,7 @@ require ( github.com/containerd/ttrpc v1.1.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/cli v20.10.21+incompatible // indirect - github.com/docker/distribution v2.8.1+incompatible // indirect + github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/docker v20.10.24+incompatible // indirect github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/docker/go-connections v0.4.0 // indirect diff --git a/go.sum b/go.sum index 55ec8304e..4074ae7a9 100644 --- a/go.sum +++ b/go.sum @@ -305,8 +305,8 @@ github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TT github.com/docker/distribution v2.7.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= -github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= +github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v0.7.3-0.20190103212154-2b7e084dc98b/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v0.7.3-0.20190817195342-4760db040282/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=