Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add kustomize deployment for sd3 apps #166

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
78473f6
add api beta deploy
vladimirvshivkov Nov 14, 2024
eb7f5cc
add sd3 front
vladimirvshivkov Nov 14, 2024
23bac48
set front tag
vladimirvshivkov Nov 14, 2024
2c61cc7
add sd3 front
vladimirvshivkov Nov 14, 2024
bb6f020
fix lint
vladimirvshivkov Nov 14, 2024
d75c4fb
ingresses
vladimirvshivkov Nov 15, 2024
07a65b9
chage sa field in deploys
vladimirvshivkov Nov 15, 2024
68ea2bb
adjust indentation
vladimirvshivkov Nov 15, 2024
a631a61
sa fix
vladimirvshivkov Nov 15, 2024
2fd5ea5
new cloudmon vault auth
vladimirvshivkov Nov 15, 2024
a5f2db6
update sa
vladimirvshivkov Nov 15, 2024
20e837e
update sa
vladimirvshivkov Nov 15, 2024
380f850
adjust limits
vladimirvshivkov Nov 15, 2024
1c81f66
change vault auth
vladimirvshivkov Nov 15, 2024
204710a
fix
vladimirvshivkov Nov 15, 2024
bc04392
update api image tag
vladimirvshivkov Nov 19, 2024
0ecfe31
add vault secrets injection
vladimirvshivkov Nov 20, 2024
edfe99e
fix volumemounts
vladimirvshivkov Nov 20, 2024
ab9df2c
change probe path
vladimirvshivkov Nov 20, 2024
1c98cb3
rm probes
vladimirvshivkov Nov 20, 2024
871014f
add cert
vladimirvshivkov Nov 20, 2024
934fb1b
set ingressclass
vladimirvshivkov Nov 20, 2024
6cd0660
ingress fixes
vladimirvshivkov Nov 20, 2024
2cf2ef6
update image tag
vladimirvshivkov Nov 21, 2024
1a97a66
ingress
vladimirvshivkov Nov 21, 2024
c89d656
rm probes
vladimirvshivkov Nov 21, 2024
41a2666
update front tag
vladimirvshivkov Nov 21, 2024
1187ede
update front tag
vladimirvshivkov Nov 21, 2024
619e1cb
add vault injector
vladimirvshivkov Nov 21, 2024
d027214
fix ingress
vladimirvshivkov Nov 21, 2024
282e712
add values for front
vladimirvshivkov Nov 21, 2024
78b088e
values
vladimirvshivkov Nov 21, 2024
4afb7f4
fix linters
vladimirvshivkov Nov 22, 2024
14d4268
update front tag
vladimirvshivkov Nov 26, 2024
40b8dd1
change env
vladimirvshivkov Nov 26, 2024
57bfe9f
update env
vladimirvshivkov Nov 26, 2024
cfadf1a
update tag and remove vault from front
vladimirvshivkov Nov 27, 2024
b114ea3
rm sa
vladimirvshivkov Nov 27, 2024
e545e56
fix linters
vladimirvshivkov Nov 27, 2024
3597e6f
update tag
vladimirvshivkov Nov 28, 2024
ada79cc
Update frontend image tag in kustomization.yaml to sha-4e8fbbe
vladimirvshivkov Dec 13, 2024
91ad4fb
Update frontend image tag in kustomization.yaml to sha-3817ace
vladimirvshivkov Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual Environment
venv/
ENV/
env/
.env/

# IDE
.idea/
.vscode/
*.swp
*.swo
.DS_Store

# Kubernetes
kubeconfig
*.kubeconfig

# Logs and databases
*.log
*.sqlite3
*.db

# Local development
.env
.env.local
.env.*.local

# Coverage reports
htmlcov/
.coverage
.coverage.*
coverage.xml
*.cover

