-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement OperatorHub bundle generation. Signed-off-by: Tomash Sidei <[email protected]>
- Loading branch information
Showing
14 changed files
with
386 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Image URL to use in all building/pushing image targets | ||
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
VERSION ?= "local" | ||
PUBLISH_IMG ?= varnish-operator:${VERSION} | ||
PUBLISH_IMG ?= ibmcom/varnish-operator:${VERSION} | ||
IMG ?= ${PUBLISH_IMG}-dev | ||
VARNISH_PUBLISH_IMG ?= varnish:${VERSION} | ||
VARNISH_IMG ?= ${VARNISH_PUBLISH_IMG}-dev | ||
|
@@ -41,7 +41,7 @@ uninstall: | |
# Generate manifests e.g. CRD, RBAC etc. | ||
manifests: | ||
# CRD apiextensions.k8s.io/v1 | ||
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=varnish-operator output:rbac:none paths="./..." output:crd:artifacts:config=config/crd/bases | ||
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=varnish-operator paths="./..." output:crd:artifacts:config=config/crd/bases | ||
kustomize build ${ROOT_DIR}config/crd > $(ROOT_DIR)varnish-operator/crds/varnishcluster.yaml | ||
|
||
# ClusterRole | ||
|
@@ -147,4 +147,21 @@ endif | |
e2e-tests: | ||
sh $(ROOT_DIR)hack/create_dev_cluster.sh | ||
KUBECONFIG=$(ROOT_DIR)e2e-tests-kubeconfig go test ./tests | ||
sh $(ROOT_DIR)hack/delete_dev_cluster.sh | ||
sh $(ROOT_DIR)hack/delete_dev_cluster.sh | ||
|
||
KUSTOMIZE = $(shell pwd)/bin/kustomize | ||
kustomize: | ||
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected]) | ||
|
||
# Generate bundle manifests and metadata, then validate generated files. | ||
.PHONY: bundle | ||
bundle: manifests kustomize | ||
yq w -i config/manager/deployment.yaml 'spec.template.spec.containers(name==varnish-operator).env(name==CONTAINER_IMAGE).value' $(PUBLISH_IMG) | ||
yq w -i config/manifests/bases/varnish-operator.clusterserviceversion.yaml 'metadata.annotations.containerImage' $(PUBLISH_IMG) | ||
yq w -i config/manifests/bases/varnish-operator.clusterserviceversion.yaml 'metadata.annotations.createdAt' $(date +"%Y-%m-%d") | ||
operator-sdk generate kustomize manifests -q | ||
cd config/manager && $(KUSTOMIZE) edit set image controller=$(PUBLISH_IMG) | ||
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS) | ||
operator-sdk bundle validate ./bundle | ||
cp Dockerfile.bundle ./bundle/Dockerfile | ||
mv ./bundle ./$(VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,18 @@ | ||
version: "2" | ||
domain: ibm.com | ||
layout: go.kubebuilder.io/v3 | ||
projectName: varnish-operator | ||
repo: github.com/ibm/varnish-operator | ||
resources: | ||
- group: caching | ||
version: v1alpha1 | ||
- api: | ||
crdVersion: v1 | ||
namespaced: true | ||
controller: true | ||
domain: ibm.com | ||
group: caching | ||
kind: VarnishCluster | ||
path: github.com/ibm/varnish-operator/api/v1alpha1 | ||
version: v1alpha1 | ||
version: "3" | ||
plugins: | ||
manifests.sdk.operatorframework.io/v2: {} | ||
scorecard.sdk.operatorframework.io/v2: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace: varnish-operator | ||
namePrefix: varnish-operator- | ||
|
||
bases: | ||
- ../crd | ||
- ../rbac | ||
- ../manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: controller | ||
namespace: system | ||
labels: | ||
operator: varnish-operator | ||
spec: | ||
selector: | ||
matchLabels: | ||
operator: varnish-operator | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
operator: varnish-operator | ||
spec: | ||
serviceAccountName: varnish-operator | ||
containers: | ||
- image: controller:latest | ||
name: varnish-operator | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
readinessProbe: | ||
httpGet: | ||
path: /readyz | ||
port: 8234 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 10 | ||
resources: | ||
limits: | ||
cpu: 500m | ||
memory: 200Mi | ||
requests: | ||
cpu: 500m | ||
memory: 200Mi | ||
env: | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: LEADERELECTION_ENABLED | ||
value: "false" | ||
- name: CONTAINER_IMAGE | ||
value: ibmcom/varnish-operator:0.27.2 | ||
- name: WEBHOOKS_ENABLED | ||
value: "false" | ||
- name: LOGLEVEL | ||
value: info | ||
- name: LOGFORMAT | ||
value: json | ||
ports: | ||
- containerPort: 8329 | ||
name: metrics | ||
- containerPort: 7340 | ||
name: webhook | ||
- containerPort: 8234 | ||
name: healthz | ||
terminationGracePeriodSeconds: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
resources: | ||
- deployment.yaml | ||
|
||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
images: | ||
- name: controller | ||
newName: ibmcom/varnish-operator | ||
newTag: 0.27.2 |
87 changes: 87 additions & 0 deletions
87
config/manifests/bases/varnish-operator.clusterserviceversion.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resources: | ||
- ../default | ||
- ../samples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resources: | ||
- role.yaml | ||
- role_binding.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
|
||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
creationTimestamp: null | ||
name: varnish-operator | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- configmaps | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- update | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- endpoints | ||
verbs: | ||
- list | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- events | ||
verbs: | ||
- create | ||
- patch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- nodes | ||
verbs: | ||
- list | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods | ||
verbs: | ||
- get | ||
- list | ||
- update | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- secrets | ||
verbs: | ||
- create | ||
- get | ||
- list | ||
- update | ||
- watch | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- serviceaccounts | ||
- services | ||
verbs: | ||
- create | ||
- delete | ||
- list | ||
- update | ||
- watch | ||
- apiGroups: | ||
- apps | ||
resources: | ||
- statefulsets | ||
verbs: | ||
- create | ||
- delete | ||
- list | ||
- update | ||
- watch | ||
- apiGroups: | ||
- caching.ibm.com | ||
resources: | ||
- varnishclusters | ||
verbs: | ||
- create | ||
- delete | ||
- list | ||
- update | ||
- watch | ||
- apiGroups: | ||
- caching.ibm.com | ||
resources: | ||
- varnishclusters/finalizers | ||
verbs: | ||
- get | ||
- patch | ||
- update | ||
- apiGroups: | ||
- caching.ibm.com | ||
resources: | ||
- varnishclusters/status | ||
verbs: | ||
- get | ||
- patch | ||
- update | ||
- apiGroups: | ||
- monitoring.coreos.com | ||
resources: | ||
- servicemonitors | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- update | ||
- watch | ||
- apiGroups: | ||
- policy | ||
resources: | ||
- poddisruptionbudgets | ||
verbs: | ||
- create | ||
- delete | ||
- list | ||
- update | ||
- watch | ||
- apiGroups: | ||
- rbac.authorization.k8s.io | ||
resources: | ||
- clusterrolebindings | ||
- clusterroles | ||
- rolebindings | ||
- roles | ||
verbs: | ||
- create | ||
- delete | ||
- list | ||
- update | ||
- watch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: manager-rolebinding | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: varnish-operator | ||
subjects: | ||
- kind: ServiceAccount | ||
name: varnish-operator | ||
namespace: system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
resources: | ||
- varnishcluster.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.