diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d1f9916 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,38 @@ +name: Release + +on: + push: + branches: + - main + paths-ignore: + - '**.md' + - '.github/workflows/validate.yaml' + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + release: + name: Semantic Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + + - name: Install dependencies + run: npm ci + + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx semantic-release diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 65a03d9..826d7c2 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - env: [dev] + env: [dev, tst, stg, prd] steps: - uses: actions/checkout@v4 @@ -29,7 +29,10 @@ jobs: kubectl kustomize clusters/${{ matrix.env }}/ > rendered.yaml - name: Kubeconform validation - run: kubeconform -summary -strict rendered.yaml + run: | + kubeconform -summary -strict \ + -skip Application,ApplicationSet,Certificate,ClusterIssuer,SealedSecret \ + rendered.yaml - name: OPA policy check run: | diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..3467942 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,80 @@ +{ + "branches": ["main"], + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits", + "releaseRules": [ + {"type": "feat", "release": "minor"}, + {"type": "fix", "release": "patch"}, + {"type": "perf", "release": "patch"}, + {"type": "revert", "release": "patch"}, + {"type": "docs", "release": "patch"}, + {"type": "style", "release": "patch"}, + {"type": "refactor", "release": "patch"}, + {"type": "test", "release": "patch"}, + {"type": "ci", "release": "patch"}, + {"type": "chore", "release": "patch"}, + {"type": "build", "release": "patch"}, + {"breaking": true, "release": "major"}, + {"scope": "no-release", "release": false} + ], + "parserOpts": { + "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"] + } + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits", + "presetConfig": { + "types": [ + {"type": "feat", "section": "🚀 Features"}, + {"type": "fix", "section": "🐛 Bug Fixes"}, + {"type": "perf", "section": "⚡ Performance Improvements"}, + {"type": "revert", "section": "⏪ Reverts"}, + {"type": "docs", "section": "📚 Documentation"}, + {"type": "style", "section": "💄 Styles"}, + {"type": "refactor", "section": "♻️ Code Refactoring"}, + {"type": "test", "section": "✅ Tests"}, + {"type": "ci", "section": "🔧 CI/CD"}, + {"type": "chore", "section": "🏗️ Chores"}, + {"type": "build", "section": "📦 Build System"} + ] + }, + "writerOpts": { + "commitsSort": ["subject", "scope"] + } + } + ], + [ + "@semantic-release/changelog", + { + "changelogFile": "CHANGELOG.md" + } + ], + [ + "@semantic-release/github", + { + "assets": [ + { + "path": "CHANGELOG.md", + "label": "Changelog" + } + ], + "successComment": false, + "failComment": false, + "releasedLabels": false + } + ], + [ + "@semantic-release/git", + { + "assets": ["CHANGELOG.md"], + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + } + ] + ] +} diff --git a/clusters/dev/bootstrap.yaml b/clusters/dev/bootstrap.yaml index 86523b2..34fac6e 100644 --- a/clusters/dev/bootstrap.yaml +++ b/clusters/dev/bootstrap.yaml @@ -1,14 +1,27 @@ -# clusters/dev/bootstrap.yaml apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: root-app-dev namespace: argocd + labels: + tier: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io spec: + destination: + namespace: argocd + name: in-cluster + project: default source: - repoURL: https://github.com/justgithubaccount/app-release.git - path: platform/core/cluster-bootstrap + repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s.git + path: clusters/dev targetRevision: main - destination: - server: https://kubernetes.default.svc - namespace: argocd \ No newline at end of file + syncPolicy: + automated: + allowEmpty: true + selfHeal: true + prune: true + syncOptions: + - Validate=true + - CreateNamespace=true + - PruneLast=true diff --git a/clusters/dev/chat-values.yaml b/clusters/dev/chat-values.yaml deleted file mode 100644 index 62e6a51..0000000 --- a/clusters/dev/chat-values.yaml +++ /dev/null @@ -1,8 +0,0 @@ -helm: - parameters: - - name: image.name - value: ghcr.io/justgithubaccount/chat-api - forcestring: true - - name: image.tag - value: 1.1.7 - forcestring: true diff --git a/clusters/prd/bootstrap.yaml b/clusters/prd/bootstrap.yaml index 3d48053..1728f86 100644 --- a/clusters/prd/bootstrap.yaml +++ b/clusters/prd/bootstrap.yaml @@ -1,16 +1,27 @@ -# clusters/prd/bootstrap.yaml -# Uncomment when prd cluster is ready - -# apiVersion: argoproj.io/v1alpha1 -# kind: Application -# metadata: -# name: root-app-prd -# namespace: argocd -# spec: -# source: -# repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s.git -# path: platform/core/cluster-bootstrap -# targetRevision: main -# destination: -# name: prd -# namespace: argocd +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: root-app-prd + namespace: argocd + labels: + tier: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + destination: + namespace: argocd + name: prd-cluster + project: default + source: + repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s.git + path: clusters/prd + targetRevision: main + syncPolicy: + automated: + allowEmpty: true + selfHeal: true + prune: true + syncOptions: + - Validate=true + - CreateNamespace=true + - PruneLast=true diff --git a/clusters/prd/destination.yaml b/clusters/prd/destination.yaml index 4319367..f4dd2b3 100644 --- a/clusters/prd/destination.yaml +++ b/clusters/prd/destination.yaml @@ -1,8 +1,9 @@ -# apiVersion: argoproj.io/v1alpha1 -# kind: Application -# metadata: -# name: all # имя здесь неважно – патч применится по kind -# spec: -# destination: -# name: prd # ТОЧНОЕ имя prod-кластера из `argocd cluster list` -# namespace: argocd # можно опустить, если в base уже указано +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: all + namespace: argocd +spec: + project: default + destination: + name: prd-cluster diff --git a/clusters/prd/kustomization.yaml b/clusters/prd/kustomization.yaml index ff30e8e..872ddd0 100644 --- a/clusters/prd/kustomization.yaml +++ b/clusters/prd/kustomization.yaml @@ -1,36 +1,29 @@ -# apiVersion: kustomize.config.k8s.io/v1beta1 -# kind: Kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization -# namePrefix: prd- +resources: + # Security + - ../../platform/infrastructure/security/sealed-secrets/base + - ../../platform/infrastructure/security/reflector/base + - ../../platform/infrastructure/security/external-secrets/base + # Networking + - ../../platform/infrastructure/networking/nginx/base + - ../../platform/infrastructure/networking/cert-manager/base + - ../../platform/infrastructure/networking/external-dns/base + # Storage + - ../../platform/infrastructure/storage/longhorn/base + # AI Platform + - ../../platform/infrastructure/ai-platform/open-webui/base + # Observability + - ../../platform/observability/monitoring/loki + - ../../platform/observability/monitoring/grafana + - ../../platform/observability/opentelemetry/collector/otel-collector + # GitOps + - ../../platform/gitops/argocd-image-updater + # Tenants (uncomment when ready for production) + # - ../../tenants/product-team/apps/chat/base -# resources: -# - ../../../base/addons/ingress-nginx -# - ../../../base/addons/cert-manager -# - ../../../base/addons/external-dns -# - ../../../base/addons/observability/loki -# - ../../../base/addons/observability/grafana -# - ../../../base/addons/longhorn -# - ../../../base/services/agent/chat -# - ../../../base/services/llm/gateway - -# # patches: -# # # Исправляем CLUSTER placeholder для всех Applications -# # - target: -# # kind: Application -# # patch: |- -# # - op: replace -# # path: /spec/destination/name -# # value: prd -# # - op: replace -# # path: /spec/destination/server -# # value: https://kubernetes.default.svc - -# patches: -# - target: -# kind: Application -# patch: |- -# - op: remove -# path: /spec/destination/name -# - op: replace -# path: /spec/destination/server -# value: https://kubernetes.default.svc \ No newline at end of file +patches: + - path: destination.yaml + target: + kind: Application diff --git a/clusters/stg/bootstrap.yaml b/clusters/stg/bootstrap.yaml new file mode 100644 index 0000000..d4cf7b6 --- /dev/null +++ b/clusters/stg/bootstrap.yaml @@ -0,0 +1,27 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: root-app-stg + namespace: argocd + labels: + tier: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + destination: + namespace: argocd + name: stg-cluster + project: default + source: + repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s.git + path: clusters/stg + targetRevision: main + syncPolicy: + automated: + allowEmpty: true + selfHeal: true + prune: true + syncOptions: + - Validate=true + - CreateNamespace=true + - PruneLast=true diff --git a/clusters/stg/destination.yaml b/clusters/stg/destination.yaml new file mode 100644 index 0000000..b4bc56a --- /dev/null +++ b/clusters/stg/destination.yaml @@ -0,0 +1,9 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: all + namespace: argocd +spec: + project: default + destination: + name: stg-cluster diff --git a/clusters/stg/kustomization.yaml b/clusters/stg/kustomization.yaml new file mode 100644 index 0000000..80888d2 --- /dev/null +++ b/clusters/stg/kustomization.yaml @@ -0,0 +1,29 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + # Security + - ../../platform/infrastructure/security/sealed-secrets/base + - ../../platform/infrastructure/security/reflector/base + - ../../platform/infrastructure/security/external-secrets/base + # Networking + - ../../platform/infrastructure/networking/nginx/base + - ../../platform/infrastructure/networking/cert-manager/base + - ../../platform/infrastructure/networking/external-dns/base + # Storage + - ../../platform/infrastructure/storage/longhorn/base + # AI Platform + - ../../platform/infrastructure/ai-platform/open-webui/base + # Observability + - ../../platform/observability/monitoring/loki + - ../../platform/observability/monitoring/grafana + - ../../platform/observability/opentelemetry/collector/otel-collector + # GitOps + - ../../platform/gitops/argocd-image-updater + # Tenants + - ../../tenants/product-team/apps/chat/base + +patches: + - path: destination.yaml + target: + kind: Application diff --git a/clusters/tst/bootstrap.yaml b/clusters/tst/bootstrap.yaml new file mode 100644 index 0000000..9ff4500 --- /dev/null +++ b/clusters/tst/bootstrap.yaml @@ -0,0 +1,27 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: root-app-tst + namespace: argocd + labels: + tier: argocd + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + destination: + namespace: argocd + name: tst-cluster + project: default + source: + repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s.git + path: clusters/tst + targetRevision: main + syncPolicy: + automated: + allowEmpty: true + selfHeal: true + prune: true + syncOptions: + - Validate=true + - CreateNamespace=true + - PruneLast=true diff --git a/clusters/tst/destination.yaml b/clusters/tst/destination.yaml new file mode 100644 index 0000000..cc20797 --- /dev/null +++ b/clusters/tst/destination.yaml @@ -0,0 +1,9 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: all + namespace: argocd +spec: + project: default + destination: + name: tst-cluster diff --git a/clusters/tst/kustomization.yaml b/clusters/tst/kustomization.yaml new file mode 100644 index 0000000..80888d2 --- /dev/null +++ b/clusters/tst/kustomization.yaml @@ -0,0 +1,29 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + # Security + - ../../platform/infrastructure/security/sealed-secrets/base + - ../../platform/infrastructure/security/reflector/base + - ../../platform/infrastructure/security/external-secrets/base + # Networking + - ../../platform/infrastructure/networking/nginx/base + - ../../platform/infrastructure/networking/cert-manager/base + - ../../platform/infrastructure/networking/external-dns/base + # Storage + - ../../platform/infrastructure/storage/longhorn/base + # AI Platform + - ../../platform/infrastructure/ai-platform/open-webui/base + # Observability + - ../../platform/observability/monitoring/loki + - ../../platform/observability/monitoring/grafana + - ../../platform/observability/opentelemetry/collector/otel-collector + # GitOps + - ../../platform/gitops/argocd-image-updater + # Tenants + - ../../tenants/product-team/apps/chat/base + +patches: + - path: destination.yaml + target: + kind: Application diff --git a/platform/core/rbac/projects/tenants-project.yaml b/platform/core/rbac/projects/tenants-project.yaml index c4cdcad..f08b17d 100644 --- a/platform/core/rbac/projects/tenants-project.yaml +++ b/platform/core/rbac/projects/tenants-project.yaml @@ -9,8 +9,29 @@ spec: - https://github.com/justgithubaccount/app-poly-gitops-k8s.git - https://github.com/justgithubaccount/app-poly-gitops-helm.git destinations: + # In-cluster (dev) - namespace: chat-api server: https://kubernetes.default.svc + # Multi-cluster destinations + - namespace: chat-api + name: tst-cluster + - namespace: chat-api + name: stg-cluster + - namespace: chat-api + name: prd-cluster clusterResourceWhitelist: - group: '' kind: Namespace + namespaceResourceWhitelist: + - group: '' + kind: ConfigMap + - group: '' + kind: Secret + - group: '' + kind: Service + - group: apps + kind: Deployment + - group: apps + kind: StatefulSet + - group: networking.k8s.io + kind: Ingress diff --git a/platform/gitops/appsets/tenant-apps.yaml b/platform/gitops/appsets/tenant-apps.yaml index a23f616..0803db1 100644 --- a/platform/gitops/appsets/tenant-apps.yaml +++ b/platform/gitops/appsets/tenant-apps.yaml @@ -1,29 +1,116 @@ apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: - name: tenant-apps + name: tenant-apps-dev namespace: argocd spec: + goTemplate: true + goTemplateOptions: ["missingkey=error"] generators: - - list: - elements: - - name: chat-api - path: tenants/product-team/apps/chat/base - namespace: chat-api + - matrix: + generators: + - list: + elements: + - app: chat + team: product-team + - list: + elements: + - cluster: in-cluster + env: dev template: metadata: - name: '{{name}}' + name: '{{ .team }}-{{ .app }}-{{ .env }}' namespace: argocd + labels: + team: '{{ .team }}' + app: '{{ .app }}' + env: '{{ .env }}' + annotations: + argocd-image-updater.argoproj.io/image-list: chat=ghcr.io/justgithubaccount/chat-api:~1 + argocd-image-updater.argoproj.io/chat.update-strategy: semver + argocd-image-updater.argoproj.io/chat.helm.image-tag: image.tag + argocd-image-updater.argoproj.io/write-back-method: git + argocd-image-updater.argoproj.io/write-back-target: 'kustomization:tenants/{{ .team }}/apps/{{ .app }}/overlays/{{ .env }}/values.yaml' + argocd-image-updater.argoproj.io/git-branch: main + finalizers: + - resources-finalizer.argocd.argoproj.io spec: project: tenants - source: - repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s.git - targetRevision: main - path: '{{path}}' destination: - server: https://kubernetes.default.svc - namespace: '{{namespace}}' + name: '{{ .cluster }}' + namespace: '{{ .team }}' + sources: + - repoURL: https://github.com/justgithubaccount/app-poly-gitops-helm + targetRevision: main + path: chat + helm: + valueFiles: + - values.yaml + - $values/values.yaml + - repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s + targetRevision: main + path: 'tenants/{{ .team }}/apps/{{ .app }}/overlays/{{ .env }}' + ref: values syncPolicy: automated: + prune: true selfHeal: true + syncOptions: + - CreateNamespace=true +--- +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: tenant-apps + namespace: argocd +spec: + goTemplate: true + goTemplateOptions: ["missingkey=error"] + generators: + - matrix: + generators: + - list: + elements: + - app: chat + team: product-team + - list: + elements: + - cluster: tst-cluster + env: tst + - cluster: stg-cluster + env: stg + - cluster: prd-cluster + env: prd + template: + metadata: + name: '{{ .team }}-{{ .app }}-{{ .env }}' + namespace: argocd + labels: + team: '{{ .team }}' + app: '{{ .app }}' + env: '{{ .env }}' + finalizers: + - resources-finalizer.argocd.argoproj.io + spec: + project: tenants + destination: + name: '{{ .cluster }}' + namespace: '{{ .team }}' + sources: + - repoURL: https://github.com/justgithubaccount/app-poly-gitops-helm + targetRevision: main + path: chat + helm: + valueFiles: + - values.yaml + - $values/values.yaml + - repoURL: https://github.com/justgithubaccount/app-poly-gitops-k8s + targetRevision: main + path: 'tenants/{{ .team }}/apps/{{ .app }}/overlays/{{ .env }}' + ref: values + syncPolicy: + automated: prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true diff --git a/platform/infrastructure/ai-platform/dify/README.md b/platform/infrastructure/ai-platform/dify/README.md new file mode 100644 index 0000000..6b21711 --- /dev/null +++ b/platform/infrastructure/ai-platform/dify/README.md @@ -0,0 +1,28 @@ +# Dify AI Platform + +## Status: TODO + +Placeholder for Dify LLM application development platform. + +## Tasks + +- [ ] Research Dify Helm chart availability +- [ ] Define resource requirements (CPU, memory, storage) +- [ ] Configure persistent storage for Dify data +- [ ] Set up authentication integration +- [ ] Configure integration with existing AI platform (Open WebUI) +- [ ] Add to ApplicationSet or clusters kustomization + +## Links + +- [Dify GitHub](https://github.com/langgenius/dify) +- [Dify Documentation](https://docs.dify.ai) +- [Dify Helm Charts](https://github.com/langgenius/dify-helm) + +## Notes + +Dify is an open-source LLM app development platform with: +- Visual workflow builder +- RAG pipeline support +- Agent capabilities +- Multi-model support diff --git a/platform/infrastructure/ai-platform/dify/base/application.yaml b/platform/infrastructure/ai-platform/dify/base/application.yaml new file mode 100644 index 0000000..2b9e077 --- /dev/null +++ b/platform/infrastructure/ai-platform/dify/base/application.yaml @@ -0,0 +1,37 @@ +# TODO: Configure Dify deployment +# Reference: https://github.com/langgenius/dify + +# apiVersion: argoproj.io/v1alpha1 +# kind: Application +# metadata: +# name: dify +# namespace: argocd +# labels: +# app.kubernetes.io/name: dify +# app.kubernetes.io/part-of: ai-platform +# annotations: +# argocd.argoproj.io/sync-wave: "10" +# spec: +# project: default +# source: +# # Option 1: Official Helm chart (if available) +# # repoURL: https://charts.dify.ai +# # chart: dify +# # targetRevision: "0.x.x" +# +# # Option 2: Git-based deployment +# repoURL: https://github.com/langgenius/dify.git +# path: docker/kubernetes +# targetRevision: main +# destination: +# name: CLUSTER +# namespace: dify +# syncPolicy: +# automated: +# allowEmpty: true +# selfHeal: true +# prune: true +# syncOptions: +# - Validate=true +# - CreateNamespace=true +# - PruneLast=true diff --git a/platform/infrastructure/ai-platform/dify/base/kustomization.yaml b/platform/infrastructure/ai-platform/dify/base/kustomization.yaml new file mode 100644 index 0000000..8b7283e --- /dev/null +++ b/platform/infrastructure/ai-platform/dify/base/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +# TODO: Uncomment when Dify deployment is ready +# resources: +# - application.yaml diff --git a/platform/infrastructure/networking/nginx/overlays/ingress-argo.yaml b/platform/infrastructure/networking/nginx/base/ingress-argo.yaml similarity index 100% rename from platform/infrastructure/networking/nginx/overlays/ingress-argo.yaml rename to platform/infrastructure/networking/nginx/base/ingress-argo.yaml diff --git a/platform/infrastructure/networking/nginx/overlays/ingress-chat.yaml b/platform/infrastructure/networking/nginx/base/ingress-chat.yaml similarity index 100% rename from platform/infrastructure/networking/nginx/overlays/ingress-chat.yaml rename to platform/infrastructure/networking/nginx/base/ingress-chat.yaml diff --git a/platform/infrastructure/networking/nginx/overlays/ingress-grafana.yaml b/platform/infrastructure/networking/nginx/base/ingress-grafana.yaml similarity index 100% rename from platform/infrastructure/networking/nginx/overlays/ingress-grafana.yaml rename to platform/infrastructure/networking/nginx/base/ingress-grafana.yaml diff --git a/platform/infrastructure/networking/nginx/overlays/ingress-openwebui.yaml b/platform/infrastructure/networking/nginx/base/ingress-openwebui.yaml similarity index 100% rename from platform/infrastructure/networking/nginx/overlays/ingress-openwebui.yaml rename to platform/infrastructure/networking/nginx/base/ingress-openwebui.yaml diff --git a/platform/infrastructure/networking/nginx/base/kustomization.yaml b/platform/infrastructure/networking/nginx/base/kustomization.yaml index 1a779f4..035e0a3 100644 --- a/platform/infrastructure/networking/nginx/base/kustomization.yaml +++ b/platform/infrastructure/networking/nginx/base/kustomization.yaml @@ -1,7 +1,9 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + resources: - application.yaml - - overlays/ingress-chat.yaml - - overlays/ingress-grafana.yaml - - overlays/ingress-argo.yaml - - overlays/ingress-openwebui.yaml - \ No newline at end of file + - ingress-chat.yaml + - ingress-grafana.yaml + - ingress-argo.yaml + - ingress-openwebui.yaml diff --git a/tenants/data-team/base/kustomization.yaml b/tenants/data-team/base/kustomization.yaml new file mode 100644 index 0000000..70cd580 --- /dev/null +++ b/tenants/data-team/base/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../namespace.yaml + - ../resource-quota.yaml diff --git a/tenants/data-team/namespace.yaml b/tenants/data-team/namespace.yaml new file mode 100644 index 0000000..d7f69fe --- /dev/null +++ b/tenants/data-team/namespace.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: data-team + labels: + team: data-team + app.kubernetes.io/managed-by: argocd + annotations: + argocd.argoproj.io/sync-wave: "-10" diff --git a/tenants/data-team/resource-quota.yaml b/tenants/data-team/resource-quota.yaml new file mode 100644 index 0000000..9df7d7d --- /dev/null +++ b/tenants/data-team/resource-quota.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: ResourceQuota +metadata: + name: data-team-quota + namespace: data-team + labels: + team: data-team + annotations: + argocd.argoproj.io/sync-wave: "-9" +spec: + hard: + requests.cpu: "8" + requests.memory: 16Gi + limits.cpu: "16" + limits.memory: 32Gi + pods: "30" + services: "15" + persistentvolumeclaims: "20" + requests.storage: 100Gi diff --git a/tenants/ml-team/base/kustomization.yaml b/tenants/ml-team/base/kustomization.yaml new file mode 100644 index 0000000..70cd580 --- /dev/null +++ b/tenants/ml-team/base/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../namespace.yaml + - ../resource-quota.yaml diff --git a/tenants/ml-team/namespace.yaml b/tenants/ml-team/namespace.yaml new file mode 100644 index 0000000..9675fce --- /dev/null +++ b/tenants/ml-team/namespace.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: ml-team + labels: + team: ml-team + app.kubernetes.io/managed-by: argocd + annotations: + argocd.argoproj.io/sync-wave: "-10" diff --git a/tenants/ml-team/resource-quota.yaml b/tenants/ml-team/resource-quota.yaml new file mode 100644 index 0000000..0403729 --- /dev/null +++ b/tenants/ml-team/resource-quota.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: ResourceQuota +metadata: + name: ml-team-quota + namespace: ml-team + labels: + team: ml-team + annotations: + argocd.argoproj.io/sync-wave: "-9" +spec: + hard: + requests.cpu: "16" + requests.memory: 32Gi + limits.cpu: "32" + limits.memory: 64Gi + pods: "50" + services: "20" + persistentvolumeclaims: "30" + requests.storage: 200Gi diff --git a/tenants/product-team/apps/chat/base/application.yaml b/tenants/product-team/apps/chat/base/application.yaml deleted file mode 100644 index b8bd730..0000000 --- a/tenants/product-team/apps/chat/base/application.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - labels: - app.kubernetes.io/name: chat-api - app.kubernetes.io/part-of: chat - app.kubernetes.io/managed-by: argocd - app.kubernetes.io/component: backend - env: dev - name: chat-api - namespace: argocd - annotations: - argocd.argoproj.io/sync-wave: "5" - - argocd-image-updater.argoproj.io/image-list: chat=ghcr.io/justgithubaccount/chat-api:^1 - argocd-image-updater.argoproj.io/chat.update-strategy: semver - argocd-image-updater.argoproj.io/chat.helm.image-tag: image.tag - - argocd-image-updater.argoproj.io/write-back-method: git - argocd-image-updater.argoproj.io/write-back-target: clusters/dev/chat-values.yaml - argocd-image-updater.argoproj.io/write-back-target-branch: main - argocd-image-updater.argoproj.io/git-commit-user-name: justgithubaccount - argocd-image-updater.argoproj.io/git-commit-user-email: kulikovyevgeny@outlook.com - - argocd-image-updater.argoproj.io/git-credentialSecret: chat-github - - # notifications.argoproj.io/subscribe.on-sync-succeeded.slack: chat-devops - # notifications.argoproj.io/subscribe.on-sync-failed.slack: chat-devops -spec: - project: default - source: - repoURL: https://github.com/justgithubaccount/app-poly-gitops-helm - targetRevision: main - path: chat - helm: - valueFiles: - - values.yaml - # values из k8s-репы подтягиваются через additionalValueFiles или patch - # - ../../clusters/dev/chat-values.yaml - destination: - name: CLUSTER - namespace: chat-api - syncPolicy: - automated: - allowEmpty: true - selfHeal: true - prune: true - syncOptions: - - Validate=true - - CreateNamespace=true - - PruneLast=true diff --git a/tenants/product-team/apps/chat/base/kustomization.yaml b/tenants/product-team/apps/chat/base/kustomization.yaml index 607fd16..893fab5 100644 --- a/tenants/product-team/apps/chat/base/kustomization.yaml +++ b/tenants/product-team/apps/chat/base/kustomization.yaml @@ -1,5 +1,6 @@ -resources: - - application.yaml - - postgree-secrets.yaml - - openrouter-secrets.yaml - - github-secrets.yaml +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +# Application managed by ApplicationSet in platform/gitops/appsets/tenant-apps.yaml +# This directory contains shared resources for the chat application +resources: [] diff --git a/tenants/product-team/apps/chat/overlays/dev/kustomization.yaml b/tenants/product-team/apps/chat/overlays/dev/kustomization.yaml new file mode 100644 index 0000000..3329c99 --- /dev/null +++ b/tenants/product-team/apps/chat/overlays/dev/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../base + - postgree-secrets.yaml + - openrouter-secrets.yaml + - github-secrets.yaml diff --git a/tenants/product-team/apps/chat/overlays/dev/values.yaml b/tenants/product-team/apps/chat/overlays/dev/values.yaml new file mode 100644 index 0000000..6bf49ac --- /dev/null +++ b/tenants/product-team/apps/chat/overlays/dev/values.yaml @@ -0,0 +1,17 @@ +image: + name: ghcr.io/justgithubaccount/chat-api + tag: "1.1.7" + +replicaCount: 2 + +resources: + limits: + cpu: 1000m + memory: 1Gi + requests: + cpu: 500m + memory: 512Mi + +ingress: + enabled: true + host: chat-dev.syncjob.ru diff --git a/tenants/product-team/apps/chat/overlays/prd/kustomization.yaml b/tenants/product-team/apps/chat/overlays/prd/kustomization.yaml new file mode 100644 index 0000000..774a422 --- /dev/null +++ b/tenants/product-team/apps/chat/overlays/prd/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../base diff --git a/tenants/product-team/apps/chat/overlays/prd/values.yaml b/tenants/product-team/apps/chat/overlays/prd/values.yaml new file mode 100644 index 0000000..4df87b1 --- /dev/null +++ b/tenants/product-team/apps/chat/overlays/prd/values.yaml @@ -0,0 +1,17 @@ +image: + name: ghcr.io/justgithubaccount/chat-api + tag: "1.1.7" + +replicaCount: 3 + +resources: + limits: + cpu: 2000m + memory: 2Gi + requests: + cpu: 1000m + memory: 1Gi + +ingress: + enabled: true + host: chat.syncjob.ru diff --git a/tenants/product-team/apps/chat/overlays/stg/kustomization.yaml b/tenants/product-team/apps/chat/overlays/stg/kustomization.yaml new file mode 100644 index 0000000..774a422 --- /dev/null +++ b/tenants/product-team/apps/chat/overlays/stg/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../base diff --git a/tenants/product-team/apps/chat/overlays/stg/values.yaml b/tenants/product-team/apps/chat/overlays/stg/values.yaml new file mode 100644 index 0000000..55f1778 --- /dev/null +++ b/tenants/product-team/apps/chat/overlays/stg/values.yaml @@ -0,0 +1,17 @@ +image: + name: ghcr.io/justgithubaccount/chat-api + tag: "1.1.7" + +replicaCount: 2 + +resources: + limits: + cpu: 1000m + memory: 1Gi + requests: + cpu: 500m + memory: 512Mi + +ingress: + enabled: true + host: chat-stg.syncjob.ru diff --git a/tenants/product-team/apps/chat/overlays/tst/kustomization.yaml b/tenants/product-team/apps/chat/overlays/tst/kustomization.yaml new file mode 100644 index 0000000..774a422 --- /dev/null +++ b/tenants/product-team/apps/chat/overlays/tst/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../../base diff --git a/tenants/product-team/apps/chat/overlays/tst/values.yaml b/tenants/product-team/apps/chat/overlays/tst/values.yaml new file mode 100644 index 0000000..f061a13 --- /dev/null +++ b/tenants/product-team/apps/chat/overlays/tst/values.yaml @@ -0,0 +1,17 @@ +image: + name: ghcr.io/justgithubaccount/chat-api + tag: "1.1.7" + +replicaCount: 1 + +resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + +ingress: + enabled: true + host: chat-tst.syncjob.ru diff --git a/tenants/product-team/base/kustomization.yaml b/tenants/product-team/base/kustomization.yaml new file mode 100644 index 0000000..70cd580 --- /dev/null +++ b/tenants/product-team/base/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ../namespace.yaml + - ../resource-quota.yaml diff --git a/tenants/product-team/namespace.yaml b/tenants/product-team/namespace.yaml new file mode 100644 index 0000000..65755b6 --- /dev/null +++ b/tenants/product-team/namespace.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: chat-api + labels: + team: product-team + app.kubernetes.io/name: chat-api + app.kubernetes.io/managed-by: argocd + annotations: + argocd.argoproj.io/sync-wave: "-10" diff --git a/tenants/product-team/resource-quota.yaml b/tenants/product-team/resource-quota.yaml new file mode 100644 index 0000000..7deded6 --- /dev/null +++ b/tenants/product-team/resource-quota.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: ResourceQuota +metadata: + name: product-team-quota + namespace: chat-api + labels: + team: product-team + annotations: + argocd.argoproj.io/sync-wave: "-9" +spec: + hard: + requests.cpu: "4" + requests.memory: 8Gi + limits.cpu: "8" + limits.memory: 16Gi + pods: "20" + services: "10" + persistentvolumeclaims: "10" + requests.storage: 50Gi