Przeglądaj źródła

Merge pull request #4957 from simaishi/cfme_581_update

Update cfme templates to auto-generate postgresql password
Scott Dodson 7 lat temu
rodzic
commit
eca4376584

+ 16 - 3
roles/openshift_examples/files/examples/v1.5/cfme-templates/cfme-template.yaml

@@ -10,6 +10,12 @@ metadata:
     iconClass: "icon-rails"
 objects:
 - apiVersion: v1
+  kind: Secret
+  metadata:
+    name: "${NAME}-secrets"
+  stringData:
+    pg-password: "${DATABASE_PASSWORD}"
+- apiVersion: v1
   kind: Service
   metadata:
     annotations:
@@ -148,7 +154,10 @@ objects:
               value: "${DATABASE_USER}"
             -
               name: "POSTGRESQL_PASSWORD"
-              value: "${DATABASE_PASSWORD}"
+              valueFrom:
+                secretKeyRef:
+                  name: "${NAME}-secrets"
+                  key: "pg-password"
             -
               name: "POSTGRESQL_DATABASE"
               value: "${DATABASE_NAME}"
@@ -345,7 +354,10 @@ objects:
                 value: "${DATABASE_USER}"
               -
                 name: "POSTGRESQL_PASSWORD"
-                value: "${DATABASE_PASSWORD}"
+                valueFrom:
+                  secretKeyRef:
+                    name: "${NAME}-secrets"
+                    key: "pg-password"
               -
                 name: "POSTGRESQL_DATABASE"
                 value: "${DATABASE_NAME}"
@@ -386,7 +398,8 @@ parameters:
     displayName: "PostgreSQL Password"
     required: true
     description: "Password for the PostgreSQL user."
-    value: "smartvm"
+    from: "[a-zA-Z0-9]{8}"
+    generate: expression
   -
     name: "DATABASE_NAME"
     required: true

+ 16 - 3
roles/openshift_examples/files/examples/v3.6/cfme-templates/cfme-template.yaml

@@ -10,6 +10,12 @@ metadata:
     iconClass: "icon-rails"
 objects:
 - apiVersion: v1
+  kind: Secret
+  metadata:
+    name: "${NAME}-secrets"
+  stringData:
+    pg-password: "${DATABASE_PASSWORD}"
+- apiVersion: v1
   kind: Service
   metadata:
     annotations:
@@ -148,7 +154,10 @@ objects:
               value: "${DATABASE_USER}"
             -
               name: "POSTGRESQL_PASSWORD"
-              value: "${DATABASE_PASSWORD}"
+              valueFrom:
+                secretKeyRef:
+                  name: "${NAME}-secrets"
+                  key: "pg-password"
             -
               name: "POSTGRESQL_DATABASE"
               value: "${DATABASE_NAME}"
@@ -345,7 +354,10 @@ objects:
                 value: "${DATABASE_USER}"
               -
                 name: "POSTGRESQL_PASSWORD"
-                value: "${DATABASE_PASSWORD}"
+                valueFrom:
+                  secretKeyRef:
+                    name: "${NAME}-secrets"
+                    key: "pg-password"
               -
                 name: "POSTGRESQL_DATABASE"
                 value: "${DATABASE_NAME}"
@@ -386,7 +398,8 @@ parameters:
     displayName: "PostgreSQL Password"
     required: true
     description: "Password for the PostgreSQL user."
-    value: "smartvm"
+    from: "[a-zA-Z0-9]{8}"
+    generate: expression
   -
     name: "DATABASE_NAME"
     required: true