committed by
GitHub
14 changed files with 223 additions and 2 deletions
@ -0,0 +1,48 @@ |
|||||
|
kubectl create ns guestbook |
||||
|
kc create ns helm-guestbook |
||||
|
kc create ns prod-kustomize-guestbook |
||||
|
kc create ns dev-kustomize-guestbook |
||||
|
|
||||
|
|
||||
|
argocd app create guestbook \ |
||||
|
--repo https://github.com/radtac-craft/argocd-example-apps.git \ |
||||
|
--path guestbook \ |
||||
|
--dest-server https://kubernetes.default.svc \ |
||||
|
--dest-namespace guestbook |
||||
|
|
||||
|
argocd app sync guestbook |
||||
|
argocd app wait guestbook --sync |
||||
|
|
||||
|
|
||||
|
argocd app create helm-guestbook \ |
||||
|
--repo https://github.com/radtac-craft/argocd-example-apps.git \ |
||||
|
--path helm-guestbook \ |
||||
|
--dest-server https://kubernetes.default.svc \ |
||||
|
--dest-namespace helm-guestbook |
||||
|
|
||||
|
argocd app sync helm-guestbook |
||||
|
argocd app wait helm-guestbook --sync |
||||
|
|
||||
|
KUSTOMIZE - |
||||
|
|
||||
|
PROD: |
||||
|
argocd app create prod-kustomize-guestbook \ |
||||
|
--repo https://github.com/radtac-craft/argocd-example-apps.git \ |
||||
|
--path kustomize-guestbook/overlays/prod \ |
||||
|
--dest-server https://kubernetes.default.svc \ |
||||
|
--dest-namespace prod-kustomize-guestbook \ |
||||
|
--revision HEAD |
||||
|
|
||||
|
argocd app sync prod-kustomize-guestbook |
||||
|
argocd app wait prod-kustomize-guestbook --sync |
||||
|
|
||||
|
DEV: |
||||
|
argocd app create dev-kustomize-guestbook \ |
||||
|
--repo https://github.com/radtac-craft/argocd-example-apps.git \ |
||||
|
--path kustomize-guestbook/overlays/dev \ |
||||
|
--dest-server https://kubernetes.default.svc \ |
||||
|
--dest-namespace dev-kustomize-guestbook \ |
||||
|
--revision dev |
||||
|
|
||||
|
argocd app sync dev-kustomize-guestbook |
||||
|
argocd app wait dev-kustomize-guestbook --sync |
@ -0,0 +1,42 @@ |
|||||
|
node { |
||||
|
timestamps{ |
||||
|
properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '3', numToKeepStr: '7'))]) |
||||
|
|
||||
|
stage('Start argocd') { |
||||
|
withKubeConfig(credentialsId: 'aws-eksctl-kubeconfig', serverUrl: '') { |
||||
|
withCredentials([usernamePassword(credentialsId: 'argocd-devops-lab', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { |
||||
|
// sh""" |
||||
|
sh 'kubectl port-forward svc/argocd-server -n argocd 8080:443&' |
||||
|
sh 'argocd logout 127.0.0.1:8080' |
||||
|
// sh 'echo $PASSWORD' |
||||
|
// sh""" |
||||
|
// echo $PASSWORD |
||||
|
// """ |
||||
|
sh 'argocd login 127.0.0.1:8080 --insecure --username $USERNAME --password $PASSWORD' |
||||
|
sh 'argocd app list' |
||||
|
// """ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
stage('Create app') { |
||||
|
withKubeConfig(credentialsId: 'aws-eksctl-kubeconfig', serverUrl: '') { |
||||
|
sh """ |
||||
|
argocd app create ${env.BRANCH_NAME}-kustomize-guestbook \ |
||||
|
--repo https://github.com/radtac-craft/argocd-example-apps.git \ |
||||
|
--path kustomize-guestbook/overlays/${env.BRANCH_NAME} \ |
||||
|
--dest-server https://kubernetes.default.svc \ |
||||
|
--dest-namespace ${env.BRANCH_NAME}-kustomize-guestbook |
||||
|
""" |
||||
|
sh 'argocd app sync $BRANCH_NAME-kustomize-guestbook' |
||||
|
sh 'argocd app wait $BRANCH_NAME-kustomize-guestbook --sync' |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
stage('Verify app') { |
||||
|
withKubeConfig(credentialsId: 'aws-eksctl-kubeconfig', serverUrl: '') { |
||||
|
sh 'argocd app list' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
apiVersion: extensions/v1beta1 |
||||
|
kind: Ingress |
||||
|
metadata: |
||||
|
name: guestbook-ingress |
||||
|
namespace: guestbook |
||||
|
labels: |
||||
|
app.kubernetes.io/component: server |
||||
|
app.kubernetes.io/name: guestbook-server |
||||
|
app.kubernetes.io/part-of: guestbook |
||||
|
annotations: |
||||
|
kubernetes.io/ingress.class: traefik |
||||
|
spec: |
||||
|
rules: |
||||
|
- host: guestbook-argocd.natwest-labs.com |
||||
|
http: |
||||
|
paths: |
||||
|
- backend: |
||||
|
serviceName: guestbook-ui |
||||
|
servicePort: 80 |
||||
|
path: / |
@ -0,0 +1,16 @@ |
|||||
|
apiVersion: argoproj.io/v1alpha1 |
||||
|
kind: Application |
||||
|
metadata: |
||||
|
name: guestbook |
||||
|
namespace: argocd |
||||
|
# finalizers: |
||||
|
# - resources-finalizer.argocd.argoproj.io |
||||
|
spec: |
||||
|
destination: |
||||
|
namespace: kustomize-guestbook |
||||
|
server: https://kubernetes.default.svc |
||||
|
project: default |
||||
|
source: |
||||
|
path: kustomize-guestbook |
||||
|
repoURL: https://github.com/radtac-craft/argocd-example-apps.git |
||||
|
targetRevision: HEAD |
@ -0,0 +1,20 @@ |
|||||
|
apiVersion: extensions/v1beta1 |
||||
|
kind: Ingress |
||||
|
metadata: |
||||
|
name: guestbook-ingress |
||||
|
# namespace: guestbook |
||||
|
labels: |
||||
|
app.kubernetes.io/component: server |
||||
|
app.kubernetes.io/name: guestbook-server |
||||
|
app.kubernetes.io/part-of: guestbook |
||||
|
annotations: |
||||
|
kubernetes.io/ingress.class: traefik |
||||
|
spec: |
||||
|
rules: |
||||
|
- host: kustomize-guestbook-argocd.natwest-labs.com |
||||
|
http: |
||||
|
paths: |
||||
|
- backend: |
||||
|
serviceName: guestbook-ui |
||||
|
servicePort: 80 |
||||
|
path: / |
@ -1,7 +1,10 @@ |
|||||
|
apiVersion: kustomize.config.k8s.io/v1beta1 |
||||
|
kind: Kustomization |
||||
|
|
||||
namePrefix: kustomize- |
namePrefix: kustomize- |
||||
|
|
||||
resources: |
resources: |
||||
- guestbook-ui-deployment.yaml |
- guestbook-ui-deployment.yaml |
||||
- guestbook-ui-svc.yaml |
- guestbook-ui-svc.yaml |
||||
apiVersion: kustomize.config.k8s.io/v1beta1 |
- ingress.yaml |
||||
kind: Kustomization |
- argo-app.yaml |
@ -0,0 +1,16 @@ |
|||||
|
apiVersion: argoproj.io/v1alpha1 |
||||
|
kind: Application |
||||
|
metadata: |
||||
|
name: guestbook |
||||
|
namespace: argocd |
||||
|
# finalizers: |
||||
|
# - resources-finalizer.argocd.argoproj.io |
||||
|
spec: |
||||
|
destination: |
||||
|
namespace: dev-kustomize-guestbook |
||||
|
server: https://kubernetes.default.svc |
||||
|
project: default |
||||
|
source: |
||||
|
path: kustomize-guestbook/overlays/dev |
||||
|
repoURL: https://github.com/radtac-craft/argocd-example-apps.git |
||||
|
targetRevision: dev |
@ -0,0 +1,14 @@ |
|||||
|
apiVersion: extensions/v1beta1 |
||||
|
kind: Ingress |
||||
|
metadata: |
||||
|
name: guestbook-ingress |
||||
|
namespace: |
||||
|
spec: |
||||
|
rules: |
||||
|
- host: dev-kustomize-guestbook-argocd-check-deploy.natwest-labs.com |
||||
|
http: |
||||
|
paths: |
||||
|
- backend: |
||||
|
serviceName: guestbook-ui |
||||
|
servicePort: 80 |
||||
|
path: / |
@ -0,0 +1,6 @@ |
|||||
|
bases: |
||||
|
- ../../base |
||||
|
namePrefix: dev- |
||||
|
patchesStrategicMerge: |
||||
|
- ingress.yaml |
||||
|
- argo-app.yaml |
@ -0,0 +1,16 @@ |
|||||
|
apiVersion: argoproj.io/v1alpha1 |
||||
|
kind: Application |
||||
|
metadata: |
||||
|
name: guestbook |
||||
|
namespace: argocd |
||||
|
# finalizers: |
||||
|
# - resources-finalizer.argocd.argoproj.io |
||||
|
spec: |
||||
|
destination: |
||||
|
namespace: prod-kustomize-guestbook |
||||
|
server: https://kubernetes.default.svc |
||||
|
project: default |
||||
|
source: |
||||
|
path: kustomize-guestbook/overlays/prod |
||||
|
repoURL: https://github.com/radtac-craft/argocd-example-apps.git |
||||
|
targetRevision: HEAD |
@ -0,0 +1,14 @@ |
|||||
|
apiVersion: extensions/v1beta1 |
||||
|
kind: Ingress |
||||
|
metadata: |
||||
|
name: guestbook-ingress |
||||
|
namespace: |
||||
|
spec: |
||||
|
rules: |
||||
|
- host: kustomize-guestbook-argocd.natwest-labs.com |
||||
|
http: |
||||
|
paths: |
||||
|
- backend: |
||||
|
serviceName: guestbook-ui |
||||
|
servicePort: 80 |
||||
|
path: / |
@ -0,0 +1,6 @@ |
|||||
|
bases: |
||||
|
- ../../base |
||||
|
namePrefix: prod- |
||||
|
patchesStrategicMerge: |
||||
|
- ingress.yaml |
||||
|
- argo-app.yaml |
Loading…
Reference in new issue