Skip to content

Commit

Permalink
Argocd and Helm support (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrescosta authored Aug 23, 2024
1 parent c9727a9 commit dd139dd
Show file tree
Hide file tree
Showing 31 changed files with 276 additions and 213 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HELP.md
*.tgz
**/target/
**/backup/
*.bak
Expand All @@ -10,6 +11,7 @@ HELP.md
**/id/*.json
tempo-data
*.bkp
*.private
_infra/manifests/deploy.yaml
### STS ###
.apt_generated
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "_infra/helm"]
path = _infra/helm
url = https://github.com/andrescosta/todo-charts
39 changes: 39 additions & 0 deletions _infra/argocd/apps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: todosvc
spec:
destination:
name: ''
namespace: default
server: https://kubernetes.default.svc
source:
path: ''
repoURL: https://andrescosta.github.io/todo-charts
targetRevision: '>=0.4.0'
chart: todo-svc-jobico
syncPolicy:
automated: {}
sources: []
project: default
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: todoweb
spec:
destination:
name: ''
namespace: default
server: https://kubernetes.default.svc
source:
path: ''
repoURL: https://andrescosta.github.io/todo-charts
targetRevision: '*'
chart: todo-web-jobico
sources: []
project: default
syncPolicy:
automated:
prune: false
selfHeal: false
173 changes: 173 additions & 0 deletions _infra/argocd/jobs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: svc-builder-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: nfs-csi
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: web-builder-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: nfs-csi
resources:
requests:
storage: 1Gi
---
apiVersion: batch/v1
kind: Job
metadata:
name: svc-builder
spec:
template:
spec:
imagePullSecrets:
- name: reg-cred-secret
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
initContainers:
- name: init-svc
image: reg.jobico.org/buildah
command:
- /script/build.sh
- init
- --repository=https://github.com/andrescosta/todo-jobico-cloud
- --branch=argocd-helm
- --build-dir=todo-svc/
- --registry=reg.jobico.org
- --image-name=todosvc
- --current-version=1.1
- --work-dir=/repo
- --helm-repository=https://oauth2:{token}@github.com/andrescosta/todo-charts
- --helm-branch=main
- --helm-chart=todo-svc-jobico
- --helm-version=0.4
- --git-user=builder
- --git-email=builder@git
- --frequency=30
- --token-file=/token/token_git_hub.private
- --first-build
- --verbose
volumeMounts:
- name: builder-vol
mountPath: "/repo"
- name: script
mountPath: "/script"
- name: github-token
mountPath: /token
containers:
- name: svc-builder
image: reg.jobico.org/buildah
securityContext:
privileged: true
command:
- /repo/todo-svc-jobico.sh
volumeMounts:
- name: script
mountPath: "/script"
- name: builder-vol
mountPath: "/repo"
- name: ca
mountPath: "/etc/containers/certs.d/reg.jobico.org"
- name: github-token
mountPath: /token
volumes:
- name: script
configMap:
name: build-map
defaultMode: 0050
- name: builder-vol
persistentVolumeClaim:
claimName: svc-builder-pvc
- name: ca
configMap:
name: kube-root-ca.crt
- name: github-token
secret:
secretName: github-token
restartPolicy: Never
---
apiVersion: batch/v1
kind: Job
metadata:
name: web-builder
spec:
template:
spec:
imagePullSecrets:
- name: reg-cred-secret
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
initContainers:
- name: init-web
image: reg.jobico.org/buildah
command:
- /script/build.sh
- init
- --repository=https://github.com/andrescosta/todo-jobico-cloud
- --branch=argocd-helm
- --build-dir=todo-web/
- --registry=reg.jobico.org
- --image-name=todoweb
- --current-version=1.1
- --work-dir=/repo
- --helm-repository=https://oauth2:{token}@github.com/andrescosta/todo-charts
- --helm-branch=main
- --helm-chart=todo-web-jobico
- --helm-version=0.4
- --git-user=builder
- --git-email=builder@git
- --frequency=30
- --token-file=/token/token_git_hub.private
- --first-build
- --verbose
volumeMounts:
- name: script
mountPath: "/script"
- name: builder-vol
mountPath: "/repo"
- name: github-token
mountPath: /token
containers:
- name: web-builder
image: reg.jobico.org/buildah
securityContext:
privileged: true
command:
- /repo/todo-web-jobico.sh
volumeMounts:
- name: script
mountPath: "/script"
- name: builder-vol
mountPath: "/repo"
- name: ca
mountPath: "/etc/containers/certs.d/reg.jobico.org"
- name: github-token
mountPath: /token
volumes:
- name: script
configMap:
name: build-map
defaultMode: 0050
- name: builder-vol
persistentVolumeClaim:
claimName: web-builder-pvc
- name: ca
configMap:
name: kube-root-ca.crt
- name: github-token
secret:
secretName: github-token
restartPolicy: Never
5 changes: 3 additions & 2 deletions _infra/bin/build-push-svc.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
docker build ../../todo-svc/ -t reg.jobico.org/todosvc:latest
docker push reg.jobico.org/todosvc:latest
version=$1
docker build ../../todo-svc/ -t reg.jobico.org/todosvc:$version
docker push reg.jobico.org/todosvc:$version
5 changes: 3 additions & 2 deletions _infra/bin/build-push-web.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
docker build ../../todo-web/ -t reg.jobico.org/todoweb:latest
docker push reg.jobico.org/todoweb:latest
version=${1:-$(date +"%Y%m%d%H%M%S")}
docker build ../../todo-web/ -t reg.jobico.org/todoweb:$version
docker push reg.jobico.org/todoweb:$version
5 changes: 0 additions & 5 deletions _infra/bin/deploy-svc.sh

This file was deleted.

5 changes: 0 additions & 5 deletions _infra/bin/deploy-web.sh

This file was deleted.

20 changes: 0 additions & 20 deletions _infra/bin/deploy.sh

This file was deleted.

4 changes: 4 additions & 0 deletions _infra/bin/helm-argocd/del-argo-helm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pushd ../
kubectl delete -f ../argocd/jobs.yaml
kubectl delete -f ../argocd/apps.yaml -n argocd
popd
5 changes: 5 additions & 0 deletions _infra/bin/helm-argocd/setup-argo-helm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pushd ../
kubectl create secret generic github-token --from-file=../id/token_git_hub.private
kubectl apply -f ../argocd/jobs.yaml
kubectl apply -f ../argocd/apps.yaml -n argocd
popd
5 changes: 5 additions & 0 deletions _infra/bin/helm-local/build-svc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pushd ../
version=$(date +"%Y%m%d%H%M%S")
./build-push-svc.sh $version
helm upgrade todosvc ../helm/charts/todo-svc-jobico/ --set=image.tag=$version
popd
5 changes: 5 additions & 0 deletions _infra/bin/helm-local/build-web.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pushd ../
version=$(date +"%Y%m%d%H%M%S")
./build-push-web.sh $version
helm upgrade todoweb ../helm/charts/todo-web-jobico/ --set=image.tag=$version
popd
7 changes: 7 additions & 0 deletions _infra/bin/helm-local/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pushd ../
version=$(date +"%Y%m%d%H%M%S")
./build-push-svc.sh $version
./build-push-web.sh $version
helm install todosvc ../helm/charts/todo-svc-jobico/ --set=image.tag=$version
helm install todoweb ../helm/charts/todo-web-jobico/ --set=image.tag=$version
popd
4 changes: 4 additions & 0 deletions _infra/bin/helm-oci/build-svc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pushd ../
./build-push-svc.sh 1.0
popd
helm upgrade todosvc oci://reg.jobico.org/helm-charts/todo-svc-jobico
4 changes: 4 additions & 0 deletions _infra/bin/helm-oci/build-web.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pushd ../
./build-push-web.sh 1.0
popd
helm upgrade todoweb oci://reg.jobico.org/helm-charts/todo-web-jobico
7 changes: 7 additions & 0 deletions _infra/bin/helm-oci/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version=1.0
pushd ../
./build-push-web.sh $version
./build-push-svc.sh $version
popd
helm install todosvc oci://reg.jobico.org/helm-charts/todo-svc-jobico --set mode.dev.enabled=true --set=image.tag=$version
helm install todoweb oci://reg.jobico.org/helm-charts/todo-web-jobico --set mode.dev.enabled=true --set=image.tag=$version
5 changes: 5 additions & 0 deletions _infra/bin/helm-oci/pkg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version=1.0
helm package ../../helm/charts/todo-web-jobico/ -d ../../charts --version=$version --app-version=$version
helm package ../../helm/charts/todo-svc-jobico/ -d ../../charts --version=$version --app-version=$version
helm push ../../charts/todo-svc-jobico-${version}.tgz oci://reg.jobico.org/helm-charts
helm push ../../charts/todo-web-jobico-${version}.tgz oci://reg.jobico.org/helm-charts
1 change: 1 addition & 0 deletions _infra/helm
Submodule helm added at b98ce1
15 changes: 0 additions & 15 deletions _infra/manifests/prometheus.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions _infra/manifests/todo-web-deployment.yaml

This file was deleted.

Loading

0 comments on commit dd139dd

Please sign in to comment.