Skip to content

Commit 723b0b0

Browse files
Merge pull request #1 from justgithubaccount/feat/complete-gitops-migration
feat: Complete GitOps migration with multi-env support
2 parents 5c56bf5 + 54d11bf commit 723b0b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+734
-148
lines changed

.github/workflows/release.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**.md'
9+
- '.github/workflows/validate.yaml'
10+
11+
permissions:
12+
contents: write
13+
issues: write
14+
pull-requests: write
15+
16+
jobs:
17+
release:
18+
name: Semantic Release
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
persist-credentials: false
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 'lts/*'
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Release
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
run: npx semantic-release

.github/workflows/validate.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
env: [dev]
16+
env: [dev, tst, stg, prd]
1717
steps:
1818
- uses: actions/checkout@v4
1919

@@ -29,7 +29,10 @@ jobs:
2929
kubectl kustomize clusters/${{ matrix.env }}/ > rendered.yaml
3030
3131
- name: Kubeconform validation
32-
run: kubeconform -summary -strict rendered.yaml
32+
run: |
33+
kubeconform -summary -strict \
34+
-skip Application,ApplicationSet,Certificate,ClusterIssuer,SealedSecret \
35+
rendered.yaml
3336
3437
- name: OPA policy check
3538
run: |

.releaserc.json

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
[
5+
"@semantic-release/commit-analyzer",
6+
{
7+
"preset": "conventionalcommits",
8+
"releaseRules": [
9+
{"type": "feat", "release": "minor"},
10+
{"type": "fix", "release": "patch"},
11+
{"type": "perf", "release": "patch"},
12+
{"type": "revert", "release": "patch"},
13+
{"type": "docs", "release": "patch"},
14+
{"type": "style", "release": "patch"},
15+
{"type": "refactor", "release": "patch"},
16+
{"type": "test", "release": "patch"},
17+
{"type": "ci", "release": "patch"},
18+
{"type": "chore", "release": "patch"},
19+
{"type": "build", "release": "patch"},
20+
{"breaking": true, "release": "major"},
21+
{"scope": "no-release", "release": false}
22+
],
23+
"parserOpts": {
24+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
25+
}
26+
}
27+
],
28+
[
29+
"@semantic-release/release-notes-generator",
30+
{
31+
"preset": "conventionalcommits",
32+
"presetConfig": {
33+
"types": [
34+
{"type": "feat", "section": "🚀 Features"},
35+
{"type": "fix", "section": "🐛 Bug Fixes"},
36+
{"type": "perf", "section": "⚡ Performance Improvements"},
37+
{"type": "revert", "section": "⏪ Reverts"},
38+
{"type": "docs", "section": "📚 Documentation"},
39+
{"type": "style", "section": "💄 Styles"},
40+
{"type": "refactor", "section": "♻️ Code Refactoring"},
41+
{"type": "test", "section": "✅ Tests"},
42+
{"type": "ci", "section": "🔧 CI/CD"},
43+
{"type": "chore", "section": "🏗️ Chores"},
44+
{"type": "build", "section": "📦 Build System"}
45+
]
46+
},
47+
"writerOpts": {
48+
"commitsSort": ["subject", "scope"]
49+
}
50+
}
51+
],
52+
[
53+
"@semantic-release/changelog",
54+
{
55+
"changelogFile": "CHANGELOG.md"
56+
}
57+
],
58+
[
59+
"@semantic-release/github",
60+
{
61+
"assets": [
62+
{
63+
"path": "CHANGELOG.md",
64+
"label": "Changelog"
65+
}
66+
],
67+
"successComment": false,
68+
"failComment": false,
69+
"releasedLabels": false
70+
}
71+
],
72+
[
73+
"@semantic-release/git",
74+
{
75+
"assets": ["CHANGELOG.md"],
76+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
77+
}
78+
]
79+
]
80+
}

clusters/dev/bootstrap.yaml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
1-
# clusters/dev/bootstrap.yaml
21
apiVersion: argoproj.io/v1alpha1
32
kind: Application
43
metadata:
54
name: root-app-dev
65
namespace: argocd
6+
labels:
7+
tier: argocd
8+
finalizers:
9+
- resources-finalizer.argocd.argoproj.io
710
spec:
11+
destination:
12+
namespace: argocd
13+
name: in-cluster
14+
project: default
815
source:
9-
repoURL: https://github.com/justgithubaccount/app-release.git
10-
path: platform/core/cluster-bootstrap
16+
repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s.git
17+
path: clusters/dev
1118
targetRevision: main
12-
destination:
13-
server: https://kubernetes.default.svc
14-
namespace: argocd
19+
syncPolicy:
20+
automated:
21+
allowEmpty: true
22+
selfHeal: true
23+
prune: true
24+
syncOptions:
25+
- Validate=true
26+
- CreateNamespace=true
27+
- PruneLast=true

clusters/dev/chat-values.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

