Skip to content

Commit c430eb9

Browse files
authored
Merge pull request #230 from bcgov/201-argocd
201 argocd changes
2 parents e534e23 + f93d367 commit c430eb9

File tree

7 files changed

+786
-10
lines changed

7 files changed

+786
-10
lines changed

openshift-201/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ Please join the [OpenShift 201 Self-Paced](https://chat.developer.gov.bc.ca/chan
2424
### Lab topics:
2525

2626
The Openshift 201 Lab is divided into the following topics:
27-
* Openshift Pipelines (you can choose to do either one)
28-
* [React Application](./react-pipeline.md)
29-
* [Java Application (Maven)](./pipelines.md)
27+
* [OpenShift Gitops](/.gitops.md)
3028
* [Resource Management](./resource-mgmt.md)
3129
* [Network Policy & ACS](./network-policy.md)
3230
* [Application Logging with Kibana](./logging.md)
3331
* [Best Practices for Image Management](./image-management.md)
3432
* [Pod Auto Scaling](./rh201-pod-auto-scale.md)
3533
* [Post Outage Checkup](./post-outage-checkup.md)
34+
Archived sections:
35+
* Openshift Pipelines (you can choose to do either one)
36+
* [React Application](./react-pipeline.md)
37+
* [Java Application (Maven)](./pipelines.md)

openshift-201/gitops.md

Lines changed: 547 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: mariadb-helm
5+
spec:
6+
destination:
7+
namespace: LICENSEPLATE-test
8+
server: https://kubernetes.default.svc
9+
project: LICENSEPLATE
10+
sources:
11+
- chart: bitnamicharts/mariadb
12+
helm:
13+
#releaseName: mariadb
14+
valueFiles:
15+
- $values/mariadb-helm/values.yaml
16+
repoURL: artifacts.developer.gov.bc.ca/docker-helm-oci-remote
17+
targetRevision: 20.2.0
18+
- ref: values
19+
repoURL: https://github.com/bcgov-c/tenant-gitops-LICENSEPLATE.git
20+
targetRevision: main
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# GitOpsTeam - create this resource in your tools namespace in order to enable
2+
# Argo CD for your project
3+
apiVersion: warden.devops.gov.bc.ca/v1alpha1
4+
kind: GitOpsTeam
5+
metadata:
6+
name: gitopsteam-myproject
7+
namespace: myproject-tools
8+
spec:
9+
# gitOpsMembers defines the git repo access (tenant-gitops-LICENSEPLATE)
10+
# Note that if users listed here are not already members of the GitHub
11+
# 'bcgov-c' organization, they will have to accept an email invitation
12+
# to join.
13+
#
14+
# Note:
15+
# Do not append "@github" to GitHub IDs in the gitOpsMembers section
16+
# This section is for GitHub repo access, so only GitHub IDs, no IDIRs
17+
# For GitHub teams, use the appropriate "Teams" lists (e.g., adminTeams)
18+
# ------------------------------------------------------------------------
19+
gitOpsMembers:
20+
21+
# Full admin access to the repo, including repo deletion, adding of users
22+
# Recommended for people who need full access to the project, including
23+
# sensitive and destructive actions like managing security or deleting a
24+
# repository.
25+
admins:
26+
- myGitHubID
27+
adminTeams:
28+
- ourGitHubTeam
29+
30+
# Recommended for contributors who actively push to your project.
31+
writers:
32+
- dev1-githubid
33+
writerTeams:
34+
35+
# Recommended for project managers who need to manage the repository without
36+
# access to sensitive or destructive actions.
37+
maintainers:
38+
maintainerTeams:
39+
40+
# Recommended for non-code contributors who want to view or discuss your
41+
# project.
42+
readers:
43+
readerTeams:
44+
45+
# Recommended for contributors who need to manage issues and pull requests
46+
# without write access.
47+
triage:
48+
triageTeams:
49+
50+
# projectMembers defines access to the Argo CD UI and is based on Keycloak
51+
# groups
52+
#
53+
# Note:
54+
# GitHub IDs must have "@github" appended to the ID
55+
# You may include IDIR email addresses (UPN) for IDIR-based access
56+
# GitHub IDs are not case sensitive in this section
57+
# Do not use GitHub teams here, just individual IDs
58+
# ------------------------------------------------------------------------
59+
projectMembers:
60+
61+
# Project Maintainers have full access to the prod and nonprod ArgoCD
62+
# projects.
63+
maintainers:
64+
- seniorDev@gov.bc.ca
65+
66+
# Nonprod users have full access to the nonprod ArgoCD project, which can
67+
# deploy to the dev, test, and tools namespaces. They cannot overwrite a
68+
# GitOpsTeam or GitOpsAlliance resource.
69+
nonprod:
70+
- otherDev@gov.bc.ca
71+
- contractor1@github
72+
73+
# Project Readers have read-only access to the Project in the Argo CD UI
74+
readers:
75+
- projectManager@gov.bc.ca
76+
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#!/bin/bash
2+
#
3+
# set_up_kustomize.sh
4+
#
5+
# Create a Kustomize app
6+
# ----------------------
7+
8+
APP_NAME=my-kustomize-app
9+
10+
echo ""
11+
echo -n "--> Run this script at the top level of your GitOps repository. Continue? [Yn] "
12+
read INPUT
13+
case $INPUT in
14+
Y | y | "")
15+
;;
16+
*)
17+
echo "Canceling"
18+
exit 1
19+
esac
20+
21+
echo "Creating directory tree ${APP_NAME}..."
22+
mkdir -p ${APP_NAME}/base ${APP_NAME}/overlays/dev ${APP_NAME}/overlays/test ${APP_NAME}/overlays/prod
23+
24+
cat <<EOF > ${APP_NAME}/base/kustomization.yaml
25+
---
26+
apiVersion: kustomize.config.k8s.io/v1beta1
27+
kind: Kustomization
28+
resources:
29+
- deployment.yaml
30+
EOF
31+
32+
cat <<EOF > ${APP_NAME}/base/deployment.yaml
33+
apiVersion: apps/v1
34+
kind: Deployment
35+
metadata:
36+
name: httpd
37+
spec:
38+
selector:
39+
matchLabels:
40+
app: httpd
41+
replicas: 3
42+
template:
43+
metadata:
44+
labels:
45+
app: httpd
46+
spec:
47+
containers:
48+
- name: httpd
49+
image: >-
50+
image-registry.openshift-image-registry.svc:5000/openshift/httpd:latest
51+
ports:
52+
- containerPort: 8080
53+
protocol: TCP
54+
strategy:
55+
type: RollingUpdate
56+
rollingUpdate:
57+
maxSurge: 25%
58+
maxUnavailable: 25%
59+
EOF
60+
61+
cat <<EOF > ${APP_NAME}/overlays/dev/kustomization.yaml
62+
---
63+
apiVersion: kustomize.config.k8s.io/v1beta1
64+
kind: Kustomization
65+
resources:
66+
- ../../base
67+
- configmap.yaml
68+
patchesStrategicMerge:
69+
- patch.deployment.yaml
70+
EOF
71+
72+
cat <<EOF > ${APP_NAME}/overlays/dev/configmap.yaml
73+
apiVersion: v1
74+
kind: ConfigMap
75+
metadata:
76+
name: ${APP_NAME}
77+
data:
78+
foo: bar
79+
EOF
80+
81+
cat <<EOF > ${APP_NAME}/overlays/dev/patch.deployment.yaml
82+
apiVersion: apps/v1
83+
kind: Deployment
84+
metadata:
85+
name: httpd
86+
spec:
87+
replicas: 1
88+
EOF
89+
90+
cat <<EOF > ${APP_NAME}/overlays/test/kustomization.yaml
91+
---
92+
apiVersion: kustomize.config.k8s.io/v1beta1
93+
kind: Kustomization
94+
resources:
95+
- ../../base
96+
patchesStrategicMerge:
97+
- patch.deployment.yaml
98+
EOF
99+
100+
cat <<EOF > ${APP_NAME}/overlays/test/patch.deployment.yaml
101+
apiVersion: apps/v1
102+
kind: Deployment
103+
metadata:
104+
name: httpd
105+
spec:
106+
replicas: 2
107+
EOF
108+
109+
cat <<EOF > ${APP_NAME}/overlays/prod/kustomization.yaml
110+
---
111+
apiVersion: kustomize.config.k8s.io/v1beta1
112+
kind: Kustomization
113+
resources:
114+
- ../../base
115+
EOF
116+
117+
echo ""
118+
echo "Here is the layout of your new Kustomize app:
119+
my-kustomize-app
120+
├── base
121+
│   ├── deployment.yaml
122+
│   └── kustomization.yaml
123+
└── overlays
124+
├── dev
125+
│   ├── configmap.yaml
126+
│   ├── kustomization.yaml
127+
│   └── patch.deployment.yaml
128+
├── prod
129+
│   └── kustomization.yaml
130+
└── test
131+
├── kustomization.yaml
132+
└── patch.deployment.yaml
133+
134+
5 directories, 8 files
135+
"
136+
echo "Done"
137+

