Skip to content

Commit

Permalink
Merge branch 'master' into 1.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
tchughesiv committed Apr 2, 2019
2 parents 217bddf + 8166af8 commit 4167417
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 39 deletions.
1 change: 1 addition & 0 deletions config/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ servers:
spec:
strategy:
rollingParams:
maxSurge: 100%
maxUnavailable: 0
type: Rolling
triggers:
Expand Down
4 changes: 3 additions & 1 deletion config/dbs/h2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ servers:
- metadata:
name: "[[.KieName]]"
spec:
strategy:
type: Recreate
template:
metadata:
name: "[[.KieName]]"
Expand All @@ -30,7 +32,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
1 change: 1 addition & 0 deletions config/envs/rhdm-trial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ servers:
service: "[[.KieName]]"
annotations:
description: Route for KIE server's http service.
haproxy.router.openshift.io/balance: source
haproxy.router.openshift.io/timeout: 60s
spec:
to:
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
1 change: 1 addition & 0 deletions config/envs/rhpam-trial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ servers:
service: "[[.KieName]]"
annotations:
description: Route for KIE server's http service.
haproxy.router.openshift.io/balance: source
haproxy.router.openshift.io/timeout: 60s
spec:
to:
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
17 changes: 17 additions & 0 deletions pkg/controller/kieapp/defaults/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
v1 "github.com/kiegroup/kie-cloud-operator/pkg/apis/app/v1"
"github.com/kiegroup/kie-cloud-operator/pkg/controller/kieapp/constants"
"github.com/kiegroup/kie-cloud-operator/pkg/controller/kieapp/test"
appsv1 "github.com/openshift/api/apps/v1"
buildv1 "github.com/openshift/api/build/v1"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -223,6 +224,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 +237,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,11 +413,17 @@ 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.Equal(t, string(appsv1.DeploymentStrategyTypeRecreate), string(env.Servers[len(env.Servers)-1].DeploymentConfigs[0].Spec.Strategy.Type), "The DC should use a Recreate strategy when using the H2 DB")
assert.NotEqual(t, v1.Environment{}, env, "Environment should not be empty")
}

Expand Down

0 comments on commit 4167417

Please sign in to comment.