From a65a6176a8211cfd4b9ddcf2cf2046d9beb9d648 Mon Sep 17 00:00:00 2001 From: Anders Johnsen Date: Tue, 10 Oct 2023 22:16:05 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20platform=20interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/rig/cmd/dev/kind/config.yaml | 2 +- cmd/rig/cmd/dev/kind/create.go | 3 +-- deploy/charts/rig-platform/Chart.yaml | 2 +- .../charts/rig-platform/templates/NOTES.txt | 4 ++-- .../rig-platform/templates/capsule.yaml | 20 +++++++++---------- .../templates/tests/test-connection.yaml | 2 +- deploy/charts/rig-platform/values.yaml | 7 +++++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cmd/rig/cmd/dev/kind/config.yaml b/cmd/rig/cmd/dev/kind/config.yaml index deada64ba..e78720571 100644 --- a/cmd/rig/cmd/dev/kind/config.yaml +++ b/cmd/rig/cmd/dev/kind/config.yaml @@ -8,6 +8,6 @@ nodes: listenAddress: "127.0.0.1" protocol: TCP - containerPort: 30047 - hostPort: 30047 + hostPort: 4747 listenAddress: "127.0.0.1" protocol: TCP diff --git a/cmd/rig/cmd/dev/kind/create.go b/cmd/rig/cmd/dev/kind/create.go index 92e83c8f5..a4a23b0f9 100644 --- a/cmd/rig/cmd/dev/kind/create.go +++ b/cmd/rig/cmd/dev/kind/create.go @@ -98,7 +98,7 @@ func (c Cmd) deploy(cmd *cobra.Command, args []string) error { "--set", "postgres.enabled=true", "--set", "rig.cluster.dev_registry.host=localhost:30000", "--set", "rig.cluster.dev_registry.cluster_host=registry:5000", - "--set", "service.type=NodePort", + "--set", "loadBalancer.enabled=true", "--set", "rig-operator.enabled=false", }, }); err != nil { @@ -156,7 +156,6 @@ func (c Cmd) deployInner(ctx context.Context, p deployParams) error { "upgrade", "--install", p.chartName, chart, "--namespace", "rig-system", "--set", fmt.Sprintf("image.tag=%s", operatorDockerTag), - "--set", "service.nodePort=30047", "--create-namespace", } cArgs = append(cArgs, p.customArgs...) diff --git a/deploy/charts/rig-platform/Chart.yaml b/deploy/charts/rig-platform/Chart.yaml index 8abfe8623..e3bd000ee 100644 --- a/deploy/charts/rig-platform/Chart.yaml +++ b/deploy/charts/rig-platform/Chart.yaml @@ -16,7 +16,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.6 +version: 0.1.7 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/deploy/charts/rig-platform/templates/NOTES.txt b/deploy/charts/rig-platform/templates/NOTES.txt index f646d1378..996f4223a 100644 --- a/deploy/charts/rig-platform/templates/NOTES.txt +++ b/deploy/charts/rig-platform/templates/NOTES.txt @@ -5,7 +5,7 @@ http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} {{- end }} {{- end }} -{{- else if contains "NodePort" .Values.service.type }} +{{- else if .Values.loadBalancer.enabled }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "rig-platform.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT @@ -14,7 +14,7 @@ You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "rig-platform.fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "rig-platform.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} +{{- else }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "rig-platform.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" diff --git a/deploy/charts/rig-platform/templates/capsule.yaml b/deploy/charts/rig-platform/templates/capsule.yaml index c6a1ac8c0..b9cc2b57f 100644 --- a/deploy/charts/rig-platform/templates/capsule.yaml +++ b/deploy/charts/rig-platform/templates/capsule.yaml @@ -16,20 +16,18 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" interfaces: - name: http - port: {{ .Values.service.port }} - {{- if .Values.service.nodePort }} - public: - loadBalancer: - port: {{ .Values.service.port }} - nodePort: {{ .Values.service.nodePort }} - {{- end}} - {{- if .Values.ingress.enabled }} - - name: http-ingress - port: {{ $.Values.service.port }} + port: {{ .Values.port }} + {{- if .Values.ingress.enabled }} public: ingress: host: .Values.ingress.host - {{- end}} + {{- end}} + {{- if .Values.loadBalancer.enabled }} + public: + loadBalancer: + port: {{ .Values.port }} + nodePort: {{ .Values.loadBalancer.nodePort }} + {{- end}} files: - path: /etc/rig/server-config.yaml secret: diff --git a/deploy/charts/rig-platform/templates/tests/test-connection.yaml b/deploy/charts/rig-platform/templates/tests/test-connection.yaml index d47c23cf7..dfec8376d 100644 --- a/deploy/charts/rig-platform/templates/tests/test-connection.yaml +++ b/deploy/charts/rig-platform/templates/tests/test-connection.yaml @@ -11,5 +11,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "rig-platform.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "rig-platform.fullname" . }}:{{ .Values.port }}'] restartPolicy: Never diff --git a/deploy/charts/rig-platform/values.yaml b/deploy/charts/rig-platform/values.yaml index 1ef09d9d5..818f6a88c 100644 --- a/deploy/charts/rig-platform/values.yaml +++ b/deploy/charts/rig-platform/values.yaml @@ -47,8 +47,11 @@ securityContext: # runAsNonRoot: true # runAsUser: 1000 -service: - port: 4747 +port: 4747 + +loadBalancer: + enabled: false + nodePort: 30047 ingress: enabled: false