Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure console to use the admin api #501

Merged
merged 2 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/redpanda/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type: application
# The chart version and the app version are not the same and will not track
# together. The chart version is a semver representation of changes to this
# chart.
version: 4.0.19
version: 4.0.20

# The app version is the default version of Redpanda to install.
appVersion: v23.1.8
Expand Down
2 changes: 1 addition & 1 deletion charts/redpanda/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ than 1 core.
{{- end -}}

{{- define "api-urls" -}}
{{ template "redpanda.fullname" . }}-0.{{ include "redpanda.internal.domain" .}}:{{ .Values.listeners.admin.port }}
{{ include "redpanda.internal.domain" .}}:{{ .Values.listeners.admin.port }}
{{- end -}}

{{- define "sasl-mechanism" -}}
Expand Down
18 changes: 15 additions & 3 deletions charts/redpanda/templates/console/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ limitations under the License.
{{ end }}
{{ end }}

{{ $adminTLS := list }}
{{ $adminAPI := list }}
{{ if (include "admin-internal-tls-enabled" . | fromJson).bool }}
{{ $service := .Values.listeners.admin }}
{{ $cert := get .Values.tls.certs $service.tls.cert }}
Expand All @@ -101,7 +101,11 @@ limitations under the License.
{{- $secretName = $cert.secretRef.name }}
{{- end }}
{{ if $cert.caEnabled }}
{{ $adminTLS = append $adminTLS (dict
{{ $adminAPI = append $adminAPI (dict
"name" "REDPANDA_ADMINAPI_TLS_ENABLED"
"value" "true"
) }}
{{ $adminAPI = append $adminAPI (dict
"name" "REDPANDA_ADMINAPI_TLS_CAFILEPATH"
"value" (printf "/mnt/cert/adminapi/%s/ca.crt" $service.tls.cert)
)}}
Expand All @@ -119,8 +123,16 @@ limitations under the License.
)}}
{{ end }}
{{ end }}
{{ $adminAPI := append $adminAPI (dict
"name" "REDPANDA_ADMINAPI_ENABLED"
"value" "true"
)}}
{{ $adminAPI = append $adminAPI (dict
"name" "REDPANDA_ADMINAPI_URLS"
"value" (print (include "admin-http-protocol" .) "://" (include "api-urls" .))
)}}

{{ $extraEnv := concat $kafkaTLS $adminTLS $schemaRegistryTLS }}
{{ $extraEnv := concat $kafkaTLS $schemaRegistryTLS $adminAPI}}
{{ $consoleValues := dict "Values" (dict
"extraVolumes" $extraVolumes
"extraVolumeMounts" $extraVolumeMounts
Expand Down
54 changes: 54 additions & 0 deletions charts/redpanda/templates/tests/test-console.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{{/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.console.enabled -}}
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "redpanda.fullname" . }}-test-console"
namespace: {{ .Release.Namespace | quote }}
labels:
{{- with include "full.labels" . }}
{{- . | nindent 4 }}
{{- end }}
annotations:
"helm.sh/hook": test
"helm.sh/hook-delete-policy": before-hook-creation
spec:
restartPolicy: Never
securityContext:
runAsUser: 65535
runAsGroup: 65535
containers:
- name: {{ template "redpanda.name" . }}
image: {{ .Values.image.repository }}:{{ template "redpanda.tag" . }}
command:
- /usr/bin/timeout
- "120"
- bash
- -c
- |
curl -svm3 --fail --retry 120 --retry-max-time 120 --retry-all-errors http://{{ include "redpanda.fullname" . }}-console.{{ .Release.Namespace }}.svc:{{ include "console.containerPort" (dict "Values" .Values.console) }}/api/cluster | grep 'Redpanda {{ include "redpanda.tag" . }}'
volumeMounts:
- name: {{ template "redpanda.fullname" . }}
mountPath: /tmp/base-config
volumes:
- name: {{ template "redpanda.fullname" . }}
configMap:
name: {{ template "redpanda.fullname" . }}
- name: config
emptyDir: {}
{{- end }}