ArgoCD Deployment
This commit is contained in:
35
deploy/README.md
Normal file
35
deploy/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# deploy/
|
||||
|
||||
Argo CD delivery of demo-vivek-11 to the lab: the hub's Argo CD pushes it to the `apps-lab` spoke
|
||||
through the argocd-agent, and the hub's public kgateway Gateway forwards to it over Private Link.
|
||||
|
||||
```
|
||||
browser ─► hub pe-gatewayapi (demo-vivek-11.apps.lab…) ─► Private Link ─► spoke pe-gatewayapi-int
|
||||
(demo-vivek-11.int.apps.lab…, port 80) ─► Service demo-vivek-11 ─► pod :8080
|
||||
```
|
||||
|
||||
| Folder | Applied to | By |
|
||||
|---|---|---|
|
||||
| `argocd/` | lab **hub** | `kubectl apply` once |
|
||||
| `hub/` | lab **hub** | `kubectl apply` once |
|
||||
| `manifests/` | lab **spoke** | Argo CD, from this repo |
|
||||
|
||||
## Apply
|
||||
|
||||
```bash
|
||||
khub apply -f deploy/argocd/appproject.yaml
|
||||
khub apply -f deploy/argocd/application.yaml
|
||||
khub apply -f deploy/hub/remote-route.yaml
|
||||
```
|
||||
|
||||
## Rules the Application must keep
|
||||
|
||||
- It lives in namespace **`apps-lab`** on the hub: the agent's namespace.
|
||||
- `destination.name: apps-lab`, **never** `destination.server`, which resolves to the hub itself.
|
||||
- `project: apps-lab`. The `default` project has no `sourceNamespaces`, so it refuses an
|
||||
Application in `apps-lab`.
|
||||
|
||||
## Image
|
||||
|
||||
`manifests/kustomization.yaml` pins the tag. Set it to the commit the lab build pushed, and commit:
|
||||
Argo CD deploys what is in Git.
|
||||
22
deploy/argocd/application.yaml
Normal file
22
deploy/argocd/application.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
# Lives on the HUB, in the agent's namespace. The argocd-agent pushes it to the spoke.
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: demo-vivek-11
|
||||
namespace: apps-lab
|
||||
spec:
|
||||
project: apps-lab
|
||||
source:
|
||||
repoURL: https://gitea.kyndemo.live/validate/demo-vivek-11.git
|
||||
targetRevision: main
|
||||
path: deploy/manifests
|
||||
destination:
|
||||
# name, never server: server https://kubernetes.default.svc resolves to the hub itself.
|
||||
name: apps-lab
|
||||
namespace: demo-vivek-11
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
19
deploy/argocd/appproject.yaml
Normal file
19
deploy/argocd/appproject.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
# Scopes Applications in the apps-lab namespace to the apps-lab spoke. Lives on the HUB, in argocd.
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: AppProject
|
||||
metadata:
|
||||
name: apps-lab
|
||||
namespace: argocd
|
||||
spec:
|
||||
description: Workloads delivered to the apps-lab spoke
|
||||
# Without this, Argo CD refuses Applications that live in the apps-lab namespace.
|
||||
sourceNamespaces:
|
||||
- apps-lab
|
||||
sourceRepos:
|
||||
- https://gitea.kyndemo.live/validate/demo-vivek-11.git
|
||||
destinations:
|
||||
- name: apps-lab
|
||||
namespace: "*"
|
||||
clusterResourceWhitelist:
|
||||
- group: ""
|
||||
kind: Namespace
|
||||
43
deploy/hub/remote-route.yaml
Normal file
43
deploy/hub/remote-route.yaml
Normal file
@@ -0,0 +1,43 @@
|
||||
# On the HUB's public Gateway: the public name, forwarded over Private Link to the spoke's internal
|
||||
# Gateway. The same shape the catalog's kgateway-remote-route module creates.
|
||||
#
|
||||
# 10.20.255.100 is the hub's private endpoint to the spoke Gateway (crucible-hub-to-apps-lab-pe).
|
||||
apiVersion: gateway.kgateway.dev/v1alpha1
|
||||
kind: Backend
|
||||
metadata:
|
||||
name: demo-vivek-11
|
||||
namespace: gatewayapi
|
||||
spec:
|
||||
type: Static
|
||||
static:
|
||||
hosts:
|
||||
- host: 10.20.255.100
|
||||
port: 80
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: demo-vivek-11
|
||||
namespace: gatewayapi
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: pe-gatewayapi
|
||||
namespace: gatewayapi
|
||||
sectionName: https
|
||||
hostnames:
|
||||
- demo-vivek-11.apps.lab.crucible.kyndemo.live
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
# The spoke only serves *.int.apps.lab; without the rewrite it answers 404.
|
||||
filters:
|
||||
- type: URLRewrite
|
||||
urlRewrite:
|
||||
hostname: demo-vivek-11.int.apps.lab.crucible.kyndemo.live
|
||||
backendRefs:
|
||||
- name: demo-vivek-11
|
||||
kind: Backend
|
||||
group: gateway.kgateway.dev
|
||||
port: 80
|
||||
59
deploy/manifests/deployment.yaml
Normal file
59
deploy/manifests/deployment.yaml
Normal file
@@ -0,0 +1,59 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: demo-vivek-11
|
||||
labels:
|
||||
app: demo-vivek-11
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: demo-vivek-11
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: demo-vivek-11
|
||||
spec:
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
containers:
|
||||
- name: main
|
||||
image: demo-vivek-11
|
||||
# Only while the tag is `latest`. Remove once kustomization.yaml pins a sha.
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
env:
|
||||
- name: OTEL_SERVICE_NAME
|
||||
value: demo-vivek-11
|
||||
- name: OTEL_EXPORTER_OTLP_ENDPOINT
|
||||
value: http://otel-collector.monitoring.svc.cluster.local:4318
|
||||
- name: OTEL_EXPORTER_OTLP_PROTOCOL
|
||||
value: http/protobuf
|
||||
- name: OTEL_RESOURCE_ATTRIBUTES
|
||||
value: service.name=demo-vivek-11
|
||||
- name: OTEL_METRICS_EXPORTER
|
||||
value: otlp
|
||||
- name: OTEL_TRACES_EXPORTER
|
||||
value: otlp
|
||||
- name: OTEL_LOGS_EXPORTER
|
||||
value: none
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: http
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 20
|
||||
resources:
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 512Mi
|
||||
limits:
|
||||
memory: 1Gi
|
||||
22
deploy/manifests/httproute.yaml
Normal file
22
deploy/manifests/httproute.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
# On the SPOKE's internal Gateway. The hub rewrites Host to this name before forwarding
|
||||
# (deploy/hub/remote-route.yaml), so it must match remote_hostname there.
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: demo-vivek-11
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: pe-gatewayapi-int
|
||||
namespace: gatewayapi
|
||||
# The hub forwards plaintext to port 80 across Private Link.
|
||||
sectionName: http
|
||||
hostnames:
|
||||
- demo-vivek-11.int.apps.lab.crucible.kyndemo.live
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
backendRefs:
|
||||
- name: demo-vivek-11
|
||||
port: 80
|
||||
12
deploy/manifests/kustomization.yaml
Normal file
12
deploy/manifests/kustomization.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: demo-vivek-11
|
||||
resources:
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
- httproute.yaml
|
||||
images:
|
||||
- name: demo-vivek-11
|
||||
newName: cruciblecoredevacr.azurecr.io/demo-vivek-11
|
||||
# Replace with the commit sha "Build and Push to ACR (lab)" pushed.
|
||||
newTag: latest
|
||||
13
deploy/manifests/service.yaml
Normal file
13
deploy/manifests/service.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: demo-vivek-11
|
||||
labels:
|
||||
app: demo-vivek-11
|
||||
spec:
|
||||
selector:
|
||||
app: demo-vivek-11
|
||||
ports:
|
||||
- name: web
|
||||
port: 80
|
||||
targetPort: http
|
||||
Reference in New Issue
Block a user