Skip to content

Commit b5ed092

Browse files
YCShen1010qpdpQ
andauthored
Add helm generate into makefile (#2351)
* Add helm generate into makefile Signed-off-by: YuChen <[email protected]> * helm template and generated manifest Signed-off-by: YuChen <[email protected]> * removed hardcode namespace Signed-off-by: YuChen <[email protected]> * make .Values.namespace for each helm charts Signed-off-by: YuChen <[email protected]> * transfer meta namesapce to all RB subjects service account namespace Signed-off-by: YuChen <[email protected]> * substitute CERTIFICATE_NAMESPACE in webhook annotation Signed-off-by: YuChen <[email protected]> * add helm chart for service account Signed-off-by: YuChen <[email protected]> * make SA namespace as variable Signed-off-by: YuChen <[email protected]> * add env vars into deployment Signed-off-by: YuChen <[email protected]> * remove webhook configuration Signed-off-by: YuChen <[email protected]> * create standard helm folder for test Signed-off-by: Allen Li <[email protected]> * move clusterrole to namespace-scoped Signed-off-by: Allen Li <[email protected]> * update filename Signed-off-by: Allen Li <[email protected]> * update helm file Signed-off-by: Allen Li <[email protected]> * update watch_namespace Signed-off-by: Allen Li <[email protected]> * typo Signed-off-by: Allen Li <[email protected]> * update deployment Signed-off-by: Allen Li <[email protected]> * typo in entitlement key Signed-off-by: Allen Li <[email protected]> * change watch_namespace for now Signed-off-by: Allen Li <[email protected]> * add edb image configmap --------- Signed-off-by: YuChen <[email protected]> Signed-off-by: Allen Li <[email protected]> Co-authored-by: Allen Li <[email protected]> Co-authored-by: Allen Li <[email protected]>
1 parent 1f5328b commit b5ed092

24 files changed

+1789
-15
lines changed

Makefile

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ OPERATOR_SDK ?= $(shell which operator-sdk)
2020
CONTROLLER_GEN ?= $(shell which controller-gen)
2121
KUSTOMIZE ?= $(shell which kustomize)
2222
YQ_VERSION=v4.27.3
23-
KUSTOMIZE_VERSION=v3.8.7
24-
OPERATOR_SDK_VERSION=v1.31.0
23+
KUSTOMIZE_VERSION=v5.0.0
24+
OPERATOR_SDK_VERSION=v1.38.0
2525
CONTROLLER_TOOLS_VERSION ?= v0.14.0
2626

2727
CSV_PATH=bundle/manifests/ibm-common-service-operator.clusterserviceversion.yaml
@@ -79,6 +79,8 @@ REGISTRY ?= "docker-na-public.artifactory.swg-devops.com/hyc-cloud-private-scrat
7979
OPERATOR_IMAGE_NAME ?= common-service-operator
8080
# Current Operator bundle image name
8181
BUNDLE_IMAGE_NAME ?= common-service-operator-bundle
82+
# Current Operator image with registry
83+
IMG ?= icr.io/cpopen/common-service-operator:latest
8284

8385
CHANNELS := v4.11
8486
DEFAULT_CHANNEL := v4.11
@@ -102,6 +104,11 @@ include hack/keycloak-themes/Makefile
102104

103105
##@ Development
104106

107+
## Location to install dependencies to
108+
LOCALBIN ?= $(shell pwd)/bin
109+
$(LOCALBIN):
110+
mkdir -p $(LOCALBIN)
111+
105112
clis: yq kustomize operator-sdk
106113

107114
yq: ## Install yq, a yaml processor
@@ -239,6 +246,31 @@ generate-all: yq kustomize operator-sdk generate manifests cloudpak-theme-versio
239246
$(OPERATOR_SDK) generate kustomize manifests -q
240247
- make bundle-manifests CHANNELS=v4.11 DEFAULT_CHANNEL=v4.11
241248

249+
##@ Helm Chart Generation
250+
251+
.PHONY: deploy-dryrun
252+
deploy-dryrun: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
253+
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
254+
$(KUSTOMIZE) build config/default --output config/ibm-common-service-operator.yaml
255+
256+
.PHONY: helm
257+
helm: deploy-dryrun kustohelmize
258+
$(KUSTOHELMIZE) create --from=config/ibm-common-service-operator.yaml helm/ibm-common-service-operator
259+
helm lint helm/ibm-common-service-operator
260+
261+
KUBERNETES-SPLIT-YAML ?= $(LOCALBIN)/kubernetes-split-yaml
262+
KUSTOHELMIZE ?= $(LOCALBIN)/kustohelmize
263+
264+
.PHONY: kubernetes-split-yaml
265+
kubernetes-split-yaml: $(KUBERNETES-SPLIT-YAML) ## Download kubernetes-split-yaml locally if necessary.
266+
$(KUBERNETES-SPLIT-YAML): $(LOCALBIN)
267+
GOBIN=$(LOCALBIN) go install github.com/mogensen/[email protected]
268+
269+
.PHONY: kustohelmize
270+
kustohelmize: $(KUSTOHELMIZE) ## Download kustohelmize locally if necessary.
271+
$(KUSTOHELMIZE): $(LOCALBIN) kubernetes-split-yaml
272+
GOBIN=$(LOCALBIN) go install github.com/yeahdongcn/[email protected]
273+
242274
##@ Test
243275

244276
test: ## Run unit test on prow

config/certmanager/certificate.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ apiVersion: cert-manager.io/v1
55
kind: Issuer
66
metadata:
77
name: selfsigned-issuer
8-
namespace: ibm-common-services
8+
# namespace: ibm-common-services
99
spec:
1010
selfSigned: {}
1111
---
1212
apiVersion: cert-manager.io/v1
1313
kind: Certificate
1414
metadata:
1515
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml
16-
namespace: ibm-common-services
16+
# namespace: ibm-common-services
1717
spec:
1818
# $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize
1919
dnsNames:

config/default/kustomization.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Adds namespace to all resources.
2-
namespace: system
2+
transformers:
3+
- |-
4+
apiVersion: builtin
5+
kind: NamespaceTransformer
6+
metadata:
7+
name: notImportantHere
8+
namespace: custom-namespace
9+
setRoleBindingSubjects: allServiceAccounts
10+
fieldSpecs:
11+
- path: metadata/namespace
12+
create: true
13+
14+
namespace: custom-namespace
315

416
# Value of this field is prepended to the
517
# names of all resources, e.g. a deployment named
@@ -23,6 +35,7 @@ bases:
2335
- ../certmanager
2436
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
2537
#- ../prometheus
38+
- ../service_account
2639

2740
patchesStrategicMerge:
2841
# Protect the /metrics endpoint by putting it behind auth.
@@ -32,7 +45,7 @@ patchesStrategicMerge:
3245

3346
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
3447
# crd/kustomization.yaml
35-
- manager_webhook_patch.yaml
48+
# - manager_webhook_patch.yaml
3649

3750
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
3851
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.

config/default/manager_auth_proxy_patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apps/v1
44
kind: Deployment
55
metadata:
66
name: ibm-common-service-operator
7-
namespace: ibm-common-services
7+
# namespace: ibm-common-services
88
spec:
99
template:
1010
spec:

config/default/manager_webhook_patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: ibm-common-service-operator
5-
namespace: ibm-common-services
5+
# namespace: ibm-common-services
66
spec:
77
template:
88
spec:

0 commit comments

Comments
 (0)