|
| 1 | +{{/* |
| 2 | + Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + or more contributor license agreements. See the NOTICE file |
| 4 | + distributed with this work for additional information |
| 5 | + regarding copyright ownership. The ASF licenses this file |
| 6 | + to you under the Apache License, Version 2.0 (the |
| 7 | + "License"); you may not use this file except in compliance |
| 8 | + with the License. You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, |
| 13 | + software distributed under the License is distributed on an |
| 14 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + KIND, either express or implied. See the License for the |
| 16 | + specific language governing permissions and limitations |
| 17 | + under the License. |
| 18 | +*/}} |
| 19 | +{{/* |
| 20 | + Helper template to generate access instructions for a service. |
| 21 | + Parameters: |
| 22 | + - serviceType: ClusterIP, NodePort, or LoadBalancer |
| 23 | + - serviceName: Kubernetes service name |
| 24 | + - port: Service port number |
| 25 | + - namespace: Kubernetes namespace |
| 26 | + - label: Display label (e.g., "API" or "Health") |
| 27 | + - path: Optional URL path (e.g., "/q/health") |
| 28 | + - isFirstNodePort: Whether to export NODE_IP (set to true only for the first NodePort service to avoid duplicate exports) |
| 29 | +*/}} |
| 30 | +{{- define "polaris.accessInstructions" -}} |
| 31 | +{{- $serviceType := .serviceType -}} |
| 32 | +{{- $serviceName := .serviceName -}} |
| 33 | +{{- $port := .port -}} |
| 34 | +{{- $namespace := .namespace -}} |
| 35 | +{{- $label := .label -}} |
| 36 | +{{- $path := .path | default "" -}} |
| 37 | +{{- $isFirstNodePort := .isFirstNodePort | default false }} |
| 38 | +{{- if eq $serviceType "LoadBalancer" }} |
| 39 | + export {{ upper $label }}_IP=$(kubectl get svc -n {{ $namespace }} {{ $serviceName }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') |
| 40 | + echo "{{ $label }}: http://${{ upper $label }}_IP:{{ $port }}{{ $path }}" |
| 41 | +{{- else if eq $serviceType "NodePort" }} |
| 42 | +{{- if $isFirstNodePort }} |
| 43 | + export NODE_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="ExternalIP")].address}') |
| 44 | +{{- end }} |
| 45 | + export {{ upper $label }}_PORT=$(kubectl get svc -n {{ $namespace }} {{ $serviceName }} -o jsonpath='{.spec.ports[0].nodePort}') |
| 46 | + echo "{{ $label }}: http://$NODE_IP:${{ upper $label }}_PORT{{ $path }}" |
| 47 | +{{- else }} |
| 48 | + {{ $label }}: http://localhost:{{ $port }}{{ $path }} |
| 49 | +{{- end }} |
| 50 | +{{- end -}} |
| 51 | + |
| 52 | +Apache Polaris deployed successfully! |
| 53 | + |
| 54 | +Release: {{ .Release.Name }} |
| 55 | +Namespace: {{ .Release.Namespace }} |
| 56 | +Version: {{ .Chart.Version }} (App: {{ .Chart.AppVersion }}) |
| 57 | + |
| 58 | +{{- if eq .Values.persistence.type "in-memory" }} |
| 59 | + |
| 60 | +⚠️ WARNING: Using IN-MEMORY persistence - data will be lost on pod restart! |
| 61 | +{{- end }} |
| 62 | + |
| 63 | +Access Polaris: |
| 64 | +{{- if eq .Values.service.type "ClusterIP" }} |
| 65 | + |
| 66 | + kubectl port-forward -n {{ .Release.Namespace }} svc/{{ include "polaris.fullname" . }} {{ (first .Values.service.ports).port }}:{{ (first .Values.service.ports).port }} |
| 67 | +{{- end }} |
| 68 | +{{ include "polaris.accessInstructions" (dict "serviceType" .Values.service.type "serviceName" (include "polaris.fullname" .) "port" (first .Values.service.ports).port "namespace" .Release.Namespace "label" "API" "isFirstNodePort" true) }} |
| 69 | +{{- if and (ne .Values.service.type "ClusterIP") (ne .Values.managementService.type "ClusterIP") }} |
| 70 | + |
| 71 | +{{- end }} |
| 72 | +{{- if and (ne .Values.service.type "ClusterIP") (eq .Values.managementService.type "ClusterIP") }} |
| 73 | + |
| 74 | + kubectl port-forward -n {{ .Release.Namespace }} svc/{{ include "polaris.fullnameWithSuffix" (list . "mgmt") }} {{ (first .Values.managementService.ports).port }}:{{ (first .Values.managementService.ports).port }} |
| 75 | +{{- else if and (eq .Values.service.type "ClusterIP") (eq .Values.managementService.type "ClusterIP") }} |
| 76 | + |
| 77 | + kubectl port-forward -n {{ .Release.Namespace }} svc/{{ include "polaris.fullnameWithSuffix" (list . "mgmt") }} {{ (first .Values.managementService.ports).port }}:{{ (first .Values.managementService.ports).port }} |
| 78 | +{{- end }} |
| 79 | +{{ include "polaris.accessInstructions" (dict "serviceType" .Values.managementService.type "serviceName" (include "polaris.fullnameWithSuffix" (list . "mgmt")) "port" (first .Values.managementService.ports).port "namespace" .Release.Namespace "label" "Health" "path" "/q/health" "isFirstNodePort" (ne .Values.service.type "NodePort")) }} |
| 80 | + |
| 81 | +View logs: |
| 82 | + |
| 83 | + kubectl logs -l app.kubernetes.io/name={{ include "polaris.name" . }} -n {{ .Release.Namespace }} --tail=50 -f |
0 commit comments