Skip to content

Commit

Permalink
Fix console template call
Browse files Browse the repository at this point in the history
  • Loading branch information
RafalKorepta committed Aug 29, 2024
1 parent 093cbb9 commit f8ea0ae
Show file tree
Hide file tree
Showing 4 changed files with 11,019 additions and 9,787 deletions.
17 changes: 10 additions & 7 deletions charts/redpanda/templates/console/configmap-and-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ limitations under the License.
"secret" $secretConfig
)}}

{{ $console := merge $config .Subcharts.console }}
{{ $secretValues := merge $config .Subcharts.console }}
{{ $wrappedSecretValues := (dict "Chart" .Subcharts.console.Chart "Release" .Release "Values" (dict "AsMap" $secretValues.Values)) }}
---
{{ include (print .Subcharts.console.Template.BasePath "/secret.yaml") $console }}
{{- include "_shims.render-manifest" (list "console.Secret" $wrappedSecretValues) -}}
{{ end }}
{{ end }}

Expand All @@ -59,10 +60,11 @@ limitations under the License.
)
}}

{{ $console := merge $config .Subcharts.console }}
{{ $configMapValues := merge $config .Subcharts.console }}
---
{{ include (print .Subcharts.console.Template.BasePath "/configmap.yaml") $console }}
{{ $configmap = include (print .Subcharts.console.Template.BasePath "/configmap.yaml") $console }}
{{ $wrappedSecretValues := (dict "Chart" .Subcharts.console.Chart "Release" .Release "Values" (dict "AsMap" $configMapValues.Values)) }}
{{- include "_shims.render-manifest" (list "console.ConfigMap" $wrappedSecretValues) -}}
{{ $configmap = include "_shims.render-manifest" (list "console.ConfigMap" $wrappedSecretValues) }}
{{ end }}

{{/* Deployment */}}
Expand Down Expand Up @@ -221,8 +223,9 @@ limitations under the License.
{{ $consoleValues := merge $consoleValues (dict "Values" (dict "podAnnotations" (dict "checksum-redpanda-chart/config" ( $configmap | toYaml | sha256sum )))) }}
{{ end }}

{{ $helmVars := merge $consoleValues .Subcharts.console }}
{{ $deploymentValues := merge $consoleValues .Subcharts.console }}
{{ $wrappedDeploymentValues := (dict "Chart" .Subcharts.console.Chart "Release" .Release "Values" (dict "AsMap" $deploymentValues.Values)) }}

---
{{ include (print .Subcharts.console.Template.BasePath "/deployment.yaml") $helmVars }}
{{- include "_shims.render-manifest" (list "console.Deployment" $wrappedDeploymentValues) -}}
{{ end }}
2 changes: 1 addition & 1 deletion charts/redpanda/templates/tests/test-console.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
- bash
- -c
- |
curl {{ template "curl-options" . }} http://{{ include "redpanda.fullname" . }}-console.{{ .Release.Namespace }}.svc:{{ include "console.containerPort" (dict "Values" .Values.console) }}/api/cluster
curl {{ template "curl-options" . }} http://{{ include "redpanda.fullname" . }}-console.{{ .Release.Namespace }}.svc:{{ (get (fromJson (include "console.ContainerPort" (dict "a" (list (dict "Values" (dict "AsMap" .Values.console)) )))) "r" ) }}/api/cluster
volumeMounts: {{ include "default-mounts" . | nindent 8 }}
securityContext: {{ include "container-security-context" . | nindent 8 }}
volumes: {{ include "default-volumes" . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if and .Values.tests.enabled (include "is-licensed" . | fromJson).bool .Values.console.enabled }}
{{- $consolePort := (get (fromJson (include "console.ContainerPort" (dict "a" (list (dict "Values" (dict "AsMap" .Values.console)) )))) "r" ) }}
apiVersion: v1
kind: Pod
metadata:
Expand Down Expand Up @@ -45,14 +46,14 @@ spec:
set -xe
max_iteration=10
curl -vm3 --fail --retry "120" --retry-max-time "120" http://{{ include "redpanda.fullname" . }}-console.{{ .Release.Namespace }}.svc:{{ include "console.containerPort" (dict "Values" .Values.console) }}/api/cluster/overview | jq .
type=$(curl -svm3 --fail --retry "120" --retry-max-time "120" http://{{ include "redpanda.fullname" . }}-console.{{ .Release.Namespace }}.svc:{{ include "console.containerPort" (dict "Values" .Values.console) }}/api/cluster/overview | jq -r .console.license.type)
curl -vm3 --fail --retry "120" --retry-max-time "120" http://{{ include "redpanda.fullname" . }}-console.{{ .Release.Namespace }}.svc:{{$consolePort}}/api/cluster/overview | jq .
type=$(curl -svm3 --fail --retry "120" --retry-max-time "120" http://{{ include "redpanda.fullname" . }}-console.{{ .Release.Namespace }}.svc:{{$consolePort}}/api/cluster/overview | jq -r .console.license.type)
while [[ $max_iteration -gt 0 && ("$type" == "open_source" || "$type" == "") ]]; do
max_iteration=$(( max_iteration - 1 ))
type=$(curl -svm3 --fail --retry "120" --retry-max-time "120" http://{{ include "redpanda.fullname" . }}-console.{{ .Release.Namespace }}.svc:{{ include "console.containerPort" (dict "Values" .Values.console) }}/api/cluster/overview | jq -r .console.license.type)
type=$(curl -svm3 --fail --retry "120" --retry-max-time "120" http://{{ include "redpanda.fullname" . }}-console.{{ .Release.Namespace }}.svc:{{$consolePort}}/api/cluster/overview | jq -r .console.license.type)
done
if [[ "$type" == "open_source" || "$type" == "" ]]; then
curl -svm3 --fail --retry "120" --retry-max-time "120" http://{{ include "redpanda.fullname" . }}-console.{{ .Release.Namespace }}.svc:{{ include "console.containerPort" (dict "Values" .Values.console) }}/api/cluster/overview | jq .
curl -svm3 --fail --retry "120" --retry-max-time "120" http://{{ include "redpanda.fullname" . }}-console.{{ .Release.Namespace }}.svc:{{$consolePort}}/api/cluster/overview | jq .
exit 1
fi
set +x
Expand Down
Loading

0 comments on commit f8ea0ae

Please sign in to comment.