# macos
.DS_Store
87 changes: 87 additions & 0 deletions kustomize/sd3/api/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sd3-api
labels:
app: sd3-api
spec:
replicas: 1
selector:
matchLabels:
app: sd3-api
template:
metadata:
labels:
app: sd3-api
spec:
serviceAccount: sd3
containers:
- name: sd3-api
image: sd3-api
command:
["/bin/sh", "-c"]
args:
['source /secrets/sd3-api-env && "/usr/src/app/app"']
ports:
- containerPort: 8000
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
# livenessProbe:
# httpGet:
# path: /v1/component_status
# port: 8000
# initialDelaySeconds: 30
# periodSeconds: 10
# readinessProbe:
# httpGet:
# path: /v1/component_status
# port: 8000
# initialDelaySeconds: 5
# periodSeconds: 5
volumeMounts:
- mountPath: "/secrets"
name: "secrets"
initContainers:
- name: "vault-agent"
command:
- "sh"
- "-c"
- "vault agent -config=/etc/vault/vault-agent.hcl -exit-after-auth=true"
env:
- name: "VAULT_ADDR"
value: "https://vault-lb.eco.tsi-dev.otc-service.com:8200"
image: "hashicorp/vault"
resources:
limits:
cpu: "300m"
memory: "300Mi"
requests:
cpu: "50m"
memory: "50Mi"
volumeMounts:
- mountPath: "/etc/vault"
name: "vault-agent-config"
- mountPath: "/secrets"
name: "secrets"
- mountPath: "/var/run/secrets/tokens"
name: "k8-tokens"
readOnly: true
volumes:
- name: vault-agent-config
configMap:
defaultMode: 420
name: sd3-vault-config
- name: secrets
emptyDir: {}
- name: "k8-tokens"
projected:
defaultMode: 420
sources:
- serviceAccountToken:
expirationSeconds: 7200
path: "vault-token"
21 changes: 21 additions & 0 deletions kustomize/sd3/api/base/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: sd3-api-ingress
labels:
app: sd3-api
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
ingressClassName: nginx
rules:
- host: api.status.otc-service.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: sd3-api
port:
number: 8000
7 changes: 7 additions & 0 deletions kustomize/sd3/api/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- service.yaml
- deployment.yaml
- ingress.yaml
- sa.yaml
19 changes: 19 additions & 0 deletions kustomize/sd3/api/base/sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: sd3
labels:
app: sd3-api
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: sd3-api-role-tokenreview-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:auth-delegator
subjects:
- kind: ServiceAccount
name: sd3
namespace: sd3-test
14 changes: 14 additions & 0 deletions kustomize/sd3/api/base/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: sd3-api
labels:
app: sd3-api
spec:
ports:
- port: 8000
targetPort: 8000
protocol: TCP
name: http
selector:
app: sd3-api
40 changes: 40 additions & 0 deletions kustomize/sd3/api/overlays/test/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: sd3-test

resources:
- ../../base

images:
- name: sd3-api
newName: quay.io/stackmon/status-dashboard-v3
newTag: sha-13ce6ea

configMapGenerator:
- name: sd3-vault-config
files:
- vault-agent.hcl

patchesStrategicMerge:
- |-
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: sd3-api-ingress
spec:
rules:
- host: api.test.status.otc-service.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: sd3-api
port:
number: 8000
tls:
- hosts:
- api.test.status.otc-service.com
secretName: sd3-cert-test
29 changes: 29 additions & 0 deletions kustomize/sd3/api/overlays/test/vault-agent.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
pid_file = "/home/vault/pidfile"

auto_auth {
method "kubernetes" {
mount_path = "auth/kubernetes_otcinfra2"
config = {
role = "sd3"
token_path = "/var/run/secrets/tokens/vault-token"
}
}
sink "file" {
config = {
path = "/home/vault/.vault-token"
}
}
}

template {
destination = "/secrets/sd3-api-env"
contents = <<EOT
{{ with secret "secret/data/statusdashboard/sd3-test" -}}
export SD_DB={{ .Data.data.dburl }}
export SD_CACHE=internal
export SD_LOG_LEVEL=devel
{{- end }}

EOT
perms = "0664"
}
33 changes: 33 additions & 0 deletions kustomize/sd3/frontend/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sd3-frontend
labels:
app: sd3-frontend
spec:
replicas: 1
selector:
matchLabels:
app: sd3-frontend
template:
metadata:
labels:
app: sd3-frontend
spec:
containers:
- name: sd3-frontend
image: sd3-frontend
command:
["/bin/sh", "-c"]
args:
['nginx -g "daemon off;"']
ports:
- containerPort: 80
name: http
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
22 changes: 22 additions & 0 deletions kustomize/sd3/frontend/base/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: sd3-frontend-ingress
labels:
app: sd3-frontend
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-prod"
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
rules:
- host: status.otc-service.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: sd3-frontend
port:
number: 80
6 changes: 6 additions & 0 deletions kustomize/sd3/frontend/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- service.yaml
- deployment.yaml
- ingress.yaml
13 changes: 13 additions & 0 deletions kustomize/sd3/frontend/base/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: sd3-frontend
labels:
app: sd3-frontend
spec:
selector:
app: sd3-frontend
ports:
- protocol: TCP
port: 80
targetPort: 80
35 changes: 35 additions & 0 deletions kustomize/sd3/frontend/overlays/test/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: sd3-test

images:
- name: sd3-frontend
newName: quay.io/stackmon/status-dashboard-v3-front
newTag: sha-3817ace

resources:
- ../../base

patchesStrategicMerge:
- |-
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: sd3-frontend-ingress
spec:
rules:
- host: test.status.otc-service.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: sd3-frontend
port:
number: 80
tls:
- hosts:
- test.status.otc-service.com
secretName: sd3-front-cert-test