chore: bootstrap platform GitOps state

This commit is contained in:
dahyeon committed 2026-06-01 00:32:02 +09:00
commit a833be1d9e
40 files changed
+733

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
# platform-state
GitOps state for the `main` k3s cluster platform layer.
This repository owns cluster infrastructure and Argo CD operating state. Service
workloads should live in the separate `service-state` repository.
## Layout
- `bootstrap/`: manual bootstrap entrypoints for Argo CD.
- `argocd/`: Argo CD projects, ApplicationSets, and Applications.
- `clusters/main/`: cluster-level namespaces, repository metadata, and shared values.
- `platform/`: platform components and their values/resources.
## Ownership
- Platform infrastructure: this repository.
- Application deployment state: `service-state`.
- Bootstrap credentials and machine identity IDs: created manually in Kubernetes,
not committed to Git.
@@ -0,0 +1,22 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cert-manager-resources
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "1"
spec:
project: platform
source:
repoURL: https://git.dahyeon.us/dahyeon/platform-state.git
targetRevision: main
path: platform/cert-manager/resources
destination:
server: https://kubernetes.default.svc
namespace: cert-manager
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
+21
View File
@@ -0,0 +1,21 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cluster-main
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "-10"
spec:
project: platform
source:
repoURL: https://git.dahyeon.us/dahyeon/platform-state.git
targetRevision: main
path: clusters/main
destination:
server: https://kubernetes.default.svc
namespace: argocd
syncPolicy:
automated:
prune: true
selfHeal: true
@@ -0,0 +1,22 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: infisical-resources
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "-3"
spec:
project: platform
source:
repoURL: https://git.dahyeon.us/dahyeon/platform-state.git
targetRevision: main
path: platform/infisical-operator/resources
destination:
server: https://kubernetes.default.svc
namespace: infisical
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: platform-ingresses
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "4"
spec:
project: platform
source:
repoURL: https://git.dahyeon.us/dahyeon/platform-state.git
targetRevision: main
path: platform/argocd/resources
destination:
server: https://kubernetes.default.svc
namespace: argocd
syncPolicy:
automated:
prune: true
selfHeal: true
+22
View File
@@ -0,0 +1,22 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: tekton-config
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "4"
spec:
project: platform
source:
repoURL: https://git.dahyeon.us/dahyeon/platform-state.git
targetRevision: main
path: platform/tekton/config
destination:
server: https://kubernetes.default.svc
namespace: tekton-pipelines
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
@@ -0,0 +1,55 @@
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: platform-core-addons
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "-5"
spec:
goTemplate: true
goTemplateOptions: ["missingkey=error"]
generators:
- list:
elements:
- name: infisical-operator
namespace: infisical
chartRepo: https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/
chart: secrets-operator
version: 0.10.32
valuesPath: platform/infisical-operator/values/main.yaml
- name: cert-manager
namespace: cert-manager
chartRepo: https://charts.jetstack.io
chart: cert-manager
version: v1.20.2
valuesPath: platform/cert-manager/values/main.yaml
- name: haproxy-ingress
namespace: haproxy-controller
chartRepo: https://haproxytech.github.io/helm-charts
chart: kubernetes-ingress
version: 1.52.0
valuesPath: platform/haproxy-ingress/values/main.yaml
template:
metadata:
name: "{{.name}}"
spec:
project: platform
sources:
- repoURL: "{{.chartRepo}}"
chart: "{{.chart}}"
targetRevision: "{{.version}}"
helm:
valueFiles:
- "$values/{{.valuesPath}}"
- repoURL: https://git.dahyeon.us/dahyeon/platform-state.git
targetRevision: main
ref: values
destination:
server: https://kubernetes.default.svc
namespace: "{{.namespace}}"
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
@@ -0,0 +1,34 @@
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: platform-operators
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "3"
spec:
goTemplate: true
goTemplateOptions: ["missingkey=error"]
generators:
- list:
elements:
- name: tekton-operator
namespace: tekton-operator
path: platform/tekton/operator
template:
metadata:
name: "{{.name}}"
spec:
project: platform
source:
repoURL: https://git.dahyeon.us/dahyeon/platform-state.git
targetRevision: main
path: "{{.path}}"
destination:
server: https://kubernetes.default.svc
namespace: "{{.namespace}}"
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
@@ -0,0 +1,43 @@
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: platform-secret-backed-addons
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "2"
spec:
goTemplate: true
goTemplateOptions: ["missingkey=error"]
generators:
- list:
elements:
- name: monitoring
namespace: monitoring
chartRepo: https://prometheus-community.github.io/helm-charts
chart: kube-prometheus-stack
version: 85.2.0
valuesPath: platform/monitoring/values/main.yaml
template:
metadata:
name: "{{.name}}"
spec:
project: platform
sources:
- repoURL: "{{.chartRepo}}"
chart: "{{.chart}}"
targetRevision: "{{.version}}"
helm:
valueFiles:
- "$values/{{.valuesPath}}"
- repoURL: https://git.dahyeon.us/dahyeon/platform-state.git
targetRevision: main
ref: values
destination:
server: https://kubernetes.default.svc
namespace: "{{.namespace}}"
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
+31
View File
@@ -0,0 +1,31 @@
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: services-prod
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "20"
spec:
goTemplate: true
goTemplateOptions: ["missingkey=error"]
generators:
- git:
repoURL: https://git.dahyeon.us/dahyeon/service-state.git
revision: main
directories:
- path: apps/*/overlays/prod
template:
metadata:
name: "{{index .path.segments 1}}-prod"
spec:
project: services-prod
source:
repoURL: https://git.dahyeon.us/dahyeon/service-state.git
targetRevision: main
path: "{{.path.path}}"
destination:
server: https://kubernetes.default.svc
namespace: "{{index .path.segments 1}}-prod"
syncPolicy:
syncOptions:
- CreateNamespace=true
@@ -0,0 +1,34 @@
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: services-staging
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "10"
spec:
goTemplate: true
goTemplateOptions: ["missingkey=error"]
generators:
- git:
repoURL: https://git.dahyeon.us/dahyeon/service-state.git
revision: main
directories:
- path: apps/*/overlays/staging
template:
metadata:
name: "{{index .path.segments 1}}-staging"
spec:
project: services-staging
source:
repoURL: https://git.dahyeon.us/dahyeon/service-state.git
targetRevision: main
path: "{{.path.path}}"
destination:
server: https://kubernetes.default.svc
namespace: "{{index .path.segments 1}}-staging"
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
+21
View File
@@ -0,0 +1,21 @@
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: platform
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "-20"
spec:
description: Platform infrastructure for the main cluster
sourceRepos:
- https://git.dahyeon.us/dahyeon/platform-state.git
- "*"
destinations:
- server: https://kubernetes.default.svc
namespace: "*"
clusterResourceWhitelist:
- group: "*"
kind: "*"
namespaceResourceWhitelist:
- group: "*"
kind: "*"
+17
View File
@@ -0,0 +1,17 @@
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: services-prod
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "-20"
spec:
description: Production service workloads from service-state
sourceRepos:
- https://git.dahyeon.us/dahyeon/service-state.git
destinations:
- server: https://kubernetes.default.svc
namespace: "*-prod"
namespaceResourceWhitelist:
- group: "*"
kind: "*"
+17
View File
@@ -0,0 +1,17 @@
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: services-staging
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "-20"
spec:
description: Staging service workloads from service-state
sourceRepos:
- https://git.dahyeon.us/dahyeon/service-state.git
destinations:
- server: https://kubernetes.default.svc
namespace: "*-staging"
namespaceResourceWhitelist:
- group: "*"
kind: "*"
+16
View File
@@ -0,0 +1,16 @@
# Bootstrap
Manual bootstrap boundary for the `main` cluster.
Expected order:
1. Install k3s.
2. Install Argo CD.
3. Create private Gitea repository credentials in the `argocd` namespace.
4. Create the Infisical machine identity Secret in the `infisical` namespace.
5. Apply `bootstrap/root-app.yaml`.
The bootstrap credentials are intentionally not managed by Infisical to avoid a
dependency cycle where Argo CD needs Git access before it can install the
Infisical Operator.
+20
View File
@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: platform-root
namespace: argocd
spec:
project: default
source:
repoURL: https://git.dahyeon.us/dahyeon/platform-state.git
targetRevision: main
path: argocd
directory:
recurse: true
destination:
server: https://kubernetes.default.svc
namespace: argocd
syncPolicy:
automated:
prune: true
selfHeal: true
+6
View File
@@ -0,0 +1,6 @@
clusterName: main
domain: dahyeon.us
ingressClassName: haproxy
timezone: Asia/Seoul
storageClassName: local-path
infisicalUrl: https://secret-manager.dahyeon.us
+5
View File
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespaces.yaml
+65
View File
@@ -0,0 +1,65 @@
apiVersion: v1
kind: Namespace
metadata:
name: argocd
---
apiVersion: v1
kind: Namespace
metadata:
name: infisical
---
apiVersion: v1
kind: Namespace
metadata:
name: cert-manager
---
apiVersion: v1
kind: Namespace
metadata:
name: haproxy-controller
---
apiVersion: v1
kind: Namespace
metadata:
name: monitoring
---
apiVersion: v1
kind: Namespace
metadata:
name: tekton-operator
---
apiVersion: v1
kind: Namespace
metadata:
name: tekton-pipelines
---
apiVersion: v1
kind: Namespace
metadata:
name: api-staging
---
apiVersion: v1
kind: Namespace
metadata:
name: api-prod
---
apiVersion: v1
kind: Namespace
metadata:
name: web-staging
---
apiVersion: v1
kind: Namespace
metadata:
name: web-prod
---
apiVersion: v1
kind: Namespace
metadata:
name: worker-staging
---
apiVersion: v1
kind: Namespace
metadata:
name: worker-prod
+5
View File
@@ -0,0 +1,5 @@
# Public or credential-free repository metadata can live here.
#
# Private Gitea repository credentials for platform-state and service-state are
# bootstrap secrets and should be created manually in the argocd namespace.
+26
View File
@@ -0,0 +1,26 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: argocd-server
namespace: argocd
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
haproxy.org/backend-protocol: h2
spec:
ingressClassName: haproxy
tls:
- hosts:
- argocd.dahyeon.us
secretName: argocd-tls
rules:
- host: argocd.dahyeon.us
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argocd-server
port:
name: https
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ingress.yaml
@@ -0,0 +1,16 @@
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
email: park@dahyeon.us
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
name: letsencrypt-prod
solvers:
- dns01:
cloudflare:
apiTokenSecretRef:
name: cloudflare-api-token-secret
key: api-token
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- clusterissuer-letsencrypt-prod.yaml
+2
View File
@@ -0,0 +1,2 @@
crds:
enabled: true
+9
View File
@@ -0,0 +1,9 @@
# HAProxy Ingress
This component owns the HAProxy Ingress Controller installation values.
Ingress resources are owned by the platform or service that exposes the route:
- Platform routes: this repository.
- Service routes: `service-state`.
@@ -0,0 +1,6 @@
controller:
ingressClass: haproxy
ingressClassResource:
enabled: true
name: haproxy
@@ -0,0 +1,22 @@
apiVersion: secrets.infisical.com/v1beta1
kind: InfisicalAuth
metadata:
name: infisical-auth
namespace: infisical
spec:
infisicalConnectionRef:
name: infisical
namespace: infisical
method: kubernetes
kubernetes:
identityIdRef:
name: infisical-identity
namespace: infisical
key: identityId
serviceAccountRef:
name: infisical-auth
namespace: infisical
# Set this only if the Infisical Kubernetes Auth audience is configured.
# serviceAccountTokenAudiences:
# - infisical
@@ -0,0 +1,7 @@
apiVersion: secrets.infisical.com/v1beta1
kind: InfisicalConnection
metadata:
name: infisical
namespace: infisical
spec:
address: https://secret-manager.dahyeon.us
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: infisical-auth
namespace: infisical
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: infisical-auth-tokenreview
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:auth-delegator
subjects:
- kind: ServiceAccount
name: infisical-auth
namespace: infisical
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- k8s-auth-serviceaccount.yaml
- infisical-connection.yaml
- infisical-auth.yaml
- platform-static-secrets.yaml
@@ -0,0 +1,54 @@
apiVersion: secrets.infisical.com/v1beta1
kind: InfisicalStaticSecret
metadata:
name: cert-manager-cloudflare
namespace: cert-manager
spec:
infisicalAuthRef:
name: infisical-auth
namespace: infisical
syncOptions:
refreshInterval: 60s
instantUpdates: false
sources:
- projectId: 8520b8c0-3796-4fd6-a03c-6f0508c8c42c
environmentSlug: prod
secretPath: /platform/cert-manager
recursive: false
targets:
- name: cloudflare-api-token-secret
namespace: cert-manager
kind: Secret
creationPolicy: Owner
template:
engineVersion: v1
data:
api-token: "{{ .CLOUDFLARE_API_TOKEN.Value }}"
---
apiVersion: secrets.infisical.com/v1beta1
kind: InfisicalStaticSecret
metadata:
name: monitoring-grafana-admin
namespace: monitoring
spec:
infisicalAuthRef:
name: infisical-auth
namespace: infisical
syncOptions:
refreshInterval: 60s
instantUpdates: false
sources:
- projectId: 8520b8c0-3796-4fd6-a03c-6f0508c8c42c
environmentSlug: prod
secretPath: /platform/monitoring
recursive: false
targets:
- name: grafana-admin
namespace: monitoring
kind: Secret
creationPolicy: Owner
template:
engineVersion: v1
data:
admin-user: "{{ .GRAFANA_ADMIN_USER.Value }}"
admin-password: "{{ .GRAFANA_ADMIN_PASSWORD.Value }}"
@@ -0,0 +1,4 @@
# Values for the Infisical Operator Helm chart.
# Pin the chart repository and chart version in argocd/applicationsets.
{}
@@ -0,0 +1,3 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources: []
+7
View File
@@ -0,0 +1,7 @@
grafana:
admin:
existingSecret: grafana-admin
userKey: admin-user
passwordKey: admin-password
ingress:
enabled: false
+24
View File
@@ -0,0 +1,24 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: tekton-dashboard
namespace: tekton-pipelines
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: haproxy
tls:
- hosts:
- tekton.dahyeon.us
secretName: tekton-dashboard-tls
rules:
- host: tekton.dahyeon.us
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: tekton-dashboard
port:
number: 9097
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- tektonconfig.yaml
- ingress.yaml
+8
View File
@@ -0,0 +1,8 @@
apiVersion: operator.tekton.dev/v1alpha1
kind: TektonConfig
metadata:
name: config
spec:
targetNamespace: tekton-pipelines
profile: all
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- https://infra.tekton.dev/tekton-releases/operator/previous/v0.79.1/release.yaml
+2
View File
@@ -0,0 +1,2 @@
# Tekton Operator is pinned in kustomization.yaml:
# https://infra.tekton.dev/tekton-releases/operator/previous/v0.79.1/release.yaml