Skip to content

Commit

Permalink
Merge pull request #111 from tchughesiv/KIECLOUD-174
Browse files Browse the repository at this point in the history
[KIECLOUD-174] new password fields for configuring DBs and AMQ
  • Loading branch information
openshift-merge-robot authored Apr 2, 2019
2 parents 6dde1e7 + 1cb3a49 commit 17e5236
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 39 deletions.
2 changes: 1 addition & 1 deletion config/dbs/h2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ servers:
- name: RHPAM_USERNAME
value: "rhpam"
- name: RHPAM_PASSWORD
value: "[[$.AdminPassword]]"
value: "[[$.DBPassword]]"
- name: RHPAM_SERVICE_HOST
value: "dummy_ignored"
- name: RHPAM_SERVICE_PORT
Expand Down
20 changes: 10 additions & 10 deletions config/dbs/mysql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ servers:
- name: RHPAM_USERNAME
value: "rhpam"
- name: RHPAM_PASSWORD
value: "[[$.AdminPassword]]"
value: "[[$.DBPassword]]"
- name: RHPAM_SERVICE_HOST
value: "[[.KieName]]-mysql"
- name: RHPAM_SERVICE_PORT
value: "3306"
- name: TIMER_SERVICE_DATA_STORE_REFRESH_INTERVAL
value: "60000"
## MySQL driver settings END
## KIE server deployment config END
## MySQL deployment BEGIN
## KIE server deployment config END
## MySQL deployment BEGIN
- metadata:
name: "[[.KieName]]-mysql"
labels:
Expand Down Expand Up @@ -110,18 +110,18 @@ servers:
- name: MYSQL_USER
value: "rhpam"
- name: MYSQL_PASSWORD
value: "[[$.AdminPassword]]"
value: "[[$.DBPassword]]"
- name: MYSQL_DATABASE
value: "rhpam7"
volumeMounts:
- mountPath: "/var/lib/mysql/data"
name: "[[.KieName]]-mysql-[[$.Constants.DatabaseVolumeSuffix]]"
## [[ if ne .Database.Size "" ]]
## [[ if ne .Database.Size "" ]]
volumes:
- name: "[[.KieName]]-mysql-[[$.Constants.DatabaseVolumeSuffix]]"
persistentVolumeClaim:
claimName: "[[.KieName]]-mysql-claim"
## MySQL persistent volume claim BEGIN
## MySQL persistent volume claim BEGIN
persistentVolumeClaims:
- metadata:
name: "[[.KieName]]-mysql-claim"
Expand All @@ -135,13 +135,13 @@ servers:
resources:
requests:
storage: "[[.Database.Size]]"
## MySQL persistent volume claim END
## [[ else ]]
## MySQL persistent volume claim END
## [[ else ]]
volumes:
- name: "[[.KieName]]-mysql-[[$.Constants.DatabaseVolumeSuffix]]"
emptyDir: {}
## [[ end ]]
## MySQL deployment END
## [[ end ]]
## MySQL deployment END
services:
- spec:
ports:
Expand Down
16 changes: 8 additions & 8 deletions config/dbs/postgresql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
servers:
## RANGE BEGINS
#[[ range $index, $Map := .Servers ]]
## KIE server deployment config BEGIN
## KIE server deployment config BEGIN
- deploymentConfigs:
- metadata:
name: "[[.KieName]]"
Expand Down Expand Up @@ -41,7 +41,7 @@ servers:
- name: RHPAM_USERNAME
value: "rhpam"
- name: RHPAM_PASSWORD
value: "[[$.AdminPassword]]"
value: "[[$.DBPassword]]"
- name: RHPAM_SERVICE_HOST
value: "[[.KieName]]-postgresql"
- name: RHPAM_SERVICE_PORT
Expand Down Expand Up @@ -107,21 +107,21 @@ servers:
- name: POSTGRESQL_USER
value: "rhpam"
- name: POSTGRESQL_PASSWORD
value: "[[$.AdminPassword]]"
value: "[[$.DBPassword]]"
- name: POSTGRESQL_DATABASE
value: "rhpam7"
- name: POSTGRESQL_MAX_PREPARED_TRANSACTIONS
value: "100"
volumeMounts:
- mountPath: "/var/lib/pgsql/data"
name: "[[.KieName]]-postgresql-[[$.Constants.DatabaseVolumeSuffix]]"
## [[ if ne .Database.Size "" ]]
## [[ if ne .Database.Size "" ]]
volumes:
- name: "[[.KieName]]-postgresql-[[$.Constants.DatabaseVolumeSuffix]]"
persistentVolumeClaim:
claimName: "[[.KieName]]-postgresql-claim"
## PostgreSQL deployment config END
## PostgreSQL persistent volume claim BEGIN
## PostgreSQL persistent volume claim BEGIN
persistentVolumeClaims:
- metadata:
name: "[[.KieName]]-postgresql-claim"
Expand All @@ -135,12 +135,12 @@ servers:
resources:
requests:
storage: "[[.Database.Size]]"
## PostgreSQL persistent volume claim END
## [[ else ]]
## PostgreSQL persistent volume claim END
## [[ else ]]
volumes:
- name: "[[.KieName]]-postgresql-[[$.Constants.DatabaseVolumeSuffix]]"
emptyDir: {}
## [[ end ]]
## [[ end ]]
services:
## PostgreSQL service BEGIN
- metadata:
Expand Down
20 changes: 10 additions & 10 deletions config/envs/rhdm-authoring-ha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ console:
- name: APPFORMER_JMS_BROKER_ADDRESS
value: "[[.ApplicationName]]-amq-tcp"
- name: APPFORMER_JMS_BROKER_USER
value: "jmsBrokserUser"
value: "jmsBrokerUser"
- name: APPFORMER_JMS_BROKER_PASSWORD
value: "[[.AdminPassword]]"
value: "[[.AMQClusterPassword]]"
volumes:
- name: "[[.ApplicationName]]-[[.Console.Name]]-pvol"
persistentVolumeClaim:
Expand Down Expand Up @@ -320,11 +320,11 @@ others:
},
{
"name": "AMQ_USER",
"value": "jmsBrokserUser"
"value": "jmsBrokerUser"
},
{
"name": "AMQ_PASSWORD",
"value": "[[.AdminPassword]]"
"value": "[[.AMQPassword]]"
},
{
"name": "AMQ_ROLE",
Expand Down Expand Up @@ -368,11 +368,11 @@ others:
},
{
"name": "AMQ_CLUSTER_USER",
"value": "jmsBrokserUser"
"value": "jmsBrokerUser"
},
{
"name": "AMQ_CLUSTER_PASSWORD",
"value": "[[.AdminPassword]]"
"value": "[[.AMQClusterPassword]]"
},
{
"name": "POD_NAMESPACE",
Expand Down Expand Up @@ -426,9 +426,9 @@ others:
containers:
- env:
- name: AMQ_USER
value: "jmsBrokserUser"
value: "jmsBrokerUser"
- name: AMQ_PASSWORD
value: "[[.AdminPassword]]"
value: "[[.AMQPassword]]"
- name: AMQ_ROLE
value: admin
- name: AMQ_NAME
Expand All @@ -447,9 +447,9 @@ others:
- name: AMQ_REPLICAS
value: "0"
- name: AMQ_CLUSTER_USER
value: "jmsBrokserUser"
value: "jmsBrokerUser"
- name: AMQ_CLUSTER_PASSWORD
value: "[[.AdminPassword]]"
value: "[[.AMQClusterPassword]]"
- name: OPENSHIFT_DNS_PING_SERVICE_NAME
value: "[[.ApplicationName]]-amq-ping"
- name: AMQ_EXTRA_ARGS
Expand Down
20 changes: 10 additions & 10 deletions config/envs/rhpam-authoring-ha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ console:
- name: APPFORMER_JMS_BROKER_ADDRESS
value: "[[.ApplicationName]]-amq-tcp"
- name: APPFORMER_JMS_BROKER_USER
value: "jmsBrokserUser"
value: "jmsBrokerUser"
- name: APPFORMER_JMS_BROKER_PASSWORD
value: "[[.AdminPassword]]"
value: "[[.AMQClusterPassword]]"
volumes:
- name: "[[.ApplicationName]]-[[.Console.Name]]-pvol"
persistentVolumeClaim:
Expand Down Expand Up @@ -319,11 +319,11 @@ others:
},
{
"name": "AMQ_USER",
"value": "jmsBrokserUser"
"value": "jmsBrokerUser"
},
{
"name": "AMQ_PASSWORD",
"value": "[[.AdminPassword]]"
"value": "[[.AMQPassword]]"
},
{
"name": "AMQ_ROLE",
Expand Down Expand Up @@ -367,11 +367,11 @@ others:
},
{
"name": "AMQ_CLUSTER_USER",
"value": "jmsBrokserUser"
"value": "jmsBrokerUser"
},
{
"name": "AMQ_CLUSTER_PASSWORD",
"value": "[[.AdminPassword]]"
"value": "[[.AMQClusterPassword]]"
},
{
"name": "POD_NAMESPACE",
Expand Down Expand Up @@ -425,9 +425,9 @@ others:
containers:
- env:
- name: AMQ_USER
value: "jmsBrokserUser"
value: "jmsBrokerUser"
- name: AMQ_PASSWORD
value: "[[.AdminPassword]]"
value: "[[.AMQPassword]]"
- name: AMQ_ROLE
value: admin
- name: AMQ_NAME
Expand All @@ -446,9 +446,9 @@ others:
- name: AMQ_REPLICAS
value: "0"
- name: AMQ_CLUSTER_USER
value: "jmsBrokserUser"
value: "jmsBrokerUser"
- name: AMQ_CLUSTER_PASSWORD
value: "[[.AdminPassword]]"
value: "[[.AMQClusterPassword]]"
- name: OPENSHIFT_DNS_PING_SERVICE_NAME
value: "[[.ApplicationName]]-amq-ping"
- name: AMQ_EXTRA_ARGS
Expand Down
9 changes: 9 additions & 0 deletions deploy/catalog_resources/redhat/catalog-source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,15 @@ items:
adminPassword:
type: string
description: The password to use for the adminUser.
dbPassword:
type: string
description: The password to use for databases.
amqPassword:
type: string
description: The password to use for amq user.
amqClusterPassword:
type: string
description: The password to use for amq cluster user.
controllerPassword:
type: string
description: The password to use for the controllerUser.
Expand Down
9 changes: 9 additions & 0 deletions deploy/crds/kieapp.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ spec:
adminPassword:
type: string
description: The password to use for the adminUser.
dbPassword:
type: string
description: The password to use for databases.
amqPassword:
type: string
description: The password to use for amq user.
amqClusterPassword:
type: string
description: The password to use for amq cluster user.
controllerPassword:
type: string
description: The password to use for the controllerUser.
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/app/v1/kieapp_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ type CommonConfig struct {
ImageTag string `json:"imageTag,omitempty"`
KeyStorePassword string `json:"keyStorePassword,omitempty"`
AdminPassword string `json:"adminPassword,omitempty"`
DBPassword string `json:"dbPassword,omitempty"`
AMQPassword string `json:"amqPassword,omitempty"`
AMQClusterPassword string `json:"amqClusterPassword,omitempty"`
ControllerPassword string `json:"controllerPassword,omitempty"`
ServerPassword string `json:"serverPassword,omitempty"`
MavenPassword string `json:"mavenPassword,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions pkg/controller/kieapp/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ func setPasswords(config *v1.CommonConfig, isTrialEnv bool) {
passwords := []*string{
&config.KeyStorePassword,
&config.AdminPassword,
&config.DBPassword,
&config.AMQPassword,
&config.AMQClusterPassword,
&config.ControllerPassword,
&config.MavenPassword,
&config.ServerPassword}
Expand Down
15 changes: 15 additions & 0 deletions pkg/controller/kieapp/defaults/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ func TestRhpamAuthoringHAEnvironment(t *testing.T) {
},
Spec: v1.KieAppSpec{
Environment: v1.RhpamAuthoringHA,
CommonConfig: v1.CommonConfig{
AMQPassword: "amq",
AMQClusterPassword: "cluster",
},
},
}
env, err := GetEnvironment(cr, test.MockService())
Expand All @@ -232,6 +236,12 @@ func TestRhpamAuthoringHAEnvironment(t *testing.T) {
assert.Equal(t, "test-rhpamcentr", env.Console.DeploymentConfigs[0].ObjectMeta.Name)
assert.Equal(t, "test-amq", env.Others[0].StatefulSets[0].ObjectMeta.Name)
assert.Equal(t, fmt.Sprintf("rhpam%s-businesscentral-openshift", cr.Spec.CommonConfig.Version), env.Console.DeploymentConfigs[0].Spec.Template.Spec.Containers[0].Image)
amqClusterPassword := getEnvVariable(env.Console.DeploymentConfigs[0].Spec.Template.Spec.Containers[0], "APPFORMER_JMS_BROKER_PASSWORD")
assert.Equal(t, "cluster", amqClusterPassword, "Expected provided password to take effect, but found %v", amqClusterPassword)
amqPassword := getEnvVariable(env.Others[0].StatefulSets[0].Spec.Template.Spec.Containers[0], "AMQ_PASSWORD")
assert.Equal(t, "amq", amqPassword, "Expected provided password to take effect, but found %v", amqPassword)
amqClusterPassword = getEnvVariable(env.Others[0].StatefulSets[0].Spec.Template.Spec.Containers[0], "AMQ_CLUSTER_PASSWORD")
assert.Equal(t, "cluster", amqClusterPassword, "Expected provided password to take effect, but found %v", amqClusterPassword)
pingService := getService(env.Console.Services, "test-rhpamcentr-ping")
assert.Len(t, pingService.Spec.Ports, 1, "The ping service should have only one port")
assert.True(t, hasPort(pingService, 8888), "The ping service should listen on port 8888")
Expand Down Expand Up @@ -402,10 +412,15 @@ func TestAuthoringEnvironment(t *testing.T) {
},
Spec: v1.KieAppSpec{
Environment: v1.RhpamAuthoring,
CommonConfig: v1.CommonConfig{
DBPassword: "Database",
},
},
}
env, err := GetEnvironment(cr, test.MockService())
assert.Nil(t, err, "Error getting authoring environment")
dbPassword := getEnvVariable(env.Servers[0].DeploymentConfigs[0].Spec.Template.Spec.Containers[0], "RHPAM_PASSWORD")
assert.Equal(t, "Database", dbPassword, "Expected provided password to take effect, but found %v", dbPassword)
assert.Equal(t, fmt.Sprintf("%s-kieserver", cr.Spec.CommonConfig.ApplicationName), env.Servers[len(env.Servers)-1].DeploymentConfigs[0].Spec.Template.Spec.Containers[0].Name, "the container name should have incremented")
assert.NotEqual(t, v1.Environment{}, env, "Environment should not be empty")
}
Expand Down

0 comments on commit 17e5236

Please sign in to comment.