Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to reproduce kubernetes. #23439

Merged
merged 3 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/actions/compare-base/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@ runs:
- name: 'MERGE: quirks'
id: quirks
run: |
# docker-compose is not reproducible, copy old config
# docker-compose and kubernetes are not reproducible, copy old config
ls "$JHI_FOLDER_APP/docker-compose" \
&& mkdir "${{ inputs.application-path }}/docker-compose" \
&& cp "$JHI_FOLDER_APP/docker-compose"/.yo-rc.json "${{ inputs.application-path }}/docker-compose" \
|| true
ls "$JHI_FOLDER_APP/kubernetes" \
&& mkdir "${{ inputs.application-path }}/kubernetes" \
&& cp "$JHI_FOLDER_APP/kubernetes"/.yo-rc.json "${{ inputs.application-path }}/kubernetes" \
|| true
shell: bash
- name: 'MERGE: merge base project'
id: base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`generator - Kubernetes Helm Kafka application should match files snapsh
"generator-jhipster": {
"appsFolders": ["09-kafka"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "monolith",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -394,6 +395,7 @@ exports[`generator - Kubernetes Helm MySQL and PostgreSQL microservices without
"generator-jhipster": {
"appsFolders": ["02-mysql", "03-psql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -1281,6 +1283,7 @@ exports[`generator - Kubernetes Helm gateway and ingress should match files snap
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -1929,6 +1932,7 @@ exports[`generator - Kubernetes Helm gateway and mysql microservice should match
"generator-jhipster": {
"appsFolders": ["01-gateway", "02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -2741,6 +2745,7 @@ exports[`generator - Kubernetes Helm gateway with istio should match files snaps
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -3623,6 +3628,7 @@ exports[`generator - Kubernetes Helm gateway, mysql, psql, mongodb, mariadb micr
],
"baseName": "workspaces",
"clusteredDbApps": [],
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -5067,6 +5073,7 @@ exports[`generator - Kubernetes Helm monolith application should match files sna
"generator-jhipster": {
"appsFolders": ["08-monolith"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "monolith",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -5439,6 +5446,7 @@ exports[`generator - Kubernetes Helm mysql microservice with custom namespace an
"generator-jhipster": {
"appsFolders": ["02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -8419,6 +8427,7 @@ exports[`generator - Kubernetes Helm mysql microservice with custom namespace sh
"generator-jhipster": {
"appsFolders": ["02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -9052,6 +9061,7 @@ exports[`generator - Kubernetes Helm only gateway should match files snapshot 1`
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down
16 changes: 16 additions & 0 deletions generators/kubernetes-knative/__snapshots__/knative.spec.mts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`generator - Knative Using Helm generator type MySQL and PostgreSQL micr
"generator-jhipster": {
"appsFolders": ["02-mysql", "03-psql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -1073,6 +1074,7 @@ exports[`generator - Knative Using Helm generator type gateway and ingress shoul
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -1895,6 +1897,7 @@ exports[`generator - Knative Using Helm generator type gateway and mysql microse
"generator-jhipster": {
"appsFolders": ["01-gateway", "02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -2930,6 +2933,7 @@ exports[`generator - Knative Using Helm generator type gateway with istio routin
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -3759,6 +3763,7 @@ exports[`generator - Knative Using Helm generator type gateway, mysql, psql, mon
],
"baseName": "workspaces",
"clusteredDbApps": [],
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -5522,6 +5527,7 @@ exports[`generator - Knative Using Helm generator type mysql microservice with c
"generator-jhipster": {
"appsFolders": ["02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -8697,6 +8703,7 @@ exports[`generator - Knative Using Helm generator type mysql microservice with c
"generator-jhipster": {
"appsFolders": ["02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -9475,6 +9482,7 @@ exports[`generator - Knative Using Helm generator type only gateway should match
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipsterrepository",
Expand Down Expand Up @@ -10306,6 +10314,7 @@ exports[`generator - Knative Using K8s generator type MySQL and PostgreSQL micro
"generator-jhipster": {
"appsFolders": ["02-mysql", "03-psql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -11294,6 +11303,7 @@ exports[`generator - Knative Using K8s generator type gateway and ingress should
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -12045,6 +12055,7 @@ exports[`generator - Knative Using K8s generator type gateway and mysql microser
"generator-jhipster": {
"appsFolders": ["01-gateway", "02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -12994,6 +13005,7 @@ exports[`generator - Knative Using K8s generator type gateway with istio routing
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -13753,6 +13765,7 @@ exports[`generator - Knative Using K8s generator type gateway, mysql, psql, mong
],
"baseName": "workspaces",
"clusteredDbApps": [],
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -15886,6 +15899,7 @@ exports[`generator - Knative Using K8s generator type mysql microservice with cu
"generator-jhipster": {
"appsFolders": ["02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -19284,6 +19298,7 @@ exports[`generator - Knative Using K8s generator type mysql microservice with cu
"generator-jhipster": {
"appsFolders": ["02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipster",
Expand Down Expand Up @@ -19990,6 +20005,7 @@ exports[`generator - Knative Using K8s generator type only gateway should match
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"directoryPath": "./",
"dockerPushCommand": "docker push",
"dockerRepositoryName": "jhipsterrepository",
Expand Down
14 changes: 14 additions & 0 deletions generators/kubernetes/__snapshots__/kubernetes.spec.mts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`generator - Kubernetes Kafka application should match files snapshot 1`
"generator-jhipster": {
"appsFolders": ["09-kafka"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "monolith",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -489,6 +490,7 @@ exports[`generator - Kubernetes MySQL and PostgreSQL microservices without gatew
"generator-jhipster": {
"appsFolders": ["02-mysql", "03-psql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -1447,6 +1449,7 @@ exports[`generator - Kubernetes gateway and ingress should match files snapshot
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -2136,6 +2139,7 @@ exports[`generator - Kubernetes gateway and ingressType gke should match files s
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -5661,6 +5665,7 @@ exports[`generator - Kubernetes gateway and ingressType nginx should match files
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -9098,6 +9103,7 @@ exports[`generator - Kubernetes gateway and mysql microservice should match file
"generator-jhipster": {
"appsFolders": ["01-gateway", "02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -9949,6 +9955,7 @@ exports[`generator - Kubernetes gateway with istio routing should match files sn
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -10938,6 +10945,7 @@ exports[`generator - Kubernetes gateway, mysql, psql, mongodb, mariadb, mssql mi
],
"baseName": "workspaces",
"clusteredDbApps": [],
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -12937,6 +12945,7 @@ exports[`generator - Kubernetes monolith application should match files snapshot
"generator-jhipster": {
"appsFolders": ["08-monolith"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "monolith",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -13391,6 +13400,7 @@ exports[`generator - Kubernetes mysql microservice with custom namespace and jhi
"generator-jhipster": {
"appsFolders": ["02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -16744,6 +16754,7 @@ exports[`generator - Kubernetes mysql microservice with custom namespace should
"generator-jhipster": {
"appsFolders": ["02-mysql"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -17428,6 +17439,7 @@ exports[`generator - Kubernetes mysql, psql, mongodb, mariadb, mssql microservic
],
"baseName": "workspaces",
"clusteredDbApps": [],
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "microservice",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -19427,6 +19439,7 @@ exports[`generator - Kubernetes only gateway should match files snapshot 1`] = `
"generator-jhipster": {
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "gateway",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down Expand Up @@ -20102,6 +20115,7 @@ exports[`generator - Kubernetes only gateway with eureka should match files snap
"adminPassword": "meetup",
"appsFolders": ["01-gateway"],
"baseName": "workspaces",
"dbRandomPassword": "SECRET-PASSWORD",
"deploymentApplicationType": "monolith",
"directoryPath": "./",
"dockerPushCommand": "docker push",
Expand Down
6 changes: 5 additions & 1 deletion generators/kubernetes/kubernetes-base.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,17 @@ export const checkHelm = runAsync(function () {

export function loadConfig() {
loadFromYoRc.call(this);
if (!this.jhipsterConfig.dbRandomPassword) {
this.jhipsterConfig.dbRandomPassword = this.options.reproducibleTests ? 'SECRET-PASSWORD' : crypto.randomBytes(30).toString('hex');
}

const kubernetesWithDefaults = _.defaults({}, this.jhipsterConfig, defaultKubernetesConfig);
this.kubernetesNamespace = kubernetesWithDefaults.kubernetesNamespace;
this.kubernetesServiceType = kubernetesWithDefaults.kubernetesServiceType;
this.ingressType = kubernetesWithDefaults.ingressType;
this.ingressDomain = kubernetesWithDefaults.ingressDomain;
this.istio = kubernetesWithDefaults.istio;
this.dbRandomPassword = this.options.reproducibleTests ? 'SECRET-PASSWORD' : crypto.randomBytes(30).toString('hex');
this.dbRandomPassword = kubernetesWithDefaults.dbRandomPassword;
this.kubernetesUseDynamicStorage = kubernetesWithDefaults.kubernetesUseDynamicStorage;
this.kubernetesStorageClassName = kubernetesWithDefaults.kubernetesStorageClassName;
this.generatorType = kubernetesWithDefaults.generatorType;
Expand Down
Loading