Skip to content

Commit

Permalink
feat(dolibarr): refactor port management and allow configuring contai…
Browse files Browse the repository at this point in the history
…ner ports (cowboysysop#473)
  • Loading branch information
sebastien-prudhomme authored Jul 4, 2023
1 parent 4161942 commit 3571bc5
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 198 deletions.
2 changes: 1 addition & 1 deletion charts/dolibarr/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: dolibarr
sources:
- https://github.com/Dolibarr/dolibarr
- https://github.com/cowboysysop/charts/tree/master/charts/dolibarr
version: 2.1.0
version: 3.0.0
dependencies:
- name: common
version: 2.5.0
Expand Down
169 changes: 87 additions & 82 deletions charts/dolibarr/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions charts/dolibarr/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
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 "dolibarr.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "dolibarr.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}/
echo http://$SERVICE_IP:{{ .Values.service.ports.http }}/
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "dolibarr.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080/ to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:{{ .Values.containerPorts.http }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/dolibarr/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ spec:
{{- end }}
ports:
- name: http
containerPort: 80
containerPort: {{ .Values.containerPorts.http }}
protocol: TCP
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
Expand Down
2 changes: 1 addition & 1 deletion charts/dolibarr/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
pathType: {{ $.Values.ingress.pathType }}
{{- end }}
backend:
{{- include "common.ingress.backend" (dict "serviceName" (include "dolibarr.fullname" $) "servicePort" $.Values.service.port "context" $) | nindent 14 }}
{{- include "common.ingress.backend" (dict "serviceName" (include "dolibarr.fullname" $) "servicePort" $.Values.service.ports.http "context" $) | nindent 14 }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions charts/dolibarr/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ spec:
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- end }}
ports:
- port: {{ .Values.service.port }}
- port: {{ .Values.service.ports.http }}
targetPort: http
protocol: TCP
name: http
{{- if and (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) .Values.service.nodePort }}
nodePort: {{ .Values.service.nodePort }}
{{- if and (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) .Values.service.nodePorts.http }}
nodePort: {{ .Values.service.nodePorts.http }}
{{- end }}
selector:
{{- include "dolibarr.selectorLabels" . | nindent 4 }}
2 changes: 1 addition & 1 deletion charts/dolibarr/templates/tests/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data:
def test_service_connection():
url = "http://{{ include "dolibarr.fullname" . }}:{{ .Values.service.port }}/"
url = "http://{{ include "dolibarr.fullname" . }}:{{ .Values.service.ports.http }}/"
response = requests.get(url)
Expand Down
Loading

0 comments on commit 3571bc5

Please sign in to comment.