Skip to content

Commit

Permalink
add openshift resources, route condition, and usage note
Browse files Browse the repository at this point in the history
- Added OpenShift resources to the chart.
- Introduced a conditional for the OpenShift route.
- Included port in the route values.
- Added a note to describe how to retrieve the route URL.
  • Loading branch information
jonmosco committed Aug 15, 2024
1 parent d896940 commit 0d74cf8
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
7 changes: 6 additions & 1 deletion charts/localstack/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace | quote }} -l "app.kubernetes.io/name={{ include "localstack.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace | quote }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
echo "visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace | quote }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
{{- if and .Values.openshift .Values.route.enabled }}
export ROUTE_URL=$(oc get route localstack-fork --namespace "localstack" -o jsonpath="{.spec.host}")
echo http://$ROUTE_URL
echo "visit http://$ROUTE_URL to use your application"
{{- end }}
6 changes: 6 additions & 0 deletions charts/localstack/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ rules:
- apiGroups: [""]
resources: ["services"]
verbs: ["get", "list"]
{{- if .Values.openshift }}
- apiGroups: ["security.openshift.io"]
resources: ["securitycontextconstraints"]
resourceNames: ["anyuid"]
verbs: ["use"]
{{- end }}
{{- end }}
21 changes: 21 additions & 0 deletions charts/localstack/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if and .Values.openshift .Values.route.enabled -}}
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: {{ template "localstack.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "localstack.labels" . | nindent 4 }}
spec:
host: {{ .Values.route.host }}
to:
kind: Service
name: {{ include "localstack.fullname" . }}
weight: 100
port:
targetPort: {{ .Values.route.port }}
wildcardPolicy: None
tls:
{{- toYaml .Values.route.tls | nindent 4 }}
{{- end }}

10 changes: 10 additions & 0 deletions charts/localstack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

## OpenShift. When set to 'true' it will add SecurityContextConstraings (SCC)
## to the role
openshift: false

## @param extraDeploy Extra objects to deploy (value evaluated as a template)
##
extraDeploy: []
Expand Down Expand Up @@ -155,6 +159,12 @@ ingress:
# hosts:
# - chart-example.local

## Create a Route resource if using OpenShift
## Defaults to the 'edge' port of the service on 4566
route:
enabled: false
port: edge

persistence:
## @param persistence.enabled Enable persistence using Persistent Volume Claims
##
Expand Down

0 comments on commit 0d74cf8

Please sign in to comment.