openshift-201/pipelines.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,4 @@ If you now look at the pipelines you should see a new `PipelineRun` created and
299299

300300
**Note 1:** If your pipeline fails due to exceeding the storage quota on your namespace, delete any preivous 'PipelineRuns' on the namespace. This will delete the associated persistent volume claims (PVCs) which should give you sufficient storage space to run your pipeline.
301301

302-
**Note 2:** if you are creating your own pipelines in the future, you can use the 'pipeline builder' feature of the OpenShift web console. The can be accessed via the 'create' button on the Pipelines window of the web console. Since the 4.10 update, this pipeline builder will filter the tasks to show only those which are supported by the cluster.
303-
304-
Next Topic - [Resource Management](https://github.com/BCDevOps/devops-platform-workshops/blob/master/openshift-201/resource-mgmt.md)
302+
**Note 2:** if you are creating your own pipelines in the future, you can use the 'pipeline builder' feature of the OpenShift web console. The can be accessed via the 'create' button on the Pipelines window of the web console. Since the 4.10 update, this pipeline builder will filter the tasks to show only those which are supported by the cluster.

openshift-201/react-pipeline.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,3 @@ If you now look at the pipelines you should see a new `PipelineRun` created and
320320
**Note 1:** If your pipeline fails due to exceeding the storage quota on your namespace, delete any preivous 'PipelineRuns' on the namespace. This will delete the associated persistent volume claims (PVCs) which should give you sufficient storage space to run your pipeline.
321321

322322
**Note 2:** if you are creating your own pipelines in the future, you can use the 'pipeline builder' feature of the OpenShift web console. The can be accessed via the 'create' button on the Pipelines window of the web console. Since the 4.10 update, this pipeline builder will filter the tasks to show only those which are supported by the cluster.
323-
324-
325-
Next Topic - [Resource Management](https://github.com/BCDevOps/devops-platform-workshops/blob/master/openshift-201/resource-mgmt.md)
326-

0 commit comments

Comments
 (0)