Skip to content

Commit bcc4ee9

Browse files
authored
Grafana
2 parents 0dbcbbd + a8e9b39 commit bcc4ee9

37 files changed

Lines changed: 2384 additions & 59 deletions

README.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ app-1 | {"level":"info","request_id":"d5mqjmhqvtmc73foh3dg","received_time":"20
148148
└── pkg (middleware, logger, validator, ctxutil, paramsutil, errors)
149149
```
150150

151-
ArgoCD and `kustomization` based cloud native IaC & GitOps setup.
151+
## 🏗️ ArgoCD and Kustomize
152+
153+
ArgoCD and `Kustomize` based cloud native IaC & GitOps setup.
152154

153155
> 💡 Consider moving to a Hub-and-Spoke architecture for Argo CD, combined with a separate repository strategy.
154156
@@ -170,11 +172,25 @@ ArgoCD and `kustomization` based cloud native IaC & GitOps setup.
170172
171173
├── components
172174
│ └── myapp-db
173-
└── services
174-
├── base
175-
│ └── myapp
176-
└── overlays
177-
├── dev
178-
├── prod
179-
└── stage
175+
├── services
176+
│ ├── base
177+
│ │ └── myapp
178+
│ └── overlays
179+
│ ├── dev
180+
│ ├── prod
181+
│ └── stage
182+
183+
└── gateways
180184
```
185+
186+
> 💡 Sample Kind Dev Cluster
187+
> kind create cluster --name dev
188+
> kubectl apply -k k8s/bootstrap/argocd
189+
> kubectl apply -k k8s/bootstrap/argocd-config
190+
> kubectl apply -k k8s/platform/istio-ambient
191+
> kubectl apply -k k8s/platform/gateway-api
192+
> kubectl apply -k k8s/gateways
193+
> kubectl port-forward svc/shared-gateway-dev-istio -n istio-ingress 8081:8081 # 💡 Shared Dev Gateway
194+
> curl -X GET 'localhost:8081/myapp/v1/books' --header 'Accept: application/json'
195+
>
196+
> kubectl port-forward svc/argocd-server -n argocd 8080:443 # 💡 ArgoCD Dashboard(admin/password)

k8s/bootstrap/argocd-config/applications/myapp-apps.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
server: https://kubernetes.default.svc
1515
template:
1616
metadata:
17-
name: '{{env}}-myapp'
17+
name: 'myapp-{{env}}'
1818
annotations:
1919
argocd.argoproj.io/sync-wave: '5'
2020
spec:
@@ -25,7 +25,7 @@ spec:
2525
path: 'k8s/services/overlays/{{env}}/myapp'
2626
destination:
2727
name: '{{cluster}}'
28-
namespace: '{{env}}-myapp'
28+
namespace: 'myapp-{{env}}'
2929
syncPolicy:
3030
automated:
3131
prune: true

k8s/bootstrap/argocd-config/applications/platform-apps.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ spec:
2727
repoURL: https://github.com/learning-cloud-native-go/myapp.git
2828
targetRevision: HEAD
2929
path: '{{path}}'
30-
kustomize:
31-
commonLabels:
32-
managed-by: argocd-appset
3330
destination:
3431
name: '{{cluster}}'
3532
namespace: '{{targetNamespace}}'

k8s/bootstrap/argocd-config/applications/platform-cloudnative-pg.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ spec:
1919
repoURL: https://github.com/learning-cloud-native-go/myapp.git
2020
targetRevision: HEAD
2121
path: k8s/platform/cloudnative-pg
22-
kustomize:
23-
commonLabels:
24-
managed-by: argocd-platform
2522
destination:
2623
name: '{{cluster}}'
2724
namespace: cnpg-system

k8s/bootstrap/argocd-config/projects/myapp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ spec:
1111
- https://github.com/learning-cloud-native-go/myapp.git
1212
destinations:
1313
- name: hub-sg-01
14-
namespace: '*-myapp'
14+
namespace: 'myapp-*'
1515

1616
clusterResourceWhitelist:
1717
- group: ''

k8s/components/myapp-db/cluster.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ kind: Cluster
33

44
metadata:
55
name: myapp-db
6+
labels:
7+
app.kubernetes.io/name: myapp
8+
app.kubernetes.io/component: database
9+
app.kubernetes.io/managed-by: cloudnative-pg
610

711
spec:
812
instances: 3

k8s/components/myapp-db/pooler.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ kind: Pooler
33

44
metadata:
55
name: myapp-db-pooler
6+
labels:
7+
app.kubernetes.io/name: myapp
8+
app.kubernetes.io/component: database-pooler
69

710
spec:
811
cluster:

k8s/components/myapp-db/scheduled-backup.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ apiVersion: postgresql.cnpg.io/v1
22
kind: ScheduledBackup
33

44
metadata:
5-
name: myapp-daily-backup
5+
name: myapp-db-daily-backup
6+
labels:
7+
app.kubernetes.io/name: myapp
8+
app.kubernetes.io/component: backup
69

710
spec:
811
schedule: '0 0 0 * * *' # Every day at midnight

k8s/gateways/kustomization.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
namespace: istio-ingress
5+
6+
resources:
7+
- namespace.yaml
8+
- shared-gateway-dev.yaml
9+
- shared-gateway-stage.yaml
10+
- shared-gateway-prod.yaml

k8s/gateways/namespace.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
4+
metadata:
5+
name: istio-ingress

0 commit comments

Comments
 (0)