Leverage new variables during testing

Extract the HTTP port (int) from the container section end
use it in the service definition.

Also enable variable replacement for Service object.
This commit is contained in:
Jerome Brette
2019-06-18 18:04:21 -05:00
parent 9edecffcc8
commit e3a46cb6ce
2 changed files with 17 additions and 4 deletions

View File

@@ -52,6 +52,13 @@ vars:
apiVersion: apps/v1beta1
fieldref:
fieldpath: metadata.name
- name: CDB_HTTP_PORT
objref:
kind: StatefulSet
name: cockroachdb
apiVersion: apps/v1beta1
fieldref:
fieldpath: spec.template.spec.containers[0].ports[1].containerPort
- name: CDB_STATEFULSET_SVC
objref:
kind: Service
@@ -108,8 +115,8 @@ spec:
- port: 26257
targetPort: 26257
name: grpc
- port: 8080
targetPort: 8080
- port: $(CDB_HTTP_PORT)
targetPort: $(CDB_HTTP_PORT)
name: http
clusterIP: None
selector:
@@ -131,8 +138,8 @@ spec:
targetPort: 26257
name: grpc
# The secondary port serves the UI as well as health and debug endpoints.
- port: 8080
targetPort: 8080
- port: $(CDB_HTTP_PORT)
targetPort: $(CDB_HTTP_PORT)
name: http
selector:
app: cockroachdb

View File

@@ -172,6 +172,12 @@ varReference:
- path: spec/template/spec/initContainers/volumeMounts/mountPath
kind: ReplicaSet
- path: spec/ports/port
kind: Service
- path: spec/ports/targetPort
kind: Service
- path: spec/template/spec/containers/args
kind: StatefulSet