Skip to content

Commit

Permalink
Ingress
Browse files Browse the repository at this point in the history
  • Loading branch information
assumptionsandg committed Aug 5, 2024
1 parent a4fd054 commit 8b06bc5
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
26 changes: 26 additions & 0 deletions charts/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}
{{- with .Values.ingress.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.className }}
{{- if .Values.ingress.tls.enabled }}
tls:
- hosts:
- {{ .Values.ingress.host }}
secretName: {{ .Values.ingress.tls.secretName }}
{{- end }}
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Values.service.name }}
port:
name: http
20 changes: 20 additions & 0 deletions charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,25 @@ securityContext:
drop: [ALL]
readOnlyRootFilesystem: true

# Ingress settings
ingress:
# The hostname to use for the portal
host:
# The path for the coral credits API
path:
# The ingress class to use
className: nginx
# Annotations for the portal ingress
annotations: {}
# TLS configuration for the portal ingress
tls:
# Indicates if TLS should be enabled
enabled: true
# The secret to use for the TLS certificate and key
secretName:
# TLS-specific ingress annotations, e.g. for cert-manager configuration
annotations: {}

# Django settings
settings:
# The Django secret key
Expand Down Expand Up @@ -104,6 +123,7 @@ replicaCount: 1

# Service details for the api
service:
name: coral-credits
type: ClusterIP
port: 8080

Expand Down
15 changes: 14 additions & 1 deletion tools/functional_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ check_http_status() {

# Set variables
CHART_NAME="coral-credits"
NGINX_NAME="ingress-nginx"
NGINX_CHART="oci://ghcr.io/nginxinc/charts/nginx-ingress"
RELEASE_NAME=$CHART_NAME
RELEASE_NGINX=$NGINX_NAME
NAMESPACE=$CHART_NAME
TEST_PASSWORD="testpassword"

Expand All @@ -39,10 +42,20 @@ helm upgrade $RELEASE_NAME ./charts \
--wait \
--timeout 3m \
--set-string image.tag=${GITHUB_SHA::7} \
--set settings.superuserPassword=$TEST_PASSWORD
--set settings.superuserPassword=$TEST_PASSWORD \
--set ingress.host='localhost' \
--set ingress.path='/'

# Wait for rollout
kubectl rollout status deployment/$RELEASE_NAME -n $NAMESPACE --timeout=300s -w

# Install nginx
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=90s

# Port forward in the background
kubectl port-forward -n $NAMESPACE svc/$RELEASE_NAME $PORT:$PORT &

Expand Down

0 comments on commit 8b06bc5

Please sign in to comment.