@vaharoni/devops 1.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -0
- package/dist/app-support/crypto/index.d.ts +15 -0
- package/dist/app-support/crypto/index.d.ts.map +1 -0
- package/dist/app-support/crypto/index.js +30 -0
- package/dist/app-support/crypto/internal-token.d.ts +20 -0
- package/dist/app-support/crypto/internal-token.d.ts.map +1 -0
- package/dist/app-support/crypto/internal-token.js +42 -0
- package/dist/app-support/crypto/internal-token.spec.d.ts +2 -0
- package/dist/app-support/crypto/internal-token.spec.d.ts.map +1 -0
- package/dist/app-support/crypto/internal-token.spec.js +45 -0
- package/dist/app-support/crypto/secret.d.ts +3 -0
- package/dist/app-support/crypto/secret.d.ts.map +1 -0
- package/dist/app-support/crypto/secret.js +12 -0
- package/dist/app-support/crypto/secret.spec.d.ts +2 -0
- package/dist/app-support/crypto/secret.spec.d.ts.map +1 -0
- package/dist/app-support/crypto/secret.spec.js +15 -0
- package/dist/app-support/discovery/dev-discovery-loader.d.ts +2 -0
- package/dist/app-support/discovery/dev-discovery-loader.d.ts.map +1 -0
- package/dist/app-support/discovery/dev-discovery-loader.js +30 -0
- package/dist/app-support/discovery/service-endpoint.d.ts +2 -0
- package/dist/app-support/discovery/service-endpoint.d.ts.map +1 -0
- package/dist/app-support/discovery/service-endpoint.js +10 -0
- package/dist/cli/affected.d.ts +11 -0
- package/dist/cli/affected.d.ts.map +1 -0
- package/dist/cli/affected.js +103 -0
- package/dist/cli/common.d.ts +89 -0
- package/dist/cli/common.d.ts.map +1 -0
- package/dist/cli/common.js +236 -0
- package/dist/cli/common.spec.d.ts +2 -0
- package/dist/cli/common.spec.d.ts.map +1 -0
- package/dist/cli/common.spec.js +64 -0
- package/dist/cli/console.d.ts +11 -0
- package/dist/cli/console.d.ts.map +1 -0
- package/dist/cli/console.js +35 -0
- package/dist/cli/constant.d.ts +11 -0
- package/dist/cli/constant.d.ts.map +1 -0
- package/dist/cli/constant.js +22 -0
- package/dist/cli/db.d.ts +11 -0
- package/dist/cli/db.d.ts.map +1 -0
- package/dist/cli/db.js +119 -0
- package/dist/cli/dml.d.ts +11 -0
- package/dist/cli/dml.d.ts.map +1 -0
- package/dist/cli/dml.js +116 -0
- package/dist/cli/env.d.ts +11 -0
- package/dist/cli/env.d.ts.map +1 -0
- package/dist/cli/env.js +67 -0
- package/dist/cli/exec.d.ts +11 -0
- package/dist/cli/exec.d.ts.map +1 -0
- package/dist/cli/exec.js +50 -0
- package/dist/cli/image.d.ts +11 -0
- package/dist/cli/image.d.ts.map +1 -0
- package/dist/cli/image.js +140 -0
- package/dist/cli/init.d.ts +11 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +66 -0
- package/dist/cli/internal-curl.d.ts +11 -0
- package/dist/cli/internal-curl.d.ts.map +1 -0
- package/dist/cli/internal-curl.js +43 -0
- package/dist/cli/job.d.ts +11 -0
- package/dist/cli/job.d.ts.map +1 -0
- package/dist/cli/job.js +67 -0
- package/dist/cli/jwt.d.ts +11 -0
- package/dist/cli/jwt.d.ts.map +1 -0
- package/dist/cli/jwt.js +27 -0
- package/dist/cli/namespace.d.ts +11 -0
- package/dist/cli/namespace.d.ts.map +1 -0
- package/dist/cli/namespace.js +70 -0
- package/dist/cli/prep-build.d.ts +11 -0
- package/dist/cli/prep-build.d.ts.map +1 -0
- package/dist/cli/prep-build.js +82 -0
- package/dist/cli/prisma.d.ts +11 -0
- package/dist/cli/prisma.d.ts.map +1 -0
- package/dist/cli/prisma.js +25 -0
- package/dist/cli/redis.d.ts +11 -0
- package/dist/cli/redis.d.ts.map +1 -0
- package/dist/cli/redis.js +76 -0
- package/dist/cli/registry.d.ts +11 -0
- package/dist/cli/registry.d.ts.map +1 -0
- package/dist/cli/registry.js +58 -0
- package/dist/cli/run-many.d.ts +11 -0
- package/dist/cli/run-many.d.ts.map +1 -0
- package/dist/cli/run-many.js +50 -0
- package/dist/cli/run.d.ts +11 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +37 -0
- package/dist/cli/template.d.ts +11 -0
- package/dist/cli/template.d.ts.map +1 -0
- package/dist/cli/template.js +123 -0
- package/dist/cli/test.d.ts +11 -0
- package/dist/cli/test.d.ts.map +1 -0
- package/dist/cli/test.js +28 -0
- package/dist/devops.d.ts +3 -0
- package/dist/devops.d.ts.map +1 -0
- package/dist/devops.js +103 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/libs/affected-entities.d.ts +15 -0
- package/dist/libs/affected-entities.d.ts.map +1 -0
- package/dist/libs/affected-entities.js +52 -0
- package/dist/libs/config.d.ts +6 -0
- package/dist/libs/config.d.ts.map +1 -0
- package/dist/libs/config.js +98 -0
- package/dist/libs/dependencies.d.ts +19 -0
- package/dist/libs/dependencies.d.ts.map +1 -0
- package/dist/libs/dependencies.js +62 -0
- package/dist/libs/dependencies.spec.d.ts +2 -0
- package/dist/libs/dependencies.spec.d.ts.map +1 -0
- package/dist/libs/dependencies.spec.js +21 -0
- package/dist/libs/digital-ocean/container-reg.d.ts +6 -0
- package/dist/libs/digital-ocean/container-reg.d.ts.map +1 -0
- package/dist/libs/digital-ocean/container-reg.js +69 -0
- package/dist/libs/discovery/dependencies.d.ts +19 -0
- package/dist/libs/discovery/dependencies.d.ts.map +1 -0
- package/dist/libs/discovery/dependencies.js +62 -0
- package/dist/libs/discovery/dependencies.spec.d.ts +2 -0
- package/dist/libs/discovery/dependencies.spec.d.ts.map +1 -0
- package/dist/libs/discovery/dependencies.spec.js +21 -0
- package/dist/libs/discovery/images.d.ts +5 -0
- package/dist/libs/discovery/images.d.ts.map +1 -0
- package/dist/libs/discovery/images.js +45 -0
- package/dist/libs/discovery/index.d.ts +5 -0
- package/dist/libs/discovery/index.d.ts.map +1 -0
- package/dist/libs/discovery/index.js +55 -0
- package/dist/libs/discovery/package-json-processor.d.ts +3 -0
- package/dist/libs/discovery/package-json-processor.d.ts.map +1 -0
- package/dist/libs/discovery/package-json-processor.js +34 -0
- package/dist/libs/discovery/process-common.d.ts +25 -0
- package/dist/libs/discovery/process-common.d.ts.map +1 -0
- package/dist/libs/discovery/process-common.js +40 -0
- package/dist/libs/discovery/process-package-json.d.ts +3 -0
- package/dist/libs/discovery/process-package-json.d.ts.map +1 -0
- package/dist/libs/discovery/process-package-json.js +34 -0
- package/dist/libs/discovery/process-pyproject-toml.d.ts +3 -0
- package/dist/libs/discovery/process-pyproject-toml.d.ts.map +1 -0
- package/dist/libs/discovery/process-pyproject-toml.js +36 -0
- package/dist/libs/discovery/pyproject-toml-processor.d.ts +3 -0
- package/dist/libs/discovery/pyproject-toml-processor.d.ts.map +1 -0
- package/dist/libs/discovery/pyproject-toml-processor.js +39 -0
- package/dist/libs/git-helpers.d.ts +8 -0
- package/dist/libs/git-helpers.d.ts.map +1 -0
- package/dist/libs/git-helpers.js +20 -0
- package/dist/libs/hetzner/reg-secret.d.ts +3 -0
- package/dist/libs/hetzner/reg-secret.d.ts.map +1 -0
- package/dist/libs/hetzner/reg-secret.js +39 -0
- package/dist/libs/k8s-constants.d.ts +12 -0
- package/dist/libs/k8s-constants.d.ts.map +1 -0
- package/dist/libs/k8s-constants.js +66 -0
- package/dist/libs/k8s-db.d.ts +18 -0
- package/dist/libs/k8s-db.d.ts.map +1 -0
- package/dist/libs/k8s-db.js +73 -0
- package/dist/libs/k8s-generate.d.ts +17 -0
- package/dist/libs/k8s-generate.d.ts.map +1 -0
- package/dist/libs/k8s-generate.js +179 -0
- package/dist/libs/k8s-helpers.d.ts +11 -0
- package/dist/libs/k8s-helpers.d.ts.map +1 -0
- package/dist/libs/k8s-helpers.js +42 -0
- package/dist/libs/k8s-image-config.d.ts +8 -0
- package/dist/libs/k8s-image-config.d.ts.map +1 -0
- package/dist/libs/k8s-image-config.js +113 -0
- package/dist/libs/k8s-job-waiter.d.ts +8 -0
- package/dist/libs/k8s-job-waiter.d.ts.map +1 -0
- package/dist/libs/k8s-job-waiter.js +84 -0
- package/dist/libs/k8s-namespace.d.ts +7 -0
- package/dist/libs/k8s-namespace.d.ts.map +1 -0
- package/dist/libs/k8s-namespace.js +27 -0
- package/dist/libs/k8s-redis.d.ts +6 -0
- package/dist/libs/k8s-redis.d.ts.map +1 -0
- package/dist/libs/k8s-redis.js +31 -0
- package/dist/libs/k8s-secrets-manager.d.ts +5 -0
- package/dist/libs/k8s-secrets-manager.d.ts.map +1 -0
- package/dist/libs/k8s-secrets-manager.js +61 -0
- package/dist/libs/validate-env.d.ts +56 -0
- package/dist/libs/validate-env.d.ts.map +1 -0
- package/dist/libs/validate-env.js +214 -0
- package/dist/libs/validate-env.spec.d.ts +2 -0
- package/dist/libs/validate-env.spec.d.ts.map +1 -0
- package/dist/libs/validate-env.spec.js +168 -0
- package/dist/libs/workspace-discovery.d.ts +2 -0
- package/dist/libs/workspace-discovery.d.ts.map +1 -0
- package/dist/libs/workspace-discovery.js +75 -0
- package/dist/test.d.ts +2 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +1 -0
- package/dist/types/index.d.ts +925 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +79 -0
- package/package.json +55 -0
- package/src/app-support/crypto/index.ts +31 -0
- package/src/app-support/crypto/internal-token.spec.ts +53 -0
- package/src/app-support/crypto/internal-token.ts +82 -0
- package/src/app-support/crypto/secret.spec.ts +18 -0
- package/src/app-support/crypto/secret.ts +13 -0
- package/src/app-support/discovery/dev-discovery-loader.ts +35 -0
- package/src/app-support/discovery/service-endpoint.ts +12 -0
- package/src/cli/affected.ts +116 -0
- package/src/cli/common.spec.ts +78 -0
- package/src/cli/common.ts +323 -0
- package/src/cli/console.ts +46 -0
- package/src/cli/constant.ts +25 -0
- package/src/cli/db.ts +133 -0
- package/src/cli/dml.ts +126 -0
- package/src/cli/env.ts +87 -0
- package/src/cli/exec.sh +21 -0
- package/src/cli/exec.ts +57 -0
- package/src/cli/image.ts +197 -0
- package/src/cli/init.ts +75 -0
- package/src/cli/internal-curl.ts +48 -0
- package/src/cli/job.ts +80 -0
- package/src/cli/jwt.ts +32 -0
- package/src/cli/namespace.ts +78 -0
- package/src/cli/prep-build.ts +96 -0
- package/src/cli/prisma.ts +33 -0
- package/src/cli/redis.ts +83 -0
- package/src/cli/registry.ts +76 -0
- package/src/cli/run-many.ts +61 -0
- package/src/cli/run.ts +46 -0
- package/src/cli/template.ts +169 -0
- package/src/cli/test.ts +30 -0
- package/src/devops.ts +119 -0
- package/src/index.ts +3 -0
- package/src/libs/affected-entities.ts +71 -0
- package/src/libs/config.ts +117 -0
- package/src/libs/digital-ocean/container-reg.ts +81 -0
- package/src/libs/discovery/dependencies.spec.ts +25 -0
- package/src/libs/discovery/dependencies.ts +73 -0
- package/src/libs/discovery/images.ts +57 -0
- package/src/libs/discovery/index.ts +60 -0
- package/src/libs/discovery/process-common.ts +55 -0
- package/src/libs/discovery/process-package-json.ts +47 -0
- package/src/libs/discovery/process-pyproject-toml.ts +43 -0
- package/src/libs/git-helpers.ts +32 -0
- package/src/libs/hetzner/reg-secret.ts +54 -0
- package/src/libs/k8s-constants.ts +83 -0
- package/src/libs/k8s-db.ts +83 -0
- package/src/libs/k8s-generate.ts +211 -0
- package/src/libs/k8s-helpers.ts +59 -0
- package/src/libs/k8s-image-config.ts +165 -0
- package/src/libs/k8s-job-waiter.ts +124 -0
- package/src/libs/k8s-namespace.ts +41 -0
- package/src/libs/k8s-redis.ts +31 -0
- package/src/libs/k8s-secrets-manager.ts +79 -0
- package/src/libs/validate-env.spec.ts +223 -0
- package/src/libs/validate-env.ts +266 -0
- package/src/target-templates/.devops/config/constants.yaml +17 -0
- package/src/target-templates/.devops/config/images.yaml +88 -0
- package/src/target-templates/.devops/docker-images/common/docker-common.sh +23 -0
- package/src/target-templates/.devops/docker-images/node-services/node-exec.sh +8 -0
- package/src/target-templates/.devops/docker-images/node-services/node-run.sh +8 -0
- package/src/target-templates/.devops/docker-images/node-services.Dockerfile +34 -0
- package/src/target-templates/.devops/docker-images/python-services/python-exec.sh +8 -0
- package/src/target-templates/.devops/docker-images/python-services/python-run.sh +8 -0
- package/src/target-templates/.devops/docker-images/python-services.Dockerfile +29 -0
- package/src/target-templates/.devops/env.example.yaml +23 -0
- package/src/target-templates/.devops/infra/hetzner/abandoned/harbor-values.yaml +30 -0
- package/src/target-templates/.devops/infra/hetzner/abandoned/hcloud-config.yaml +134 -0
- package/src/target-templates/.devops/infra/hetzner/cert-manager.yaml +25 -0
- package/src/target-templates/.devops/infra/hetzner/harbor-cert.yaml +13 -0
- package/src/target-templates/.devops/infra/hetzner/harbor-values.yaml +76 -0
- package/src/target-templates/.devops/infra/hetzner/hcloud-config.yaml +113 -0
- package/src/target-templates/.devops/infra/hetzner/ingress-nginx-annotations.yaml +49 -0
- package/src/target-templates/.devops/infra/hetzner/ingress-nginx-configmap.yaml +8 -0
- package/src/target-templates/.devops/infra/hetzner/retain-storage-class.yaml +8 -0
- package/src/target-templates/.devops/infra/monitoring-ingress.yaml +62 -0
- package/src/target-templates/.devops/infra/stackgres-ui-ingress.yaml +35 -0
- package/src/target-templates/.devops/infra/test.yaml +60 -0
- package/src/target-templates/.devops/manifests/_index.yaml +21 -0
- package/src/target-templates/.devops/manifests/cron-jobs.yaml.hb +55 -0
- package/src/target-templates/.devops/manifests/db-migrate-job.yaml.hb +42 -0
- package/src/target-templates/.devops/manifests/deployment-debug.yaml.hb +44 -0
- package/src/target-templates/.devops/manifests/deployment-process.yaml.hb +47 -0
- package/src/target-templates/.devops/manifests/deployment-web.yaml.hb +53 -0
- package/src/target-templates/.devops/manifests/ingress.yaml.hb +21 -0
- package/src/target-templates/.devops/manifests/prefect.yaml.hb +62 -0
- package/src/target-templates/.devops/manifests/service.yaml.hb +15 -0
- package/src/target-templates/.devops/milvus/production/milvus-values.yaml +2 -0
- package/src/target-templates/.devops/milvus/staging/milvus-values.yaml +2 -0
- package/src/target-templates/.devops/postgres/DailyOperatorRestart.yaml +54 -0
- package/src/target-templates/.devops/postgres/production/cluster/PodDisruptionBudget.yaml +27 -0
- package/src/target-templates/.devops/postgres/production/cluster/SGCluster.yaml +47 -0
- package/src/target-templates/.devops/postgres/production/cluster/StackGres-alerts.yaml +191 -0
- package/src/target-templates/.devops/postgres/production/configurations/06-SGDistributedLogs.yaml +11 -0
- package/src/target-templates/.devops/postgres/production/configurations/07-SGObjectStorage.yaml +18 -0
- package/src/target-templates/.devops/postgres/production/configurations/08-SGScript.yaml +12 -0
- package/src/target-templates/.devops/postgres/staging/cluster/SGCluster.yaml +42 -0
- package/src/target-templates/.devops/postgres/staging/configurations/07-SGObjectStorage.yaml +18 -0
- package/src/target-templates/.devops/postgres/staging/configurations/08-SGScript.yaml +12 -0
- package/src/target-templates/.devops/prefect/production/prefect-values.yaml +14 -0
- package/src/target-templates/.devops/prefect/staging/prefect-values.yaml +14 -0
- package/src/target-templates/.devops/redis/production/redis-values.yaml +20 -0
- package/src/target-templates/.devops/redis/staging/redis-values.yaml +8 -0
- package/src/target-templates/.envrc +5 -0
- package/src/target-templates/.github/actions/build-image@v1/action.yaml +86 -0
- package/src/target-templates/.github/actions/connect-to-digital-ocean@v1/action.yaml +29 -0
- package/src/target-templates/.github/actions/connect-to-hetzner@v1/action.yaml +31 -0
- package/src/target-templates/.github/actions/connect-to-infra@v1/action.yaml +46 -0
- package/src/target-templates/.github/actions/db-migrate@v1/action.yaml +23 -0
- package/src/target-templates/.github/actions/deploy-image@v1/action.yaml +33 -0
- package/src/target-templates/.github/actions/setup-prereq@v1/action.yaml +29 -0
- package/src/target-templates/.github/workflows/k8s-build.yaml +84 -0
- package/src/target-templates/applications/example-data-pipeline/pyproject.toml +14 -0
- package/src/target-templates/applications/example-data-pipeline/src/example_data_pipeline/main.py +38 -0
- package/src/target-templates/applications/example-node/index.ts +30 -0
- package/src/target-templates/applications/example-node/package.json +26 -0
- package/src/target-templates/applications/example-node/tsconfig.json +3 -0
- package/src/target-templates/applications/example-python/pyproject.toml +20 -0
- package/src/target-templates/applications/example-python/src/example_python/__init__.py +0 -0
- package/src/target-templates/applications/example-python/src/example_python/main.py +13 -0
- package/src/target-templates/applications/example-python/src/example_python/scripts.py +17 -0
- package/src/target-templates/applications/example-python/tests/__init__.py +0 -0
- package/src/target-templates/applications/jobs/README.md +68 -0
- package/src/target-templates/applications/jobs/index.ts +1 -0
- package/src/target-templates/applications/jobs/package.json +30 -0
- package/src/target-templates/applications/jobs/tsconfig.json +3 -0
- package/src/target-templates/config/.env.development +1 -0
- package/src/target-templates/config/.env.global +4 -0
- package/src/target-templates/config/.env.test +1 -0
- package/src/target-templates/db/db/__init__.py +0 -0
- package/src/target-templates/db/db/db_client_test.py +46 -0
- package/src/target-templates/db/db-client-test.ts +140 -0
- package/src/target-templates/db/db-client.ts +19 -0
- package/src/target-templates/db/env.yaml +4 -0
- package/src/target-templates/db/package.json +17 -0
- package/src/target-templates/db/prisma/schema.prisma +24 -0
- package/src/target-templates/db/prisma-setup-vitest.ts +27 -0
- package/src/target-templates/db/pyproject.toml +14 -0
- package/src/target-templates/db/tsconfig.json +3 -0
- package/src/target-templates/devops +3 -0
- package/src/target-templates/devopspy +3 -0
- package/src/target-templates/dml/package.json +7 -0
- package/src/target-templates/dml/tsconfig.json +3 -0
- package/src/target-templates/libs/example-node-lib/bun.lock +27 -0
- package/src/target-templates/libs/example-node-lib/index.ts +3 -0
- package/src/target-templates/libs/example-node-lib/package.json +12 -0
- package/src/target-templates/libs/example-node-lib/tsconfig.json +3 -0
- package/src/target-templates/libs/example-python-lib/pyproject.toml +11 -0
- package/src/target-templates/libs/example-python-lib/src/example_python_lib/__init__.py +2 -0
- package/src/target-templates/pyproject.toml +19 -0
- package/src/target-templates/tmp/.gitkeep +0 -0
- package/src/target-templates/tsconfig.json +27 -0
- package/src/test.ts +0 -0
- package/src/types/index.ts +173 -0
@@ -0,0 +1,266 @@
|
|
1
|
+
import fs from 'fs';
|
2
|
+
import yaml from 'yaml';
|
3
|
+
import { IGNORED_PATHS } from './discovery/process-common';
|
4
|
+
|
5
|
+
type EnvRequirement = 'optional' | 'boolean' | 'required' | string[];
|
6
|
+
type ParsedEnvYaml = Record<string, EnvRequirement>;
|
7
|
+
type CombinedErrors = Record<string, string[]>;
|
8
|
+
type KeysFromFiles = Record<string, string[]>;
|
9
|
+
|
10
|
+
export class CombinedEnvValidator {
|
11
|
+
envYamlPaths: string[];
|
12
|
+
dotEnvPaths: string[];
|
13
|
+
|
14
|
+
yamlValidators: SingleEnvValidator[] = [];
|
15
|
+
dotEnvParsers: DotEnvParser[] = [];
|
16
|
+
|
17
|
+
keysFromYamlFiles: Set<string> = new Set();
|
18
|
+
keysFromDotEnvFiles: KeysFromFiles = {};
|
19
|
+
|
20
|
+
errors: CombinedErrors = {};
|
21
|
+
warnings: string[] = [];
|
22
|
+
|
23
|
+
constructor(envYamlPaths: string[], dotEnvPaths: string[] = []) {
|
24
|
+
this.envYamlPaths = envYamlPaths.filter(path =>
|
25
|
+
!IGNORED_PATHS.some((ignoredPath) => path.includes(ignoredPath))
|
26
|
+
)
|
27
|
+
this.dotEnvPaths = dotEnvPaths;
|
28
|
+
}
|
29
|
+
|
30
|
+
validate() {
|
31
|
+
this._handleYamlFiles();
|
32
|
+
this._handleDotEnvFiles();
|
33
|
+
this._finalize();
|
34
|
+
}
|
35
|
+
|
36
|
+
_handleYamlFiles() {
|
37
|
+
this._loadYamlFiles(this.envYamlPaths);
|
38
|
+
this._validateYamlFiles();
|
39
|
+
this._haltIfParsingErrors();
|
40
|
+
this._extractErrors();
|
41
|
+
}
|
42
|
+
|
43
|
+
_handleDotEnvFiles() {
|
44
|
+
this._loadDotEnvFiles(this.dotEnvPaths);
|
45
|
+
this._parseDotEnvFiles();
|
46
|
+
this._combineDotEnvFiles();
|
47
|
+
this._extractWarnings();
|
48
|
+
}
|
49
|
+
|
50
|
+
_loadYamlFiles(envYamlPaths: string[]) {
|
51
|
+
envYamlPaths.forEach((path) => {
|
52
|
+
const validator = new SingleEnvValidator(path);
|
53
|
+
this.yamlValidators.push(validator);
|
54
|
+
});
|
55
|
+
}
|
56
|
+
|
57
|
+
_validateYamlFiles() {
|
58
|
+
this.yamlValidators.forEach((x) => x.validate());
|
59
|
+
}
|
60
|
+
|
61
|
+
_haltIfParsingErrors() {
|
62
|
+
const filesWithParsingErrors = this.yamlValidators.filter((validator) =>
|
63
|
+
Boolean(validator.parsingError),
|
64
|
+
);
|
65
|
+
if (filesWithParsingErrors.length === 0) return;
|
66
|
+
|
67
|
+
console.error('The following env.yaml files have parsing errors:');
|
68
|
+
filesWithParsingErrors.forEach((validator: SingleEnvValidator) => {
|
69
|
+
console.error(`\t${validator.parsingError}`);
|
70
|
+
});
|
71
|
+
process.exit(1);
|
72
|
+
}
|
73
|
+
|
74
|
+
_extractErrors() {
|
75
|
+
this.yamlValidators.forEach((validator) => {
|
76
|
+
Object.keys(validator.parsedEnvYaml ?? {}).forEach((envVar) => {
|
77
|
+
this.keysFromYamlFiles.add(envVar);
|
78
|
+
});
|
79
|
+
Object.entries(validator.errors).forEach(([envVar, error]) => {
|
80
|
+
this.errors[envVar] ??= [];
|
81
|
+
this.errors[envVar].push(error);
|
82
|
+
});
|
83
|
+
});
|
84
|
+
}
|
85
|
+
|
86
|
+
_loadDotEnvFiles(dotEnvPaths: string[] = []) {
|
87
|
+
dotEnvPaths.forEach((path) => {
|
88
|
+
const parser = new DotEnvParser(path);
|
89
|
+
this.dotEnvParsers.push(parser);
|
90
|
+
});
|
91
|
+
}
|
92
|
+
|
93
|
+
_parseDotEnvFiles() {
|
94
|
+
this.dotEnvParsers.forEach((x) => x.parse());
|
95
|
+
}
|
96
|
+
|
97
|
+
_combineDotEnvFiles() {
|
98
|
+
this.dotEnvParsers.forEach((parser) => {
|
99
|
+
if (!parser.keys) return;
|
100
|
+
parser.keys.forEach((key) => {
|
101
|
+
this.keysFromDotEnvFiles[key] ??= [];
|
102
|
+
this.keysFromDotEnvFiles[key].push(parser.path);
|
103
|
+
});
|
104
|
+
});
|
105
|
+
}
|
106
|
+
|
107
|
+
_extractWarnings() {
|
108
|
+
const unusedKeys = Object.keys(this.keysFromDotEnvFiles).filter(
|
109
|
+
(x) => !this.keysFromYamlFiles.has(x),
|
110
|
+
);
|
111
|
+
unusedKeys.forEach((x) => {
|
112
|
+
this.warnings.push(`${x} in: ${this.keysFromDotEnvFiles[x].join(', ')}`);
|
113
|
+
});
|
114
|
+
}
|
115
|
+
|
116
|
+
_finalize() {
|
117
|
+
if (this.warnings.length > 0) {
|
118
|
+
console.error(
|
119
|
+
'WARNING: some env variables exist in .env but not in env.yaml:',
|
120
|
+
);
|
121
|
+
this.warnings.forEach((warning) => console.error(`\t${warning}`));
|
122
|
+
console.error();
|
123
|
+
}
|
124
|
+
if (Object.keys(this.errors).length > 0) {
|
125
|
+
Object.entries(this.errors).forEach(([key, errors]) => {
|
126
|
+
console.error(`Errors for ${key}:`);
|
127
|
+
errors.forEach((error) => console.error(`\t${error}`));
|
128
|
+
console.error();
|
129
|
+
});
|
130
|
+
console.error();
|
131
|
+
process.exit(1);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
* While we don't strictly need to parse .env files (we can simply use process.env), it is useful to give
|
138
|
+
* warnings to the user that there are unused entries in .env files compared to the stated requirements
|
139
|
+
* captured in env.yaml files.
|
140
|
+
*/
|
141
|
+
export class DotEnvParser {
|
142
|
+
path: string;
|
143
|
+
keys: string[] | undefined;
|
144
|
+
|
145
|
+
constructor(path: string) {
|
146
|
+
this.path = path;
|
147
|
+
}
|
148
|
+
|
149
|
+
parse() {
|
150
|
+
const text = this._readFile(this.path);
|
151
|
+
if (text) this.keys = this._parse(text);
|
152
|
+
}
|
153
|
+
|
154
|
+
_readFile(path: string) {
|
155
|
+
if (!fs.existsSync(path)) return;
|
156
|
+
return fs.readFileSync(path).toString();
|
157
|
+
}
|
158
|
+
|
159
|
+
_parse(text: string) {
|
160
|
+
const lines = text.split('\n');
|
161
|
+
const withoutComments = lines
|
162
|
+
.map((x) => x.replace(/#.*$/, '').trim())
|
163
|
+
.filter(Boolean);
|
164
|
+
const keys = withoutComments
|
165
|
+
.map((x) => x.split('=').map((y) => y.trim()))
|
166
|
+
.filter((x) => x.length > 1)
|
167
|
+
.map((x) => x[0]);
|
168
|
+
return keys;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
export class SingleEnvValidator {
|
173
|
+
envYamlPath: string;
|
174
|
+
parsedEnvYaml: ParsedEnvYaml | undefined;
|
175
|
+
parsingError: string | undefined;
|
176
|
+
errors: Record<string, string> = {};
|
177
|
+
|
178
|
+
constructor(envYamlPath: string) {
|
179
|
+
this.envYamlPath = envYamlPath;
|
180
|
+
}
|
181
|
+
|
182
|
+
validate() {
|
183
|
+
this.parsedEnvYaml = this._parse();
|
184
|
+
if (!this.parsingError) this._addAllErrors();
|
185
|
+
}
|
186
|
+
|
187
|
+
_readFile() {
|
188
|
+
if (!fs.existsSync(this.envYamlPath)) {
|
189
|
+
console.error(`Skipping ${this.envYamlPath}: does not exist`);
|
190
|
+
return;
|
191
|
+
}
|
192
|
+
return yaml.parse(fs.readFileSync(this.envYamlPath).toString());
|
193
|
+
}
|
194
|
+
|
195
|
+
_generateError(message: string) {
|
196
|
+
return `Error in ${this.envYamlPath}: ${message}`;
|
197
|
+
}
|
198
|
+
|
199
|
+
_setParsingError(message: string) {
|
200
|
+
this.parsingError = this._generateError(message);
|
201
|
+
}
|
202
|
+
|
203
|
+
_addError(key: string, message: string) {
|
204
|
+
this.errors[key] = this._generateError(message);
|
205
|
+
}
|
206
|
+
|
207
|
+
_parse() {
|
208
|
+
const allEnv: ParsedEnvYaml = {};
|
209
|
+
const envManifest = this._readFile();
|
210
|
+
if (!envManifest) return;
|
211
|
+
if (!(envManifest instanceof Array)) {
|
212
|
+
this._setParsingError(`env.yaml file must resolve to an array`);
|
213
|
+
return;
|
214
|
+
}
|
215
|
+
envManifest.forEach((env: string | object) => {
|
216
|
+
if (env instanceof Object) {
|
217
|
+
const entries = Object.entries(env);
|
218
|
+
if (entries.length > 1) {
|
219
|
+
this._setParsingError(
|
220
|
+
`every object in env.yaml must have one key. Error near: ${entries[0][0]}`,
|
221
|
+
);
|
222
|
+
return;
|
223
|
+
}
|
224
|
+
const [name, value] = entries[0];
|
225
|
+
if (
|
226
|
+
!(value instanceof Array) &&
|
227
|
+
!['optional', 'boolean'].includes(value as string)
|
228
|
+
) {
|
229
|
+
this._setParsingError(
|
230
|
+
`invalid value for ${name}: ${JSON.stringify(value)}`,
|
231
|
+
);
|
232
|
+
return;
|
233
|
+
}
|
234
|
+
allEnv[name] = value;
|
235
|
+
} else {
|
236
|
+
allEnv[env] = 'required';
|
237
|
+
}
|
238
|
+
});
|
239
|
+
return allEnv;
|
240
|
+
}
|
241
|
+
|
242
|
+
_addAllErrors() {
|
243
|
+
Object.entries(this.parsedEnvYaml!).forEach(([key, requirement]) => {
|
244
|
+
const value = process.env[key];
|
245
|
+
if (requirement !== 'optional' && !value) {
|
246
|
+
this._addError(key, `${key} is required but missing`);
|
247
|
+
} else if (
|
248
|
+
requirement === 'boolean' &&
|
249
|
+
!['true', 'false'].includes(String(value))
|
250
|
+
) {
|
251
|
+
this._addError(
|
252
|
+
key,
|
253
|
+
`${key} must be either true or false. Value: ${value}`,
|
254
|
+
);
|
255
|
+
} else if (
|
256
|
+
requirement instanceof Array &&
|
257
|
+
!requirement.includes(value ?? '')
|
258
|
+
) {
|
259
|
+
this._addError(
|
260
|
+
key,
|
261
|
+
`${key} must be one of ${requirement.join(', ')}. Value: ${value}`,
|
262
|
+
);
|
263
|
+
}
|
264
|
+
});
|
265
|
+
}
|
266
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# These will be used when generating kubernetes entities
|
2
|
+
project-name: changeme
|
3
|
+
|
4
|
+
# Supported: hetzner or digitalocean
|
5
|
+
infra: hetzner
|
6
|
+
|
7
|
+
# Only relevant for Digital Ocean. Determines the number of versions to keep for each docker image.
|
8
|
+
image-versions-to-keep: 5
|
9
|
+
|
10
|
+
registry-base-url: registry.staging.com
|
11
|
+
registry-name: changeme
|
12
|
+
|
13
|
+
# production and staging are supported by default
|
14
|
+
extra-remote-environments: []
|
15
|
+
|
16
|
+
# development and test are supported by default
|
17
|
+
extra-local-environments: []
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# The file structure is as follows:
|
2
|
+
#
|
3
|
+
# Under `templates` key:
|
4
|
+
# <template-key>:
|
5
|
+
# copy-common: <boolean>
|
6
|
+
# extra-content:
|
7
|
+
# - <file-name>
|
8
|
+
# - <file-name>
|
9
|
+
#
|
10
|
+
# Where:
|
11
|
+
# <template-key> The identifier of the template.
|
12
|
+
# This is used to refer to the template in the images section.
|
13
|
+
# copy-common Whether to copy the common Docker files from .devops/docker-images/common to the image.
|
14
|
+
# extra-content Any files to include in the image that are not part of the build context. By default, all applications and their dependencies are copied, as well as the
|
15
|
+
# content of .devops/docker-images/<image-name>. If you need to include additional files, list them here. These are typically from the root of the project.
|
16
|
+
# Files and full folders are supported. Globs (wildcards) are currently not supported.
|
17
|
+
#
|
18
|
+
#
|
19
|
+
# Under `images` key:
|
20
|
+
# <image-key>:
|
21
|
+
# image-template: <image-template>
|
22
|
+
# language: <language>
|
23
|
+
# debug-template: <debug-template>
|
24
|
+
# can-db-migrate: <boolean>
|
25
|
+
# domains:
|
26
|
+
# production: <production-domain>
|
27
|
+
# staging: <staging-domain>
|
28
|
+
# image-extra-content:
|
29
|
+
# - <file-name>
|
30
|
+
# - <file-name>
|
31
|
+
# applications:
|
32
|
+
# - <application-name>
|
33
|
+
# - <application-name>
|
34
|
+
#
|
35
|
+
# Where:
|
36
|
+
# <image-name> The identifier of the image. Github action should refer to this name in a hard-coded manner when invoking devops scripts.
|
37
|
+
# This is also the basis for the name of the image in the registry.
|
38
|
+
# image-template The build process copies .devops/docker-images/<image-template>.Dockerfile and .devops/docker-images/<image-template>/ to the image.
|
39
|
+
# language The language of the image. Currently only "node" and "python" are supported.
|
40
|
+
# debug-template Each image comes with a debug pod that can be acccessed as a console. This is the name of the template to use. Only "debug-console" is currently supported.
|
41
|
+
# can-db-migrate Whether this image can be used to run DB migrations. If set to true, the image could be used to run DB migrations if any project that uses this image depends
|
42
|
+
# on the db project and if the db project changed.
|
43
|
+
# domains The domains for the image. This is used to generate the ingress rules.
|
44
|
+
# This can be left out if the image does not have ingress rules, such as a worker image.
|
45
|
+
# applications List of applications that use this image. There is no need to specify dependencies - they will be derived as long as they are declared in package.json.
|
46
|
+
#
|
47
|
+
|
48
|
+
templates:
|
49
|
+
node-services:
|
50
|
+
copy-common: true
|
51
|
+
extra-content:
|
52
|
+
- devops
|
53
|
+
- package.json
|
54
|
+
- bun.lock
|
55
|
+
- tsconfig.json
|
56
|
+
- .npmrc
|
57
|
+
|
58
|
+
python-services:
|
59
|
+
copy-common: true
|
60
|
+
extra-content:
|
61
|
+
- devopspy
|
62
|
+
- pyproject.toml
|
63
|
+
- uv.lock
|
64
|
+
|
65
|
+
images:
|
66
|
+
main-node:
|
67
|
+
image-template: node-services
|
68
|
+
language: node
|
69
|
+
debug-template: debug-console
|
70
|
+
can-db-migrate: true
|
71
|
+
domains:
|
72
|
+
production: production.com
|
73
|
+
staging: staging.com
|
74
|
+
applications:
|
75
|
+
- example-node
|
76
|
+
- jobs
|
77
|
+
|
78
|
+
main-python:
|
79
|
+
image-template: python-services
|
80
|
+
language: python
|
81
|
+
debug-template: debug-console
|
82
|
+
can-db-migrate: false
|
83
|
+
domains:
|
84
|
+
production: production.com
|
85
|
+
staging: staging.com
|
86
|
+
applications:
|
87
|
+
- example-python
|
88
|
+
- example-data-pipeline
|
@@ -0,0 +1,23 @@
|
|
1
|
+
check_env() {
|
2
|
+
if [ -z "${MONOREPO_ENV}" ]; then
|
3
|
+
echo "ERROR: MONOREPO_ENV does not exist"
|
4
|
+
exit 1
|
5
|
+
fi
|
6
|
+
}
|
7
|
+
|
8
|
+
setup_config() {
|
9
|
+
mkdir -p /app/config
|
10
|
+
|
11
|
+
if [ -f /etc/kubernetes/secrets/env_json ]; then
|
12
|
+
jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' /etc/kubernetes/secrets/env_json > /app/config/.env.global
|
13
|
+
else
|
14
|
+
echo "WARNING: /etc/kubernetes/secrets/env_json does not exist"
|
15
|
+
fi
|
16
|
+
}
|
17
|
+
|
18
|
+
pause_if_no_args() {
|
19
|
+
if [ "$1" -eq 0 ]; then
|
20
|
+
echo "WARNING: No args provided. Pausing."
|
21
|
+
tail -f /dev/null
|
22
|
+
fi
|
23
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# FROM node:bookworm-slim
|
2
|
+
FROM node:22.4.1-bookworm-slim
|
3
|
+
|
4
|
+
RUN apt-get update && apt-get install -y jq curl
|
5
|
+
|
6
|
+
WORKDIR /app
|
7
|
+
|
8
|
+
ENV NODE_ENV=production
|
9
|
+
|
10
|
+
ARG MONOREPO_ENV
|
11
|
+
ENV MONOREPO_ENV=${MONOREPO_ENV}
|
12
|
+
RUN echo "Building for environment: $MONOREPO_ENV"
|
13
|
+
|
14
|
+
RUN npm install -g bun
|
15
|
+
|
16
|
+
# This assumes devops prep-build was called by the host, which creates the config/ folder with necessary env variables
|
17
|
+
# that are needed to be statitcally resolved by devops run-many build (e.g. NEXT_PUBLIC_*)
|
18
|
+
COPY . .
|
19
|
+
|
20
|
+
# Install dependencies using bun
|
21
|
+
# Mount the GH_PAT_TOKEN secret and use it during bun install
|
22
|
+
RUN --mount=type=secret,id=GH_PAT_TOKEN \
|
23
|
+
--mount=type=cache,target=/root/.bun/install/cache \
|
24
|
+
GH_PAT_TOKEN=$(cat /run/secrets/GH_PAT_TOKEN) bun install
|
25
|
+
|
26
|
+
# For prisma client, if used
|
27
|
+
RUN ./devops run-many generate
|
28
|
+
RUN ./devops run-many build
|
29
|
+
|
30
|
+
# The config folder will be mounted when the pod starts with up-to-date env variables that are used in runtime by server-side code
|
31
|
+
RUN rm -rf config/
|
32
|
+
|
33
|
+
# Pods may override this entrypoint to `node-exec.sh` using the `command` field in the pod spec.
|
34
|
+
ENTRYPOINT [ "./node-run.sh" ]
|
@@ -0,0 +1,29 @@
|
|
1
|
+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
|
2
|
+
|
3
|
+
ENV UV_SYSTEM_PYTHON=1
|
4
|
+
ENV PATH="/root/.local/bin:$PATH"
|
5
|
+
|
6
|
+
WORKDIR /app
|
7
|
+
|
8
|
+
ARG MONOREPO_ENV
|
9
|
+
ENV MONOREPO_ENV=${MONOREPO_ENV}
|
10
|
+
RUN echo "Building for environment: $MONOREPO_ENV"
|
11
|
+
|
12
|
+
# Install dependencies
|
13
|
+
RUN apt-get update && apt-get install -y jq libpq-dev curl git parallel --fix-missing
|
14
|
+
|
15
|
+
# Copy project files
|
16
|
+
COPY . .
|
17
|
+
|
18
|
+
RUN \
|
19
|
+
--mount=type=cache,target=/root/.cache/uv \
|
20
|
+
uv sync --all-packages --all-extras
|
21
|
+
|
22
|
+
# For prisma client, if used
|
23
|
+
RUN ./devopspy run-many generate
|
24
|
+
RUN ./devopspy run-many build
|
25
|
+
|
26
|
+
# The config folder will be mounted when the pod starts with up-to-date env variables that are used in runtime by server-side code
|
27
|
+
RUN rm -rf config/
|
28
|
+
|
29
|
+
ENTRYPOINT [ "./python-run.sh" ]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# env.yaml files should be placed in workspace folders, at the same level of their
|
2
|
+
# package.json / pyproject.toml file.
|
3
|
+
# The env.yaml file contains a list of environment variables the workspace depends on.
|
4
|
+
# It is intended to be useful for both humans and machines.
|
5
|
+
#
|
6
|
+
# You are encouraged to use comments to structure the file and make it easier to read.
|
7
|
+
#
|
8
|
+
# The commands `./devops run` and `./devops exec` inject the content of the environment files in `config/` into the process.
|
9
|
+
# Before executing, they validate the variables present in all applicable env.yaml files. If something is amiss, an error is raised.
|
10
|
+
#
|
11
|
+
# The file is structured as a YAML array of environment variables.
|
12
|
+
# If an environment variable is stated by name only, it is a required string.
|
13
|
+
# If it is stated as an object, it can have the following structure:
|
14
|
+
# - ENV_NAME: optional # => may be ommitted or empty
|
15
|
+
# - ENV_NAME: boolean # => must be either `true` or `false`
|
16
|
+
# - ENV_NAME: ["value1", "value2"] # => must be one of the listed values
|
17
|
+
#
|
18
|
+
# Example:
|
19
|
+
# - NEXT_PUBLIC_REQUIRED_MESSAGE
|
20
|
+
# - REDIS_PROTOCOL: ["redis", "rediss"]
|
21
|
+
# - IS_SPECIAL_FEATURE_AVAILABLE: boolean
|
22
|
+
# - MESSAGE_OVERRIDE: optional
|
23
|
+
#
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# While this works when setting Cloudflare TLS encryption mode to "full", it fails when too big layers are attempted to be pushed
|
2
|
+
expose:
|
3
|
+
type: ingress
|
4
|
+
ingress:
|
5
|
+
hosts:
|
6
|
+
core: $REGISTRY_DOMAIN
|
7
|
+
className: "nginx"
|
8
|
+
annotations:
|
9
|
+
nginx.ingress.kubernetes.io/ssl-redirect: "false"
|
10
|
+
nginx.ingress.kubernetes.io/proxy-body-size: "0"
|
11
|
+
ingress.kubernetes.io/ssl-redirect: "false"
|
12
|
+
ingress.kubernetes.io/proxy-body-size: "0"
|
13
|
+
tls:
|
14
|
+
enabled: false
|
15
|
+
externalURL: https://$REGISTRY_DOMAIN
|
16
|
+
persistence:
|
17
|
+
enabled: true
|
18
|
+
persistentVolumeClaim:
|
19
|
+
registry:
|
20
|
+
storageClass: "hcloud-volumes"
|
21
|
+
accessMode: ReadWriteOnce
|
22
|
+
size: 20Gi
|
23
|
+
jobservice:
|
24
|
+
storageClass: "hcloud-volumes"
|
25
|
+
accessMode: ReadWriteOnce
|
26
|
+
size: 5Gi
|
27
|
+
chartmuseum:
|
28
|
+
storageClass: "hcloud-volumes"
|
29
|
+
accessMode: ReadWriteOnce
|
30
|
+
size: 5Gi
|
@@ -0,0 +1,134 @@
|
|
1
|
+
---
|
2
|
+
cluster_name: changeme
|
3
|
+
kubeconfig_path: "./kubeconfig"
|
4
|
+
k3s_version: v1.32.2+k3s1
|
5
|
+
|
6
|
+
networking:
|
7
|
+
ssh:
|
8
|
+
port: 22
|
9
|
+
use_agent: false # set to true if your key has a passphrase
|
10
|
+
public_key_path: "~/.ssh/id_hcloud.pub"
|
11
|
+
private_key_path: "~/.ssh/id_hcloud"
|
12
|
+
allowed_networks:
|
13
|
+
ssh:
|
14
|
+
- 0.0.0.0/0
|
15
|
+
api: # this will firewall port 6443 on the nodes
|
16
|
+
- 0.0.0.0/0
|
17
|
+
public_network:
|
18
|
+
ipv4: false
|
19
|
+
ipv6: false
|
20
|
+
private_network:
|
21
|
+
enabled: true
|
22
|
+
subnet: 10.0.0.0/16
|
23
|
+
existing_network_name: "cluster-network"
|
24
|
+
cni:
|
25
|
+
enabled: true
|
26
|
+
encryption: false
|
27
|
+
mode: flannel
|
28
|
+
|
29
|
+
# cluster_cidr: 10.244.0.0/16 # optional: a custom IPv4/IPv6 network CIDR to use for pod IPs
|
30
|
+
# service_cidr: 10.43.0.0/16 # optional: a custom IPv4/IPv6 network CIDR to use for service IPs. Warning, if you change this, you should also change cluster_dns!
|
31
|
+
# cluster_dns: 10.43.0.10 # optional: IPv4 Cluster IP for coredns service. Needs to be an address from the service_cidr range
|
32
|
+
|
33
|
+
|
34
|
+
# manifests:
|
35
|
+
# cloud_controller_manager_manifest_url: "https://github.com/hetznercloud/hcloud-cloud-controller-manager/releases/download/v1.23.0/ccm-networks.yaml"
|
36
|
+
# csi_driver_manifest_url: "https://raw.githubusercontent.com/hetznercloud/csi-driver/v2.12.0/deploy/kubernetes/hcloud-csi.yml"
|
37
|
+
# system_upgrade_controller_deployment_manifest_url: "https://github.com/rancher/system-upgrade-controller/releases/download/v0.14.2/system-upgrade-controller.yaml"
|
38
|
+
# system_upgrade_controller_crd_manifest_url: "https://github.com/rancher/system-upgrade-controller/releases/download/v0.14.2/crd.yaml"
|
39
|
+
# cluster_autoscaler_manifest_url: "https://raw.githubusercontent.com/kubernetes/autoscaler/master/cluster-autoscaler/cloudprovider/hetzner/examples/cluster-autoscaler-run-on-master.yaml"
|
40
|
+
# cluster_autoscaler_container_image_tag: "v1.32.0"
|
41
|
+
|
42
|
+
# datastore:
|
43
|
+
# mode: etcd # etcd (default) or external
|
44
|
+
# external_datastore_endpoint: postgres://....
|
45
|
+
|
46
|
+
schedule_workloads_on_masters: false
|
47
|
+
|
48
|
+
# image: rocky-9 # optional: default is ubuntu-24.04
|
49
|
+
# autoscaling_image: 103908130 # optional, defaults to the `image` setting
|
50
|
+
# snapshot_os: microos # optional: specified the os type when using a custom snapshot
|
51
|
+
|
52
|
+
masters_pool:
|
53
|
+
instance_type: cpx21
|
54
|
+
instance_count: 1 # for HA; you can also create a single master cluster for dev and testing (not recommended for production)
|
55
|
+
locations: # You can choose a single location for single master clusters or if you prefer to have all masters in the same location. For regional clusters (which are only available in the eu-central network zone), each master needs to be placed in a separate location.
|
56
|
+
# - fsn1
|
57
|
+
# - hel1
|
58
|
+
- nbg1
|
59
|
+
|
60
|
+
worker_node_pools:
|
61
|
+
- name: small-static
|
62
|
+
instance_type: cpx21
|
63
|
+
instance_count: 2
|
64
|
+
location: nbg1
|
65
|
+
# image: debian-11
|
66
|
+
# labels:
|
67
|
+
# - key: purpose
|
68
|
+
# value: blah
|
69
|
+
# taints:
|
70
|
+
# - key: something
|
71
|
+
# value: value1:NoSchedule
|
72
|
+
# - name: medium-autoscaled
|
73
|
+
# instance_type: cpx31
|
74
|
+
# location: fsn1
|
75
|
+
# autoscaling:
|
76
|
+
# enabled: true
|
77
|
+
# min_instances: 0
|
78
|
+
# max_instances: 3
|
79
|
+
|
80
|
+
embedded_registry_mirror:
|
81
|
+
enabled: false # Enables fast p2p distribution of container images between nodes for faster pod startup. Check if your k3s version is compatible before enabling this option. You can find more information at https://docs.k3s.io/installation/registry-mirror
|
82
|
+
|
83
|
+
protect_against_deletion: true
|
84
|
+
|
85
|
+
create_load_balancer_for_the_kubernetes_api: false # Just a heads up: right now, we can’t limit access to the load balancer by IP through the firewall. This feature hasn’t been added by Hetzner yet.
|
86
|
+
|
87
|
+
# See https://github.com/vitobotta/hetzner-k3s/blob/main/docs/Private_clusters_with_public_network_interface_disabled.md
|
88
|
+
post_create_commands:
|
89
|
+
- apt update
|
90
|
+
- apt upgrade -y
|
91
|
+
- apt install ifupdown resolvconf -y
|
92
|
+
- apt autoremove -y hc-utils
|
93
|
+
- apt purge -y hc-utils
|
94
|
+
- echo "auto enp7s0" > /etc/network/interfaces.d/60-private
|
95
|
+
- echo "iface enp7s0 inet dhcp" >> /etc/network/interfaces.d/60-private
|
96
|
+
- echo " post-up ip route add default via 10.0.0.1" >> /etc/network/interfaces.d/60-private
|
97
|
+
- echo "[Resolve]" > /etc/systemd/resolved.conf
|
98
|
+
- echo "DNS=1.1.1.1 1.0.0.1" >> /etc/systemd/resolved.conf
|
99
|
+
- ifdown enp7s0
|
100
|
+
- ifup enp7s0
|
101
|
+
- systemctl start resolvconf
|
102
|
+
- systemctl enable resolvconf
|
103
|
+
- echo "nameserver 1.1.1.1" >> /etc/resolvconf/resolv.conf.d/head
|
104
|
+
- echo "nameserver 1.0.0.1" >> /etc/resolvconf/resolv.conf.d/head
|
105
|
+
- resolvconf --enable-updates
|
106
|
+
- resolvconf -u
|
107
|
+
|
108
|
+
# additional_packages:
|
109
|
+
# - somepackage
|
110
|
+
|
111
|
+
# post_create_commands:
|
112
|
+
# - apt update
|
113
|
+
# - apt upgrade -y
|
114
|
+
# - apt autoremove -y
|
115
|
+
|
116
|
+
# kube_api_server_args:
|
117
|
+
# - arg1
|
118
|
+
# - ...
|
119
|
+
# kube_scheduler_args:
|
120
|
+
# - arg1
|
121
|
+
# - ...
|
122
|
+
# kube_controller_manager_args:
|
123
|
+
# - arg1
|
124
|
+
# - ...
|
125
|
+
# kube_cloud_controller_manager_args:
|
126
|
+
# - arg1
|
127
|
+
# - ...
|
128
|
+
# kubelet_args:
|
129
|
+
# - arg1
|
130
|
+
# - ...
|
131
|
+
# kube_proxy_args:
|
132
|
+
# - arg1
|
133
|
+
# - ...
|
134
|
+
# api_server_hostname: k8s.example.com # optional: DNS for the k8s API LoadBalancer. After the script has run, create a DNS record with the address of the API LoadBalancer.
|