Skip to content

Commit

Permalink
chore: Parameterize CP4I client
Browse files Browse the repository at this point in the history
  • Loading branch information
nastacio committed Mar 2, 2022
1 parent a441be5 commit ebd2923
Show file tree
Hide file tree
Showing 24 changed files with 170 additions and 37 deletions.
2 changes: 1 addition & 1 deletion config/argocd-cloudpaks/cp4i/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.4.0
version: 0.5.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
2 changes: 2 additions & 0 deletions config/argocd-cloudpaks/cp4i/templates/cp4i-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ spec:
value: ${ARGOCD_APP_NAMESPACE}
- name: metadata.argocd_app_namespace
value: {{.Values.metadata.argocd_app_namespace}}
- name: modules.client
value: "{{.Values.modules.client}}"
- name: repoURL
value: ${ARGOCD_APP_SOURCE_REPO_URL}
- name: serviceaccount.argocd_application_controller
Expand Down
22 changes: 19 additions & 3 deletions config/argocd-cloudpaks/cp4i/templates/cp4i-client-app.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{{- $argocd_app_namespace := .Values.metadata.argocd_app_namespace -}}
{{- $repoUrl := .Values.repoURL -}}
{{- $targetRevision := .Values.targetRevision -}}
{{- $client := .Values.modules.client }}
{{- if eq ( default false $client ) true }}
---
apiVersion: argoproj.io/v1alpha1
kind: Application
Expand All @@ -20,9 +25,19 @@ spec:
kind: Application
project: default
source:
path: config/cloudpaks/cp4i/client/overlays
repoURL: https://github.com/IBM/cloudpak-gitops.git
syncPolicy: {}
helm:
parameters:
- name: repoURL
value: ${ARGOCD_APP_SOURCE_REPO_URL}
- name: targetRevision
value: ${ARGOCD_APP_SOURCE_TARGET_REVISION}
path: config/cloudpaks/cp4i/client
repoURL: {{.Values.repoURL}}
targetRevision: {{.Values.targetRevision}}
syncPolicy:
automated:
prune: true
selfHeal: true
status:
health: {}
summary: {}
Expand All @@ -32,3 +47,4 @@ status:
source:
repoURL: ""
status: ""
{{- end }}
2 changes: 2 additions & 0 deletions config/argocd-cloudpaks/cp4i/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ metadata:
storageclass:
rwo: ocs-storagecluster-ceph-rbd
rwx: ocs-storagecluster-cephfs
modules:
client: false
21 changes: 21 additions & 0 deletions config/cloudpaks/cp4i/client/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
24 changes: 24 additions & 0 deletions config/cloudpaks/cp4i/client/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
apiVersion: v2
name: icp4i-client
description: Client apps for Cloud Pak for Integration

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.5.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: "2021.4.1"
11 changes: 0 additions & 11 deletions config/cloudpaks/cp4i/client/base/kustomization.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions config/cloudpaks/cp4i/client/overlays/kustomization.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions config/cloudpaks/cp4i/client/templates/00-namespaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Namespace
metadata:
creationTimestamp: null
name: dev
spec: {}
status: {}
17 changes: 17 additions & 0 deletions config/cloudpaks/cp4i/client/templates/20-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
creationTimestamp: null
name: cp4i-client
annotations:
argocd.argoproj.io/sync-wave: "22"
namespace: dev
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: ibm-cp4i-client
subjects:
- kind: ServiceAccount
name: openshift-gitops-argocd-application-controller
namespace: openshift-gitops
34 changes: 34 additions & 0 deletions config/cloudpaks/cp4i/client/templates/20-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
annotations:
argocd.argoproj.io/sync-wave: "21"
creationTimestamp: null
name: ibm-cp4i-client
namespace: dev
rules:
- apiGroups:
- apps
resources:
- '*'
verbs:
- '*'
- apiGroups:
- binding.operators.coreos.com
resources:
- '*'
verbs:
- '*'
- apiGroups:
- build.openshift.io
resources:
- '*'
verbs:
- '*'
- apiGroups:
- image.openshift.io
resources:
- '*'
verbs:
- '*'
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
apiVersion: binding.operators.coreos.com/v1alpha1
kind: ServiceBinding
metadata:
creationTimestamp: null
annotations:
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true
argocd.argoproj.io/sync-wave: "300"
creationTimestamp: null
name: binding-request
namespace: dev
spec:
Expand Down Expand Up @@ -34,10 +35,10 @@ spec:
value: |
{
"MQ_ENDPOINTS": [{
"HOST": "{{.queueservice.metadata.name}}.{{.queueservice.metadata.namespace}}.svc.cluster.local",
"PORT": "{{range .queueservice.spec.ports}}{{if eq .name "qmgr"}}{{.port}}{{end}}{{end}}",
"HOST": "{{ "{{.queueservice.metadata.name}}.{{.queueservice.metadata.namespace}}.svc.cluster.local" }}",
"PORT": "{{ "{{range .queueservice.spec.ports}}{{if eq .name \"qmgr\"}}{{.port}}{{end}}{{end}}" }}",
"CHANNEL": "MQ.SVRCONN",
"QMGR": "{{.mqqmgr.spec.queueManager.name}}",
"QMGR": "{{ "{{.mqqmgr.spec.queueManager.name}}" }}",
"APP_USER": "someuser",
"QUEUE_NAME": "DEV.CASE_QUEUE.1",
"DYNAMIC_QUEUE_PREFIX": "APP.REPLIES.*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: BuildConfig
metadata:
creationTimestamp: null
annotations:
argocd.argoproj.io/sync-wave: "300"
argocd.argoproj.io/sync-wave: "310"
name: mq-dev-patterns-jms
namespace: dev
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
app.kubernetes.io/name: mq-dev-patterns-jms
app.kubernetes.io/part-of: app-mq-dev-patterns
annotations:
argocd.argoproj.io/sync-wave: "300"
argocd.argoproj.io/sync-wave: "310"
name: mq-dev-patterns-jms
namespace: dev
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: BuildConfig
metadata:
creationTimestamp: null
annotations:
argocd.argoproj.io/sync-wave: "300"
argocd.argoproj.io/sync-wave: "310"
name: mq-dev-patterns-node
namespace: dev
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
app.kubernetes.io/name: mq-dev-patterns-node
app.kubernetes.io/part-of: app-mq-dev-patterns
annotations:
argocd.argoproj.io/sync-wave: "300"
argocd.argoproj.io/sync-wave: "310"
name: mq-dev-patterns-node
namespace: dev
spec:
Expand Down
1 change: 1 addition & 0 deletions config/cloudpaks/cp4i/client/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
13 changes: 8 additions & 5 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ Global pull secrets require granting too much priviledge to the OpenShift GitOps
The Application resources are transitioning to use `PreSync` hooks to copy the entitlement key from a `Secret` named `ibm-entitlement-key` in the `openshift-gitops` namespace, so issue the following command to create that secret:
```
oc create secret docker-registry ibm-entitlement-key \
```sh
# Note that if you just created the OpenShift GitOps operator
# the namespace may not be ready yet, so you may need to wait
# a minute or two
oc create secret docker-registry ibm-entitlement-key \
--docker-server=cp.icr.io \
--docker-username=cp \
--docker-password="${IBM_ENTITLEMENT_KEY:?}" \
Expand Down Expand Up @@ -243,8 +246,8 @@ After completing the list of activities listed in the previous sections, you hav
gitops_url=https://github.com/IBM/cloudpak-gitops
gitops_branch=main
argo_pwd=$(oc get secret openshift-gitops-cluster \
-n openshift-gitops \
-o jsonpath='{.data.admin\.password}' | base64 -d ; echo ) \
-n openshift-gitops \
-o go-template='{{index .data "admin.password"|base64decode}}') \
&& argo_url=$(oc get route openshift-gitops-server \
-n openshift-gitops \
-o jsonpath='{.spec.host}') \
Expand Down Expand Up @@ -284,7 +287,7 @@ After completing the list of activities listed in the previous sections, you hav
--helm-set-string metadata.argocd_app_namespace="${cp_namespace}" \
--sync-policy automated \
--revision ${gitops_branch:?} \
--upsert
--upsert
```
1. Add the respective Cloud Pak application (this step assumes you still have shell variables assigned from previous steps) :
Expand Down
29 changes: 23 additions & 6 deletions tests/prebuild/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ yamllint -v > /dev/null 2>&1 \
if [ "$(uname)" == "Darwin" ]; then
brew install yamllint
else
apt-get update && \
{
apt-get install yamllint -y \
|| log "ERROR: yamllint installation failed."
}
if apt-get -h 2>&1 /dev/null; then
apt-get update && \
{
apt-get install yamllint -y \
|| log "ERROR: yamllint installation failed."
}
else
log "ERROR: Unrecognized package manager."
exit 1
fi
fi
}

Expand All @@ -50,7 +55,19 @@ hl_result=0
find . -name Chart.yaml | sed "s|/Chart.yaml||g" | xargs helm lint || hl_result=1
log "INFO: Completed helm lint run: ${hl_result}"

result=$((hl_result+yl_result))
log "INFO: Starting helm template run"
ht_result=0
while read -r chart;
do
htl=0
helm template "${chart}" 1> /dev/null || htl=1
if [ ${htl} -eq 1 ]; then
ht_result=1;
fi
done <<< "$(find . -name Chart.yaml | sed "s|/Chart.yaml||g")"
log "INFO: Completed helm templae run: ${ht_result}"

result=$((yl_result+hl_result+ht_result))
log "INFO: Global test failures: ${result}"

exit "${result}"
1 change: 1 addition & 0 deletions tests/prebuild/yamllint-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
ignore: |
config/argocd-cloudpaks/cp4aiops/templates/cp4aiops-module-template-app.yaml
config/argocd-cloudpaks/cp4d/templates/cp4d-module-template-app.yaml
config/argocd-cloudpaks/cp4i/templates/cp4i-client-app.yaml
config/cloudpaks/cp4a/operators/templates/01-namespaces/individual.yaml
config/cloudpaks/cp4a/operators/templates/07-operators/operator-group.yaml
config/cloudpaks/cp4aiops/install-aimgr/templates/subscriptions/00-namespaces.yaml
Expand Down

0 comments on commit ebd2923

Please sign in to comment.