Skip to content

Commit

Permalink
fix: Fix default postgreSQL credentials secret name (#1343)
Browse files Browse the repository at this point in the history
Signed-off-by: Anatolii Bazko <[email protected]>
  • Loading branch information
tolusha authored Mar 16, 2022
1 parent 51002ea commit 58f3f01
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 18 deletions.
1 change: 0 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@
"CONSOLE_LINK_DISPLAY_NAME": "Eclipse Che",
"CONSOLE_LINK_SECTION": "Red Hat Applications",
"CONSOLE_LINK_IMAGE": "/dashboard/assets/branding/loader.svg",
"CHE_SERVER_TRUST_STORE_CONFIGMAP_NAME": "ca-certs",
"MAX_CONCURRENT_RECONCILES": 10,
},
"envFile": "/tmp/che-operator-debug.env",
Expand Down
2 changes: 1 addition & 1 deletion api/v1/checluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ type CheClusterSpecDB struct {
// When the secret is defined, the `chePostgresUser` and `chePostgresPassword` are ignored.
// When the value is omitted or left blank, the one of following scenarios applies:
// 1. `chePostgresUser` and `chePostgresPassword` are defined, then they will be used to connect to the DB.
// 2. `chePostgresUser` or `chePostgresPassword` are not defined, then a new secret with the name `che-postgres-secret`
// 2. `chePostgresUser` or `chePostgresPassword` are not defined, then a new secret with the name `postgres-credentials`
// will be created with default value of `pgche` for `user` and with an auto-generated value for `password`.
// The secret must have `app.kubernetes.io/part-of=che.eclipse.org` label.
// +optional
Expand Down
1 change: 0 additions & 1 deletion api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion api/v2alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ metadata:
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/eclipse-che/che-operator
support: Eclipse Foundation
name: eclipse-che-preview-openshift.v7.45.0-435.next
name: eclipse-che-preview-openshift.v7.45.0-436.next
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1009,8 +1009,6 @@ spec:
value: Red Hat Applications
- name: CONSOLE_LINK_IMAGE
value: /dashboard/assets/branding/loader.svg
- name: CHE_SERVER_TRUST_STORE_CONFIGMAP_NAME
value: ca-certs
- name: MAX_CONCURRENT_RECONCILES
value: "1"
- name: ADD_COMPONENT_READINESS_INIT_CONTAINERS
Expand Down Expand Up @@ -1286,4 +1284,4 @@ spec:
maturity: stable
provider:
name: Eclipse Foundation
version: 7.45.0-435.next
version: 7.45.0-436.next
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ spec:
one of following scenarios applies: 1. `chePostgresUser` and
`chePostgresPassword` are defined, then they will be used
to connect to the DB. 2. `chePostgresUser` or `chePostgresPassword`
are not defined, then a new secret with the name `che-postgres-secret`
are not defined, then a new secret with the name `postgres-credentials`
will be created with default value of `pgche` for `user` and
with an auto-generated value for `password`. The secret must
have `app.kubernetes.io/part-of=che.eclipse.org` label.'
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/org_v1_che_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ spec:
one of following scenarios applies: 1. `chePostgresUser` and
`chePostgresPassword` are defined, then they will be used
to connect to the DB. 2. `chePostgresUser` or `chePostgresPassword`
are not defined, then a new secret with the name `che-postgres-secret`
are not defined, then a new secret with the name `postgres-credentials`
will be created with default value of `pgche` for `user` and
with an auto-generated value for `password`. The secret must
have `app.kubernetes.io/part-of=che.eclipse.org` label.'
Expand Down
2 changes: 0 additions & 2 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ spec:
value: Red Hat Applications
- name: CONSOLE_LINK_IMAGE
value: /dashboard/assets/branding/loader.svg
- name: CHE_SERVER_TRUST_STORE_CONFIGMAP_NAME
value: ca-certs
- name: MAX_CONCURRENT_RECONCILES
value: "1"
- name: ADD_COMPONENT_READINESS_INIT_CONTAINERS
Expand Down
2 changes: 1 addition & 1 deletion helmcharts/next/crds/org_v1_che_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ spec:
one of following scenarios applies: 1. `chePostgresUser` and
`chePostgresPassword` are defined, then they will be used
to connect to the DB. 2. `chePostgresUser` or `chePostgresPassword`
are not defined, then a new secret with the name `che-postgres-secret`
are not defined, then a new secret with the name `postgres-credentials`
will be created with default value of `pgche` for `user` and
with an auto-generated value for `password`. The secret must
have `app.kubernetes.io/part-of=che.eclipse.org` label.'
Expand Down
2 changes: 0 additions & 2 deletions helmcharts/next/templates/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ spec:
value: Red Hat Applications
- name: CONSOLE_LINK_IMAGE
value: /dashboard/assets/branding/loader.svg
- name: CHE_SERVER_TRUST_STORE_CONFIGMAP_NAME
value: ca-certs
- name: MAX_CONCURRENT_RECONCILES
value: "1"
- name: ADD_COMPONENT_READINESS_INIT_CONTAINERS
Expand Down
2 changes: 1 addition & 1 deletion pkg/deploy/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const (
DefaultPvcStrategy = "common"
DefaultPvcClaimSize = "10Gi"
DefaultIngressClass = "nginx"
DefaultChePostgresCredentialsSecret = "che-postgres-secret"
DefaultChePostgresCredentialsSecret = "postgres-credentials"

DefaultCheLogLevel = "INFO"
DefaultCheDebug = "false"
Expand Down
4 changes: 2 additions & 2 deletions pkg/deploy/postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TestPostgresReconcile(t *testing.T) {
assert.True(t, done)
assert.Nil(t, err)

assert.True(t, util.IsObjectExists(ctx.ClusterAPI.Client, types.NamespacedName{Name: "che-postgres-secret", Namespace: "eclipse-che"}, &corev1.Secret{}))
assert.True(t, util.IsObjectExists(ctx.ClusterAPI.Client, types.NamespacedName{Name: "postgres-credentials", Namespace: "eclipse-che"}, &corev1.Secret{}))
assert.True(t, util.IsObjectExists(ctx.ClusterAPI.Client, types.NamespacedName{Name: "postgres", Namespace: "eclipse-che"}, &corev1.Service{}))
assert.True(t, util.IsObjectExists(ctx.ClusterAPI.Client, types.NamespacedName{Name: "postgres-data", Namespace: "eclipse-che"}, &corev1.PersistentVolumeClaim{}))
assert.True(t, util.IsObjectExists(ctx.ClusterAPI.Client, types.NamespacedName{Name: "postgres", Namespace: "eclipse-che"}, &appsv1.Deployment{}))
Expand Down Expand Up @@ -149,7 +149,7 @@ func TestSyncPostgresCredentials(t *testing.T) {
assert.Nil(t, err)

postgresCredentialsSecret := &corev1.Secret{}
err = ctx.ClusterAPI.Client.Get(context.TODO(), types.NamespacedName{Name: "che-postgres-secret", Namespace: "eclipse-che"}, postgresCredentialsSecret)
err = ctx.ClusterAPI.Client.Get(context.TODO(), types.NamespacedName{Name: "postgres-credentials", Namespace: "eclipse-che"}, postgresCredentialsSecret)
assert.Nil(t, err)
assert.Equal(t, string(postgresCredentialsSecret.Data["user"]), "postgresUser")
assert.Equal(t, string(postgresCredentialsSecret.Data["password"]), "postgresPassword")
Expand Down

0 comments on commit 58f3f01

Please sign in to comment.