From 397ec61e57356291d7396b3cec59987d1965080f Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Thu, 22 Oct 2020 15:37:35 -0700 Subject: [PATCH] Specify the supervisor NodePort Service's `port` and `nodePort` separately When using kind we forward the node's port to the host, so we only really care about the `nodePort` value. For acceptance clusters, we put an Ingress in front of a NodePort Service, so we only really care about the `port` value. --- deploy/supervisor/service.yaml | 6 ++++-- deploy/supervisor/values.yaml | 7 ++++--- hack/lib/tilt/Tiltfile | 3 ++- hack/prepare-for-integration-tests.sh | 3 ++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/deploy/supervisor/service.yaml b/deploy/supervisor/service.yaml index eb5e0127..19076e5e 100644 --- a/deploy/supervisor/service.yaml +++ b/deploy/supervisor/service.yaml @@ -18,9 +18,11 @@ spec: app: #@ data.values.app_name ports: - protocol: TCP - port: 80 + port: #@ data.values.service_nodeport_port targetPort: 80 - nodePort: #@ data.values.service_nodeport_port + #@ if data.values.service_nodeport_nodeport: + nodePort: #@ data.values.service_nodeport_nodeport + #@ end #@ end #@ if data.values.service_clusterip_port: diff --git a/deploy/supervisor/values.yaml b/deploy/supervisor/values.yaml index 982b96ed..ea06cf30 100644 --- a/deploy/supervisor/values.yaml +++ b/deploy/supervisor/values.yaml @@ -38,6 +38,7 @@ image_pull_dockerconfigjson: #! e.g. {"auths":{"https://registry.example.com":{" #! Specify how to expose the Supervisor app as a Service. #! Typically you would set a value for only one of the following. #! Setting any of these values means that a Service of that type will be created. -service_nodeport_port: #! e.g. 31234 -service_loadbalancer_port: #! e.g. 443 -service_clusterip_port: #! e.g. 443 +service_nodeport_port: #! when specified, creates a NodePort Service with this `port` value, e.g. 31234 +service_nodeport_nodeport: #! the `nodePort` value of the NodePort Service, optional when `service_nodeport_port` is specified, e.g. 31234 +service_loadbalancer_port: #! when specified, creates a LoadBalancer Service with this `port` value, e.g. 443 +service_clusterip_port: #! when specified, creates a ClusterIP Service with this `port` value, e.g. 443 diff --git a/hack/lib/tilt/Tiltfile b/hack/lib/tilt/Tiltfile index a7fee14e..899ea4a5 100644 --- a/hack/lib/tilt/Tiltfile +++ b/hack/lib/tilt/Tiltfile @@ -96,7 +96,8 @@ k8s_yaml(local([ '--data-value', 'image_repo=image/supervisor', '--data-value', 'image_tag=tilt-dev', '--data-value-yaml', 'replicas=1', - '--data-value-yaml', 'service_nodeport_port=31234', + '--data-value-yaml', 'service_nodeport_port=80', + '--data-value-yaml', 'service_nodeport_nodeport=31234', '--data-value-yaml', 'custom_labels={mySupervisorCustomLabelName: mySupervisorCustomLabelValue}', ])) # Tell tilt to watch all of those files for changes. diff --git a/hack/prepare-for-integration-tests.sh b/hack/prepare-for-integration-tests.sh index 5c2c77aa..19b3cac4 100755 --- a/hack/prepare-for-integration-tests.sh +++ b/hack/prepare-for-integration-tests.sh @@ -224,7 +224,8 @@ if ! tilt_mode; then --data-value "image_repo=$registry_repo" \ --data-value "image_tag=$tag" \ --data-value-yaml "custom_labels=$supervisor_custom_labels" \ - --data-value-yaml 'service_nodeport_port=31234' >"$manifest" + --data-value-yaml 'service_nodeport_port=80' \ + --data-value-yaml 'service_nodeport_nodeport=31234' >"$manifest" kapp deploy --yes --app "$supervisor_app_name" --diff-changes --file "$manifest"