Populate instanceId for dual-master recipe
Feature: Issue 13230
Change-Id: I33113e81c5d23bd830f869af7114b936fea5e771
diff --git a/dual-master/Makefile b/dual-master/Makefile
index 7c03175..acc64ef 100644
--- a/dual-master/Makefile
+++ b/dual-master/Makefile
@@ -51,6 +51,10 @@
$(CLUSTER_OPTIONAL_PARAMS)
service-master-1: set-optional-params-metrics-cloudwatch
+ifdef GERRIT_MASTER1_INSTANCE_ID
+ $(eval MASTER1_SERVICE_OPTIONAL_PARAMS := $(MASTER1_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_MASTER1_INSTANCE_ID))
+endif
+
$(AWS_FC_COMMAND) create-stack \
--stack-name $(SERVICE_MASTER1_STACK_NAME) \
--capabilities CAPABILITY_IAM \
@@ -87,9 +91,14 @@
ParameterKey=GerritCPU,ParameterValue=$(GERRIT_CPU) \
ParameterKey=GerritHeapLimit,ParameterValue=$(GERRIT_HEAP_LIMIT) \
ParameterKey=JgitCacheSize,ParameterValue=$(JGIT_CACHE_SIZE) \
+ $(MASTER1_SERVICE_OPTIONAL_PARAMS) \
$(METRICS_CW_OPTIONAL_PARAMS)
service-master-2: set-optional-params-metrics-cloudwatch
+ifdef GERRIT_MASTER2_INSTANCE_ID
+ $(eval MASTER2_SERVICE_OPTIONAL_PARAMS := $(MASTER2_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_MASTER2_INSTANCE_ID))
+endif
+
$(AWS_FC_COMMAND) create-stack \
--stack-name $(SERVICE_MASTER2_STACK_NAME) \
--capabilities CAPABILITY_IAM \
@@ -127,9 +136,14 @@
ParameterKey=GerritCPU,ParameterValue=$(GERRIT_CPU) \
ParameterKey=GerritHeapLimit,ParameterValue=$(GERRIT_HEAP_LIMIT) \
ParameterKey=JgitCacheSize,ParameterValue=$(JGIT_CACHE_SIZE) \
+ $(MASTER2_SERVICE_OPTIONAL_PARAMS) \
$(METRICS_CW_OPTIONAL_PARAMS)
service-slave: set-optional-params-metrics-cloudwatch
+ifdef GERRIT_SLAVE_INSTANCE_ID
+ $(eval SLAVE_SERVICE_OPTIONAL_PARAMS := $(SLAVE_SERVICE_OPTIONAL_PARAMS) ParameterKey=InstanceId,ParameterValue=$(GERRIT_SLAVE_INSTANCE_ID))
+endif
+
$(AWS_FC_COMMAND) create-stack \
--stack-name $(SERVICE_SLAVE_STACK_NAME) \
--capabilities CAPABILITY_IAM \
@@ -152,6 +166,7 @@
ParameterKey=GerritCPU,ParameterValue=$(GERRIT_CPU) \
ParameterKey=GerritHeapLimit,ParameterValue=$(GERRIT_HEAP_LIMIT) \
ParameterKey=JgitCacheSize,ParameterValue=$(JGIT_CACHE_SIZE) \
+ $(SLAVE_SERVICE_OPTIONAL_PARAMS) \
$(METRICS_CW_OPTIONAL_PARAMS)
service-lb:
diff --git a/dual-master/README.md b/dual-master/README.md
index 2c52c98..cd62d2e 100644
--- a/dual-master/README.md
+++ b/dual-master/README.md
@@ -93,6 +93,14 @@
* `FILESYSTEM_PROVISIONED_THROUGHPUT_IN_MIBPS`: Optional. Only used when `FILESYSTEM_THROUGHPUT_MODE` is set to `provisioned`.
default: `256`.
+* `GERRIT_SLAVE_INSTANCE_ID`: Optional. Identifier for the Gerrit slave instance.
+"gerrit-dual-master-SLAVE" by default.
+* `GERRIT_MASTER1_INSTANCE_ID`: Optional. Identifier for the Gerrit master1 instance.
+"gerrit-dual-master-MASTER1" by default.
+* `GERRIT_MASTER2_INSTANCE_ID`: Optional. Identifier for the Gerrit master2 instance.
+"gerrit-dual-master-MASTER2" by default.
+
+
### 2 - Deploy
* Create the cluster, services and DNS routing stacks:
diff --git a/dual-master/cf-service-master.yml b/dual-master/cf-service-master.yml
index a21bfc2..287bcd3 100644
--- a/dual-master/cf-service-master.yml
+++ b/dual-master/cf-service-master.yml
@@ -160,6 +160,10 @@
SMTPDomain:
Description: Domain to be used in the From field
Type: String
+ InstanceId:
+ Description: Optional identifier for the Gerrit instance
+ Type: String
+ Default: gerrit-dual-master-MASTER
MetricsCloudwatchEnabled:
Description: Whether gerrit metrics should be published to cloudwatch
Type: String
@@ -266,6 +270,8 @@
Value: !Ref GitSSHPort
- Name: SLAVE_SUBDOMAIN
Value: !Ref SlaveSubdomain
+ - Name: GERRIT_INSTANCE_ID
+ Value: !Ref InstanceId
- Name: METRICS_CLOUDWATCH_ENABLED
Value: !Ref MetricsCloudwatchEnabled
- Name: METRICS_CLOUDWATCH_NAMESPACE
diff --git a/dual-master/cf-service-slave.yml b/dual-master/cf-service-slave.yml
index 83adaff..c8ce290 100644
--- a/dual-master/cf-service-slave.yml
+++ b/dual-master/cf-service-slave.yml
@@ -133,6 +133,10 @@
LDAPGroupBase:
Description: Root of the tree containing all group objects
Type: String
+ InstanceId:
+ Description: Optional identifier for the Gerrit instance
+ Type: String
+ Default: gerrit-dual-master-SLAVE
MetricsCloudwatchEnabled:
Description: Whether gerrit metrics should be published to cloudwatch
Type: String
@@ -227,6 +231,8 @@
Value: !Ref LDAPAccountBase
- Name: LDAP_GROUP_BASE
Value: !Ref LDAPGroupBase
+ - Name: GERRIT_INSTANCE_ID
+ Value: !Ref InstanceId
- Name: METRICS_CLOUDWATCH_ENABLED
Value: !Ref MetricsCloudwatchEnabled
- Name: METRICS_CLOUDWATCH_NAMESPACE
diff --git a/dual-master/setup.env.template b/dual-master/setup.env.template
index 949abca..333bd89 100644
--- a/dual-master/setup.env.template
+++ b/dual-master/setup.env.template
@@ -22,6 +22,10 @@
FILESYSTEM_THROUGHPUT_MODE=bursting
+GERRIT_SLAVE_INSTANCE_ID=gerrit-dual-master-SLAVE
+GERRIT_MASTER1_INSTANCE_ID=gerrit-dual-master-MASTER1
+GERRIT_MASTER2_INSTANCE_ID=gerrit-dual-master-MASTER2
+
LDAP_SERVER:=ldap://yourldap.yourcompany.com
LDAP_USERNAME:=cn=admin,dc=example,dc=org
LDAP_ACCOUNT_BASE:=dc=example,dc=org