Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Use kustomize for install manifest generation #271

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ SDK_VERSION = v0.17.2
MACHINE = $(shell uname -m)
BUILD_IMAGE = golang:1.14.2
BASE_IMAGE = storageos/base-image:0.2.1
BUILD_DIR = "build"
BUILD_DIR = "${CURDIR}/build"
OPERATOR_SDK = $(BUILD_DIR)/operator-sdk
YQ = $(BUILD_DIR)/yq
GOLANGCI_LINT = $(BUILD_DIR)/golangci-lint
KUSTOMIZE = $(BUILD_DIR)/kustomize
OUTPUT_DIR = $(BUILD_DIR)/_output

# Set the new version before running the release target.
Expand Down Expand Up @@ -160,7 +161,7 @@ dev-image: operator-sdk operator-docker ## Build an image quickly for testing (f

##@ Third-party tools

.PHONY: operator-sdk yq golangci-lint
.PHONY: operator-sdk yq golangci-lint kustomize

operator-sdk: ## Download operator-sdk.
# Download sdk only if it's not available.
Expand All @@ -180,6 +181,13 @@ golangci-lint: ## Install golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(BUILD_DIR) v1.27.0; \
fi

kustomize: ## Install kustomize.
@if [ ! -f $(KUSTOMIZE) ]; then \
curl -s https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh | bash && \
mv kustomize $(KUSTOMIZE); \
fi


##############################
# Tests #
##############################
Expand Down Expand Up @@ -224,9 +232,12 @@ metadata-zip: ## Generate OLM metadata-zip bundle.
deploy/olm/storageos/storageosnfsserver.crd.yaml \
deploy/olm/csv-rhel/storageos.v*.clusterserviceversion.yaml

update-image: kustomize
cd deploy/ && $(KUSTOMIZE) edit set image storageos/cluster-operator=$(OPERATOR_IMAGE)

# Generates a single manifest for installing the operator.
install-manifest: yq ## Generate operator install manifest file.
bash scripts/create-manifest.sh $(OPERATOR_IMAGE)
install-manifest: kustomize update-image ## Generate operator install manifest file.
$(KUSTOMIZE) build deploy/ > storageos-operator.yaml



Expand Down
16 changes: 16 additions & 0 deletions deploy/config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
RELATED_IMAGE_STORAGEOS_NODE
RELATED_IMAGE_STORAGEOS_INIT
RELATED_IMAGE_CSIV1_CLUSTER_DRIVER_REGISTRAR
RELATED_IMAGE_CSIV1_NODE_DRIVER_REGISTRAR
RELATED_IMAGE_CSIV1_EXTERNAL_PROVISIONER
RELATED_IMAGE_CSIV1_EXTERNAL_ATTACHER
RELATED_IMAGE_CSIV1_EXTERNAL_ATTACHER_V2
RELATED_IMAGE_CSIV1_EXTERNAL_RESIZER
RELATED_IMAGE_CSIV1_LIVENESS_PROBE
RELATED_IMAGE_CSIV0_DRIVER_REGISTRAR
RELATED_IMAGE_CSIV0_EXTERNAL_PROVISIONER
RELATED_IMAGE_CSIV0_EXTERNAL_ATTACHER
RELATED_IMAGE_NFS
RELATED_IMAGE_KUBE_SCHEDULER
JAEGER_ENDPOINT
JAEGER_SERVICE_NAME
5 changes: 5 additions & 0 deletions deploy/crds/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resources:
- storageos.com_jobs_crd.yaml
- storageos.com_nfsservers_crd.yaml
- storageos.com_storageosclusters_crd.yaml
- storageos.com_storageosupgrades_crd.yaml
21 changes: 21 additions & 0 deletions deploy/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: storageos-operator

resources:
- crds
- namespace.yaml
- role.yaml
- service_account.yaml
- role_binding.yaml
- operator.yaml

configMapGenerator:
- envs:
- config.env
name: storageos-cluster-operator

