feat(portfolio): add staging environment

This commit is contained in:
David Landry 2024-10-16 18:41:07 -04:00
parent 0dda9f282d
commit 13ea8de355
11 changed files with 339 additions and 0 deletions

View file

@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: portfolio
spec:
replicas: 1
selector:
matchLabels:
app: portfolio
template:
metadata:
annotations:
labels:
app: portfolio
spec:
containers:
- image: registry.int.nc.landry.land/portfolio-site
name: portfolio-site
ports:
- containerPort: 8080
name: http
restartPolicy: Always

View file

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./deployment.yaml
- ./service.yaml

View file

@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
annotations:
labels:
name: syncthing
spec:
ports:
- name: http
port: 80
targetPort: http
selector:
app: syncthing

View file

@ -0,0 +1,11 @@
{
"appName": "portfolio",
"userGivenName": "portfolio",
"destNamespace": "staging-sites",
"destServer": "https://kubernetes.default.svc",
"srcPath": "apps/portfolio/overlays/staging-sites",
"srcRepoURL": "ssh://git@gitea-ssh.gitops.svc.cluster.local:2222/davad/argo.git",
"srcTargetRevision": "",
"labels": null,
"annotations": null
}

View file

@ -0,0 +1,31 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: portfolio
labels:
app.kubernetes.io/name: portfolio
annotations:
cert-manager.io/cluster-issuer: letsencrypt-issuer
nginx.ingress.kubernetes.io/whitelist-source-range: 192.168.1.1/16
gethomepage.dev/enabled: "true"
gethomepage.dev/name: Portfolio
gethomepage.dev/group: Sites
gethomepage.dev/href: https://portfolio-test.int.nc.landry.land
# gethomepage.dev/description:
# gethomepage.dev/icon: syncthing
spec:
tls:
- hosts:
- "portfolio-test.int.nc.landry.land"
rules:
- host: "portfolio-test.int.nc.landry.land"
http:
paths:
- path: "/"
pathType: Prefix
backend:
service:
name: portfolio
port:
name: http

View file

@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
- ./ingress.yaml
images:
- name: registry.int.nc.landry.land/portfolio-site
newTag: latest

View file

@ -0,0 +1,11 @@
{
"appName": "portfolio",
"userGivenName": "portfolio",
"destNamespace": "staging-sites",
"destServer": "https://kubernetes.default.svc",
"srcPath": "apps/portfolio/overlays/staging-sites",
"srcRepoURL": "ssh://git@gitea-ssh.gitops.svc.cluster.local:2222/davad/argo.git",
"srcTargetRevision": "",
"labels": null,
"annotations": null
}

View file

@ -0,0 +1,31 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: portfolio
labels:
app.kubernetes.io/name: portfolio
annotations:
cert-manager.io/cluster-issuer: letsencrypt-issuer
nginx.ingress.kubernetes.io/whitelist-source-range: 192.168.1.1/16
gethomepage.dev/enabled: "true"
gethomepage.dev/name: Portfolio
gethomepage.dev/group: Sites
gethomepage.dev/href: https://portfolio-test.int.nc.landry.land
# gethomepage.dev/description:
# gethomepage.dev/icon: syncthing
spec:
tls:
- hosts:
- "portfolio-test.int.nc.landry.land"
rules:
- host: "portfolio-test.int.nc.landry.land"
http:
paths:
- path: "/"
pathType: Prefix
backend:
service:
name: portfolio
port:
name: http

View file

@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
- ./ingress.yaml
images:
- name: registry.int.nc.landry.land/portfolio-site
newTag: staging

98
projects/prod-sites.yaml Normal file
View file

