Skip to content

Commit 3ef384a

Browse files
anishasthanaopenshift-merge-robot
authored andcommitted
Introduce CodeFlare Operator Bundle
Signed-off-by: Anish Asthana <[email protected]>
1 parent 279ac09 commit 3ef384a

17 files changed

+8672
-13
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ WORKDIR /
2121
COPY --from=builder /workspace/manager .
2222
COPY config/internal config/internal
2323

24-
24+
USER 65532:65532
2525
ENTRYPOINT ["/manager"]

Makefile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ifeq ($(USE_IMAGE_DIGESTS), true)
4747
endif
4848

4949
# Image URL to use all building/pushing image targets
50-
IMG ?= controller:latest
50+
IMG ?= ${IMAGE_TAG_BASE}:${VERSION}
5151
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5252
ENVTEST_K8S_VERSION = 1.24.2
5353

@@ -101,9 +101,6 @@ fmt: ## Run go fmt against code.
101101
vet: ## Run go vet against code.
102102
go vet ./...
103103

104-
.PHONY: test
105-
test: manifests generate fmt vet envtest ## Run tests.
106-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
107104

108105
##@ Build
109106

@@ -115,12 +112,12 @@ build: generate fmt vet ## Build manager binary.
115112
run: manifests generate fmt vet ## Run a controller from your host.
116113
go run ./main.go
117114

118-
.PHONY: podman-build
119-
podman-build: test ## Build container image with the manager.
115+
.PHONY: image-build
116+
image-build: test-unit ## Build container image with the manager.
120117
podman build -t ${IMG} .
121118

122-
.PHONY: podman-push
123-
podman-push: ## Push podman image with the manager.
119+
.PHONY: image-push
120+
image-push: ## Push container image with the manager.
124121
podman push ${IMG}
125122

126123
##@ Deployment
@@ -191,7 +188,7 @@ bundle-build: ## Build the bundle image.
191188

192189
.PHONY: bundle-push
193190
bundle-push: ## Push the bundle image.
194-
$(MAKE) podman-push IMG=$(BUNDLE_IMG)
191+
$(MAKE) image-push IMG=$(BUNDLE_IMG)
195192

196193
.PHONY: opm
197194
OPM = ./bin/opm
@@ -232,7 +229,7 @@ catalog-build: opm ## Build a catalog image.
232229
# Push the catalog image.
233230
.PHONY: catalog-push
234231
catalog-push: ## Push a catalog image.
235-
$(MAKE) podman-push IMG=$(CATALOG_IMG)
232+
$(MAKE) image-push IMG=$(CATALOG_IMG)
236233

237234
.PHONY: test-unit
238235
test-unit: manifests generate fmt vet envtest ## Run tests.

bundle.Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM scratch
2+
3+
# Core bundle labels.
4+
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
5+
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
6+
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
7+
LABEL operators.operatorframework.io.bundle.package.v1=codeflare-operator
8+
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
9+
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.24.1
10+
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
11+
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
12+
13+
# Labels for testing.
14+
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
15+
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
16+
17+
# Copy files to locations specified by labels.
18+
COPY bundle/manifests /manifests/
19+
COPY bundle/metadata /metadata/
20+
COPY bundle/tests/scorecard /tests/scorecard/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
control-plane: controller-manager
7+
name: codeflare-operator-controller-manager-metrics-service
8+
spec:
9+
ports:
10+
- name: https
11+
port: 8443
12+
protocol: TCP
13+
targetPort: https
14+
selector:
15+
control-plane: controller-manager
16+
status:
17+
loadBalancer: {}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
data:
3+
controller_manager_config.yaml: |
4+
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
5+
kind: ControllerManagerConfig
6+
health:
7+
healthProbeBindAddress: :8081
8+
metrics:
9+
bindAddress: 127.0.0.1:8080
10+
webhook:
11+
port: 9443
12+
leaderElection:
13+
leaderElect: true
14+
resourceName: 5a3ca514.codeflare.dev
15+
# leaderElectionReleaseOnCancel defines if the leader should step down volume
16+
# when the Manager ends. This requires the binary to immediately end when the
17+
# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly
18+
# speeds up voluntary leader transitions as the new leader don't have to wait
19+
# LeaseDuration time first.
20+
# In the default scaffold provided, the program ends immediately after
21+
# the manager stops, so would be fine to enable this option. However,
22+
# if you are doing or is intended to do any operation such as perform cleanups
23+
# after the manager stops then its usage might be unsafe.
24+
# leaderElectionReleaseOnCancel: true
25+
kind: ConfigMap
26+
metadata:
27+
name: codeflare-operator-manager-config
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
creationTimestamp: null
5+
name: codeflare-operator-manager-edit-rolebinding
6+
roleRef:
7+
apiGroup: rbac.authorization.k8s.io
8+
kind: ClusterRole
9+
name: edit
10+
subjects:
11+
- kind: ServiceAccount
12+
name: codeflare-operator-controller-manager
13+
namespace: openshift-operators
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
creationTimestamp: null
5+
name: codeflare-operator-metrics-reader
6+
rules:
7+
- nonResourceURLs:
8+
- /metrics
9+
verbs:
10+
- get

0 commit comments

Comments
 (0)