Skip to content

Commit

Permalink
fix: get the charts to run sideways with the tx-connector chart in um…
Browse files Browse the repository at this point in the history
…brellas.
  • Loading branch information
drcgjung committed May 10, 2024
1 parent 0aa1310 commit 93f43b9
Show file tree
Hide file tree
Showing 18 changed files with 196 additions and 218 deletions.
8 changes: 4 additions & 4 deletions charts/agent-plane-azure-vault/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
http{{ if .tls }}s{{ end }}://{{ .hostname }}{{ .path }}
{{- end }}
{{- else if contains "NodePort" $dataplane.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ $.Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "txdc.fullname" $ }}-{{ $dataplane.name }})
export NODE_PORT=$(kubectl get --namespace {{ $.Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "txap.fullname" $ }}-{{ $dataplane.name }})
export NODE_IP=$(kubectl get nodes --namespace {{ $.Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" $dataplane.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ $.Release.Namespace }} svc -w {{ include "txdc.fullname" $ }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "txdc.fullname" $ }}-{{ $dataplane.name }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
You can watch the status of by running 'kubectl get --namespace {{ $.Release.Namespace }} svc -w {{ include "txap.fullname" $ }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "txap.fullname" $ }}-{{ $dataplane.name }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ $dataplane.service.port }}
{{- else if contains "ClusterIP" $dataplane.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ $.Release.Namespace }} -l "app.kubernetes.io/name={{ include "txdc.name" $ }}-{{ $dataplane.name }},app.kubernetes.io/instance={{ $.Release.Name }}-{{ $dataplane.name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ $.Release.Namespace }} -l "app.kubernetes.io/name={{ include "txap.name" $ }}-{{ $dataplane.name }},app.kubernetes.io/instance={{ $.Release.Name }}-{{ $dataplane.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}")
kubectl --namespace {{ $.Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
echo "Visit http://127.0.0.1:8080 to use your application"
Expand Down
88 changes: 43 additions & 45 deletions charts/agent-plane-azure-vault/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "txdc.name" -}}
{{- define "txap.name" -}}
{{- default .Chart.Name .Values.nameOverride | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end }}

Expand All @@ -32,7 +32,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "txdc.fullname" -}}
{{- define "txap.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -48,15 +48,15 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "txdc.chart" -}}
{{- define "txap.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Control Common labels
*/}}
{{- define "txdc.labels" -}}
helm.sh/chart: {{ include "txdc.chart" . }}
{{- define "txap.labels" -}}
helm.sh/chart: {{ include "txap.chart" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -66,9 +66,9 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Control Common labels
*/}}
{{- define "txdc.controlplane.labels" -}}
helm.sh/chart: {{ include "txdc.chart" . }}
{{ include "txdc.controlplane.selectorLabels" . }}
{{- define "txap.controlplane.labels" -}}
helm.sh/chart: {{ include "txap.chart" . }}
{{ include "txap.controlplane.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -80,39 +80,39 @@ app.kubernetes.io/part-of: edc
{{/*
Data Common labels (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane)
*/}}
{{- define "txdc.dataplane.labels" -}}
helm.sh/chart: {{ include "txdc.chart" .root }}
{{ include "txdc.dataplane.selectorLabels" . }}
{{- if .root.Chart.AppVersion }}
app.kubernetes.io/version: {{ .root.Chart.AppVersion | quote }}
{{- define "txap.dataplane.labels" -}}
helm.sh/chart: {{ include "txap.chart" . }}
{{ include "txap.dataplane.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .root.Release.Service }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: edc-dataplane
app.kubernetes.io/part-of: edc
{{- end }}

{{/*
Control Selector labels
*/}}
{{- define "txdc.controlplane.selectorLabels" -}}
app.kubernetes.io/name: {{ include "txdc.name" . }}-controlplane
{{- define "txap.controlplane.selectorLabels" -}}
app.kubernetes.io/name: {{ include "txap.name" . }}-controlplane
app.kubernetes.io/instance: {{ .Release.Name }}-controlplane
{{- end }}

{{/*
Data Selector labels (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane)
*/}}
{{- define "txdc.dataplane.selectorLabels" -}}
app.kubernetes.io/name: {{ include "txdc.name" .root }}-{{ .dataplane.name }}
app.kubernetes.io/instance: {{ .root.Release.Name }}-{{ .dataplane.name }}
{{- define "txap.dataplane.selectorLabels" -}}
app.kubernetes.io/name: {{ include "txap.name" . }}-{{ .Values.name }}
app.kubernetes.io/instance: {{ .Release.Name }}-{{ .Values.name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "txdc.controlplane.serviceaccount.name" -}}
{{- define "txap.controlplane.serviceaccount.name" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "txdc.fullname" . ) .Values.serviceAccount.name }}
{{- default (include "txap.fullname" . ) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand All @@ -121,9 +121,9 @@ Create the name of the service account to use
{{/*
Create the name of the service account to use
*/}}
{{- define "txdc.dataplane.serviceaccount.name" -}}
{{- define "txap.dataplane.serviceaccount.name" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "txdc.fullname" . ) .Values.serviceAccount.name }}
{{- default (include "txap.fullname" . ) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand All @@ -132,7 +132,7 @@ Create the name of the service account to use
{{/*
Control DSP URL
*/}}
{{- define "txdc.controlplane.url.protocol" -}}
{{- define "txap.controlplane.url.protocol" -}}
{{- if .Values.controlplane.url.protocol }}{{/* if dsp api url has been specified explicitly */}}
{{- .Values.controlplane.url.protocol }}
{{- else }}{{/* else when dsp api url has not been specified explicitly */}}
Expand All @@ -144,7 +144,7 @@ Control DSP URL
{{- printf "http://%s" .hostname -}}
{{- end }}{{/* end if tls */}}
{{- else }}{{/* else when ingress not enabled */}}
{{- printf "http://%s-controlplane:%v" ( include "txdc.fullname" $ ) $.Values.controlplane.endpoints.protocol.port -}}
{{- printf "http://%s-controlplane:%v" ( include "txap.fullname" $ ) .Values.controlplane.endpoints.protocol.port -}}
{{- end }}{{/* end if ingress */}}
{{- end }}{{/* end with ingress */}}
{{- end }}{{/* end if .Values.controlplane.url.protocol */}}
Expand All @@ -153,46 +153,44 @@ Control DSP URL
{{/*
Validation URL
*/}}
{{- define "txdc.controlplane.url.validation" -}}
{{- printf "http://%s-controlplane:%v%s/token" ( include "txdc.fullname" $ ) $.Values.controlplane.endpoints.control.port $.Values.controlplane.endpoints.control.path -}}
{{- define "txap.controlplane.url.validation" -}}
{{- printf "http://%s-controlplane:%v%s/token" ( include "txap.fullname" $ ) .Values.controlplane.endpoints.control.port .Values.controlplane.endpoints.control.path -}}
{{- end }}

{{/*
Data Control URL (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane)
*/}}
{{- define "txdc.dataplane.url.control" -}}
{{- printf "http://%s-%s:%v%s" (include "txdc.fullname" .root ) .dataplane.name .dataplane.endpoints.control.port .dataplane.endpoints.control.path -}}
{{- define "txap.dataplane.url.signaling" -}}
{{- printf "http://%s-dataplane:%v%s" (include "txap.fullname" . ) .Values.endpoints.signaling.port .Values.endpoints.signaling.path -}}
{{- end }}

{{/*
Data Public URL (Expects the Chart Root to be accessible via .root, the current dataplane via .dataplane)
Data Public URL
*/}}
{{- define "txdc.dataplane.url.public" -}}
{{- $dataplane := .Values -}}
{{- $root := . -}}
{{- if $dataplane.url.public }}{{/* if public api url has been specified explicitly */}}
{{- $dataplane.url.public }}
{{- define "txap.agentplane.url.public" -}}
{{- if .Values.url.public }}{{/* if public api url has been specified explicitly */}}
{{- .Values.url.public }}
{{- else }}{{/* else when public api url has not been specified explicitly */}}
{{- with (index $dataplane.ingresses 0) }}
{{- with (index .Values.ingresses 0) }}
{{- if .enabled }}{{/* if ingress enabled */}}
{{- if .tls.enabled }}{{/* if TLS enabled */}}
{{- printf "https://%s%s" .hostname $dataplane.endpoints.public.path -}}
{{- printf "https://%s%s" .hostname $.Values.endpoints.public.path -}}
{{- else }}{{/* else when TLS not enabled */}}
{{- printf "http://%s%s" .hostname $dataplane.endpoints.public.path -}}
{{- printf "http://%s%s" .hostname $.Values.endpoints.public.path -}}
{{- end }}{{/* end if tls */}}
{{- else }}{{/* else when ingress not enabled */}}
{{- printf "http://%s-%s:%v%s" (include "txdc.fullname" $root ) $dataplane.name $dataplane.endpoints.public.port $dataplane.endpoints.public.path -}}
{{- printf "http://%s-dataplane:%v%s" (include "txdc.fullname" . ) $.Values.endpoints.public.port $.Values.endpoints.public.path -}}
{{- end }}{{/* end if ingress */}}
{{- end }}{{/* end with ingress */}}
{{- end }}{{/* end if .url.public */}}
{{- end }}{{/* end if .Values.url.public */}}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "txdc.serviceAccountName" -}}
{{- define "txap.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "txdc.fullname" .) .Values.serviceAccount.name }}
{{- default (include "txap.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand All @@ -202,10 +200,10 @@ Create the name of the service account to use
{{/*
join a map
*/}}
{{- define "txdc.remotes" -}}
{{- define "txap.remotes" -}}
{{- $res := dict "servers" (list) -}}
{{- range $bpn, $connector := .Values.agent.connectors -}}
{{- $noop := printf "$s=%s" $bpn $connector | append $res.servers | set $res "servers" -}}
{{- $noop := printf "%s=%s" $bpn $connector | append $res.servers | set $res "servers" -}}
{{- end -}}
{{- join "," $res.servers -}}
{{- join "," $res.servers }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{ $root := . }}
{{ $dataplane_name := .Values.name }}
{{ $dataplane := .Values }}
---
Expand All @@ -25,10 +24,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "txdc.fullname" $root }}-{{- $dataplane_name }}
namespace: {{ $root.Release.Namespace | default "default" | quote }}
name: {{ include "txap.fullname" . }}-{{- $dataplane_name }}
namespace: {{ .Release.Namespace | default "default" | quote }}
labels:
{{- include "txdc.dataplane.labels" (dict "dataplane" $dataplane "root" $root) | nindent 4 }}
{{- include "txap.dataplane.labels" . | nindent 4 }}
data:
opentelemetry.properties: |-
{{- $dataplane.opentelemetry | nindent 4 }}
Expand Down
Loading

0 comments on commit 93f43b9

Please sign in to comment.