@ -0,0 +1,98 @@
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
annotations:
argocd-autopilot.argoproj-labs.io/default-dest-server: https://kubernetes.default.svc
argocd.argoproj.io/sync-options: PruneLast=true
argocd.argoproj.io/sync-wave: "-2"
creationTimestamp: null
name: prod-sites
namespace: argocd
spec:
clusterResourceWhitelist:
- group: "*"
kind: "*"
description: prod version of static sites
destinations:
- namespace: "prod-sites"
server: "*"
namespaceResourceWhitelist:
- group: "*"
kind: "*"
sourceRepos:
- "*"
status: {}
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
annotations:
argocd.argoproj.io/sync-wave: "0"
creationTimestamp: null
name: prod-sites
namespace: argocd
spec:
generators:
- git:
files:
- path: apps/**/prod-sites/config.json
repoURL: ssh://git@gitea-ssh.gitops.svc.cluster.local:2222/davad/argo.git
requeueAfterSeconds: 20
revision: ""
template:
metadata: {}
spec:
destination: {}
project: ""
- git:
files:
- path: apps/**/prod-sites/config_dir.json
repoURL: ssh://git@gitea-ssh.gitops.svc.cluster.local:2222/davad/argo.git
requeueAfterSeconds: 20
revision: ""
template:
metadata: {}
spec:
destination: {}
project: ""
source:
directory:
exclude: "{{ exclude }}"
include: "{{ include }}"
jsonnet: {}
recurse: true
repoURL: ""
syncPolicy: {}
template:
metadata:
labels:
app.kubernetes.io/managed-by: argocd-autopilot
app.kubernetes.io/name: "{{ appName }}"
name: prod-sites-{{ userGivenName }}
namespace: argocd
spec:
destination:
namespace: "{{ destNamespace }}"
server: "{{ destServer }}"
ignoreDifferences:
- group: argoproj.io
jsonPointers:
- /status
kind: Application
project: prod-sites
source:
path: "{{ srcPath }}"
repoURL: "{{ srcRepoURL }}"
targetRevision: "{{ srcTargetRevision }}"
syncPolicy:
automated:
allowEmpty: true
prune: true
selfHeal: true
status: {}
---
apiVersion: v1
kind: Namespace
metadata:
name: prod-sites

View file

@ -0,0 +1,98 @@
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
annotations:
argocd-autopilot.argoproj-labs.io/default-dest-server: https://kubernetes.default.svc
argocd.argoproj.io/sync-options: PruneLast=true
argocd.argoproj.io/sync-wave: "-2"
creationTimestamp: null
name: staging-sites
namespace: argocd
spec:
clusterResourceWhitelist:
- group: "*"
kind: "*"
description: staging version of static sites
destinations:
- namespace: "staging-sites"
server: "*"
namespaceResourceWhitelist:
- group: "*"
kind: "*"
sourceRepos:
- "*"
status: {}
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
annotations:
argocd.argoproj.io/sync-wave: "0"
creationTimestamp: null
name: staging-sites
namespace: argocd
spec:
generators:
- git:
files:
- path: apps/**/staging-sites/config.json
repoURL: ssh://git@gitea-ssh.gitops.svc.cluster.local:2222/davad/argo.git
requeueAfterSeconds: 20
revision: ""
template:
metadata: {}
spec:
destination: {}
project: ""
- git:
files:
- path: apps/**/staging-sites/config_dir.json
repoURL: ssh://git@gitea-ssh.gitops.svc.cluster.local:2222/davad/argo.git
requeueAfterSeconds: 20
revision: ""
template:
metadata: {}
spec:
destination: {}
project: ""
source:
directory:
exclude: "{{ exclude }}"
include: "{{ include }}"
jsonnet: {}
recurse: true
repoURL: ""
syncPolicy: {}
template:
metadata:
labels:
app.kubernetes.io/managed-by: argocd-autopilot
app.kubernetes.io/name: "{{ appName }}"
name: staging-sites-{{ userGivenName }}
namespace: argocd
spec:
destination:
namespace: "{{ destNamespace }}"
server: "{{ destServer }}"
ignoreDifferences:
- group: argoproj.io
jsonPointers:
- /status
kind: Application
project: staging-sites
source:
path: "{{ srcPath }}"
repoURL: "{{ srcRepoURL }}"
targetRevision: "{{ srcTargetRevision }}"
syncPolicy:
automated:
allowEmpty: true
prune: true
selfHeal: true
status: {}
---
apiVersion: v1
kind: Namespace
metadata:
name: staging-sites