clusters/prd/bootstrap.yaml

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1-
# clusters/prd/bootstrap.yaml
2-
# Uncomment when prd cluster is ready
3-
4-
# apiVersion: argoproj.io/v1alpha1
5-
# kind: Application
6-
# metadata:
7-
# name: root-app-prd
8-
# namespace: argocd
9-
# spec:
10-
# source:
11-
# repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s.git
12-
# path: platform/core/cluster-bootstrap
13-
# targetRevision: main
14-
# destination:
15-
# name: prd
16-
# namespace: argocd
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: root-app-prd
5+
namespace: argocd
6+
labels:
7+
tier: argocd
8+
finalizers:
9+
- resources-finalizer.argocd.argoproj.io
10+
spec:
11+
destination:
12+
namespace: argocd
13+
name: prd-cluster
14+
project: default
15+
source:
16+
repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s.git
17+
path: clusters/prd
18+
targetRevision: main
19+
syncPolicy:
20+
automated:
21+
allowEmpty: true
22+
selfHeal: true
23+
prune: true
24+
syncOptions:
25+
- Validate=true
26+
- CreateNamespace=true
27+
- PruneLast=true

clusters/prd/destination.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# apiVersion: argoproj.io/v1alpha1
2-
# kind: Application
3-
# metadata:
4-
# name: all # имя здесь неважно – патч применится по kind
5-
# spec:
6-
# destination:
7-
# name: prd # ТОЧНОЕ имя prod-кластера из `argocd cluster list`
8-
# namespace: argocd # можно опустить, если в base уже указано
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: all
5+
namespace: argocd
6+
spec:
7+
project: default
8+
destination:
9+
name: prd-cluster

clusters/prd/kustomization.yaml

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,29 @@
1-
# apiVersion: kustomize.config.k8s.io/v1beta1
2-
# kind: Kustomization
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
33

4-
# namePrefix: prd-
4+
resources:
5+
# Security
6+
- ../../platform/infrastructure/security/sealed-secrets/base
7+
- ../../platform/infrastructure/security/reflector/base
8+
- ../../platform/infrastructure/security/external-secrets/base
9+
# Networking
10+
- ../../platform/infrastructure/networking/nginx/base
11+
- ../../platform/infrastructure/networking/cert-manager/base
12+
- ../../platform/infrastructure/networking/external-dns/base
13+
# Storage
14+
- ../../platform/infrastructure/storage/longhorn/base
15+
# AI Platform
16+
- ../../platform/infrastructure/ai-platform/open-webui/base
17+
# Observability
18+
- ../../platform/observability/monitoring/loki
19+
- ../../platform/observability/monitoring/grafana
20+
- ../../platform/observability/opentelemetry/collector/otel-collector
21+
# GitOps
22+
- ../../platform/gitops/argocd-image-updater
23+
# Tenants (uncomment when ready for production)
24+
# - ../../tenants/product-team/apps/chat/base
525

6-
# resources:
7-
# - ../../../base/addons/ingress-nginx
8-
# - ../../../base/addons/cert-manager
9-
# - ../../../base/addons/external-dns
10-
# - ../../../base/addons/observability/loki
11-
# - ../../../base/addons/observability/grafana
12-
# - ../../../base/addons/longhorn
13-
# - ../../../base/services/agent/chat
14-
# - ../../../base/services/llm/gateway
15-
16-
# # patches:
17-
# # # Исправляем CLUSTER placeholder для всех Applications
18-
# # - target:
19-
# # kind: Application
20-
# # patch: |-
21-
# # - op: replace
22-
# # path: /spec/destination/name
23-
# # value: prd
24-
# # - op: replace
25-
# # path: /spec/destination/server
26-
# # value: https://kubernetes.default.svc
27-
28-
# patches:
29-
# - target:
30-
# kind: Application
31-
# patch: |-
32-
# - op: remove
33-
# path: /spec/destination/name
34-
# - op: replace
35-
# path: /spec/destination/server
36-
# value: https://kubernetes.default.svc
26+
patches:
27+
- path: destination.yaml
28+
target:
29+
kind: Application

clusters/stg/bootstrap.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: root-app-stg
5+
namespace: argocd
6+
labels:
7+
tier: argocd
8+
finalizers:
9+
- resources-finalizer.argocd.argoproj.io
10+
spec:
11+
destination:
12+
namespace: argocd
13+
name: stg-cluster
14+
project: default
15+
source:
16+
repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s.git
17+
path: clusters/stg
18+
targetRevision: main
19+
syncPolicy:
20+
automated:
21+
allowEmpty: true
22+
selfHeal: true
23+
prune: true
24+
syncOptions:
25+
- Validate=true
26+
- CreateNamespace=true
27+
- PruneLast=true

clusters/stg/destination.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: all
5+
namespace: argocd
6+
spec:
7+
project: default
8+
destination:
9+
name: stg-cluster

0 commit comments

Comments
 (0)