Skip to content

Commit

Permalink
Helm cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
westerbo-nhn committed Jan 12, 2025
1 parent 02451f9 commit 72930a1
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 39 deletions.
2 changes: 1 addition & 1 deletion charts/ror-webapp/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: ror-webapp
description: ROR web
description: ROR webapp

type: application
version: 0.1.0
Expand Down
8 changes: 4 additions & 4 deletions charts/ror-webapp/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "ror-admin.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "ror-webapp.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "ror-admin.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ror-admin.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "ror-webapp.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ror-webapp.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "ror-admin.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "ror-webapp.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
Expand Down
20 changes: 10 additions & 10 deletions charts/ror-webapp/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ror-admin.name" -}}
{{- define "ror-webapp.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "ror-admin.fullname" -}}
{{- define "ror-webapp.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "ror-admin.chart" -}}
{{- define "ror-webapp.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "ror-admin.labels" -}}
helm.sh/chart: {{ include "ror-admin.chart" . }}
{{ include "ror-admin.selectorLabels" . }}
{{- define "ror-webapp.labels" -}}
helm.sh/chart: {{ include "ror-webapp.chart" . }}
{{ include "ror-webapp.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "ror-admin.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ror-admin.name" . }}
{{- define "ror-webapp.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ror-webapp.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "ror-admin.serviceAccountName" -}}
{{- define "ror-webapp.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ror-admin.fullname" .) .Values.serviceAccount.name }}
{{- default (include "ror-webapp.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand Down
10 changes: 5 additions & 5 deletions charts/ror-webapp/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ror-admin.fullname" . }}
name: {{ include "ror-webapp.fullname" . }}
labels:
{{- include "ror-admin.labels" . | nindent 4 }}
{{- include "ror-webapp.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
revisionHistoryLimit: 2
selector:
matchLabels:
{{- include "ror-admin.selectorLabels" . | nindent 6 }}
{{- include "ror-webapp.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ror-admin.selectorLabels" . | nindent 8 }}
{{- include "ror-webapp.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "ror-admin.serviceAccountName" . }}
serviceAccountName: {{ include "ror-webapp.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
containers:
Expand Down
8 changes: 4 additions & 4 deletions charts/ror-webapp/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "ror-admin.fullname" . }}
name: {{ include "ror-webapp.fullname" . }}
labels:
{{- include "ror-admin.labels" . | nindent 4 }}
{{- include "ror-webapp.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "ror-admin.fullname" . }}
name: {{ include "ror-webapp.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
Expand All @@ -28,6 +28,6 @@ spec:
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}

{{- end }}
{{- end }}
8 changes: 4 additions & 4 deletions charts/ror-webapp/templates/ingress-helsenett.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
name: admin-helsenett-ingress
name: {{ include "ror-webapp.fullname" . }}helm-ingress
spec:
ingressClassName: avi-ingress-class-helsenett
rules:
Expand All @@ -12,7 +12,7 @@ spec:
paths:
- backend:
service:
name: {{ include "ror-admin.fullname" . }}
name: {{ include "ror-webapp.fullname" . }}
port:
number: {{ .Values.service.port }}
path: {{ .Values.ingress.path }}
Expand All @@ -22,15 +22,15 @@ spec:
paths:
- backend:
service:
name: {{ include "ror-admin.fullname" . }}
name: {{ include "ror-webapp.fullname" . }}
port:
number: {{ .Values.service.port }}
path: {{ .Values.ingress.path }}
pathType: {{ .Values.ingress.pathType }}
tls:
- hosts:
- {{ .Values.web.host }}
secretName: nhn-ror-admin-tls
secretName: nhn-ror-webapp-tls
- hosts:
- {{ .Values.web.host2 }}
secretName: nhn-ror-webapp-tls
Expand Down
4 changes: 2 additions & 2 deletions charts/ror-webapp/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "ror-admin.fullname" . }}-rolebindings
name: {{ include "ror-webapp.fullname" . }}-rolebindings
roleRef:
kind: ClusterRole
name: psp:vmware-system-restricted #Kan erstattes med: "psp:vmware-system-privileged" for root access
apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
name: {{ include "ror-admin.serviceAccountName" . }}
name: {{ include "ror-webapp.serviceAccountName" . }}
6 changes: 3 additions & 3 deletions charts/ror-webapp/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "ror-admin.fullname" . }}
name: {{ include "ror-webapp.fullname" . }}
labels:
{{- include "ror-admin.labels" . | nindent 4 }}
{{- include "ror-webapp.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
Expand All @@ -12,4 +12,4 @@ spec:
protocol: TCP
name: http
selector:
{{- include "ror-admin.selectorLabels" . | nindent 4 }}
{{- include "ror-webapp.selectorLabels" . | nindent 4 }}
4 changes: 2 additions & 2 deletions charts/ror-webapp/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "ror-admin.serviceAccountName" . }}
name: {{ include "ror-webapp.serviceAccountName" . }}
labels:
{{- include "ror-admin.labels" . | nindent 4 }}
{{- include "ror-webapp.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
6 changes: 3 additions & 3 deletions charts/ror-webapp/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "ror-admin.fullname" . }}-test-connection"
name: "{{ include "ror-webapp.fullname" . }}-test-connection"
labels:
{{- include "ror-admin.labels" . | nindent 4 }}
{{- include "ror-webapp.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "ror-admin.fullname" . }}:{{ .Values.service.port }}']
args: ['{{ include "ror-webapp.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
2 changes: 1 addition & 1 deletion charts/ror-webapp/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Default values for ror-admin.
# Default values for ror-webapp.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
enabled: true
Expand Down
8 changes: 8 additions & 0 deletions src/app/core/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ export class ConfigService {
},
};

if (environment.production) {
config.auth.clientId = 'ror.nhn.no';
config.auth.issuer = 'https://auth.sky.nhn.no/dex';
config.rorApi = 'https://ror.nhn.no';
config.auth.requireHttps = true;
config.auth.strictDiscoveryDocumentValidation = true;
}

return config;
}
}

0 comments on commit 72930a1

Please sign in to comment.