images:
- name: storageos/cluster-operator
newName: storageos/cluster-operator
newTag: test
36 changes: 3 additions & 33 deletions deploy/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: storageos-cluster-operator
namespace: storageos-operator
labels:
app.kubernetes.io/name: storageos-operator
app.kubernetes.io/instance: storageos-cluster-operator
Expand Down Expand Up @@ -33,34 +32,6 @@ spec:
- cluster-operator
imagePullPolicy: IfNotPresent
env:
- name: RELATED_IMAGE_STORAGEOS_NODE
value: ""
- name: RELATED_IMAGE_STORAGEOS_INIT
value: ""
- name: RELATED_IMAGE_CSIV1_CLUSTER_DRIVER_REGISTRAR
value: ""
- name: RELATED_IMAGE_CSIV1_NODE_DRIVER_REGISTRAR
value: ""
- name: RELATED_IMAGE_CSIV1_EXTERNAL_PROVISIONER
value: ""
- name: RELATED_IMAGE_CSIV1_EXTERNAL_ATTACHER
value: ""
- name: RELATED_IMAGE_CSIV1_EXTERNAL_ATTACHER_V2
value: ""
- name: RELATED_IMAGE_CSIV1_EXTERNAL_RESIZER
value: ""
- name: RELATED_IMAGE_CSIV1_LIVENESS_PROBE
value: ""
- name: RELATED_IMAGE_CSIV0_DRIVER_REGISTRAR
value: ""
- name: RELATED_IMAGE_CSIV0_EXTERNAL_PROVISIONER
value: ""
- name: RELATED_IMAGE_CSIV0_EXTERNAL_ATTACHER
value: ""
- name: RELATED_IMAGE_NFS
value: ""
- name: RELATED_IMAGE_KUBE_SCHEDULER
value: ""
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
Expand All @@ -77,10 +48,9 @@ spec:
value: "storageos-cluster-operator"
- name: DISABLE_SCHEDULER_WEBHOOK
value: "false"
- name: JAEGER_ENDPOINT
value: ""
- name: JAEGER_SERVICE_NAME
value: ""
envFrom:
- configMapRef:
name: storageos-cluster-operator
tolerations:
- key: "key"
operator: "Equal"
Expand Down
16 changes: 8 additions & 8 deletions deploy/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ data:
# tls.crt:
# tls.key:
# Add base64 encoded creds below for CSI credentials.
# csiProvisionUsername:
# csiProvisionPassword:
# csiControllerPublishUsername:
# csiControllerPublishPassword:
# csiNodePublishUsername:
# csiNodePublishPassword:
# csiControllerExpandUsername:
# csiControllerExpandPassword:
csiProvisionUsername: c3RvcmFnZW9z
csiProvisionPassword: c3RvcmFnZW9z
csiControllerPublishUsername: c3RvcmFnZW9z
csiControllerPublishPassword: c3RvcmFnZW9z
csiNodePublishUsername: c3RvcmFnZW9z
csiNodePublishPassword: c3RvcmFnZW9z
csiControllerExpandUsername: c3RvcmFnZW9z
csiControllerExpandPassword: c3RvcmFnZW9z
1 change: 0 additions & 1 deletion deploy/service_account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: storageoscluster-operator-sa
namespace: storageos-operator
labels:
app: storageos
app.kubernetes.io/name: storageos-operator
Expand Down
2 changes: 2 additions & 0 deletions deploy/storageos-operators.olm.cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ metadata:
type: "kubernetes.io/storageos"
data:
# echo -n '<secret>' | base64
apiUsername: c3RvcmFnZW9z
apiPassword: c3RvcmFnZW9z
csiProvisionUsername: c3RvcmFnZW9z
csiProvisionPassword: c3RvcmFnZW9z
csiControllerPublishUsername: c3RvcmFnZW9z
Expand Down
55 changes: 0 additions & 55 deletions scripts/create-manifest.sh

This file was deleted.