Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(base): add the ability to add custom ports for the release #62

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/base/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ maintainers:
url: https://github.com/jordanopensource/charts/
sources:
- https://github.com/jordanopensource/charts/tree/main/charts/base
version: 1.1.0
version: 1.2.0
appVersion: 1.0.1
7 changes: 3 additions & 4 deletions charts/base/templates/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ spec:
{{- if .Values.workload.envFrom }}
envFrom: {{- include "base.tplvalues.render" (dict "value" .Values.workload.envFrom "context" $) | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.workload.containerPort }}
protocol: TCP
{{- if .Values.workload.containerPorts }}
ports: {{- include "base.tplvalues.render" (dict "value" .Values.workload.containerPorts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.workload.livenessProbe }}
livenessProbe: {{- include "base.tplvalues.render" (dict "value" .Values.workload.livenessProbe "context" $) | nindent 12 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/base/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if .Values.workload.ingress.enabled -}}
{{- $fullName := include "base.names.fullname" . -}}
{{- $svcPort := .Values.workload.service.port -}}
{{- $svcPort := .Values.workload.ingress.servicePort -}}
{{- if and .Values.workload.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.workload.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.workload.ingress.annotations "kubernetes.io/ingress.class" .Values.workload.ingress.className}}
Expand Down
12 changes: 6 additions & 6 deletions charts/base/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.workload.service.create -}}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -9,11 +10,10 @@ metadata:
annotations: {{- include "base.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }}
{{- end }}
spec:
type: {{.Values.workload.service.type}}
ports:
- port: {{ .Values.workload.service.port }}
targetPort: {{ .Values.workload.containerPort }}
protocol: TCP
name: http
type: {{ .Values.workload.service.type }}
{{- if .Values.workload.service.ports }}
ports: {{- include "base.tplvalues.render" (dict "value" .Values.workload.service.ports "context" $) | nindent 4 }}
{{- end }}
{{- $podLabels := include "base.tplvalues.merge" ( dict "values" ( list .Values.workload.podLabels .Values.commonLabels ) "context" . ) }}
selector: {{- include "base.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 4 }}
{{- end -}}
21 changes: 17 additions & 4 deletions charts/base/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ workload:
type: Deployment
## @param workload.replicaCount [default: 1]
replicaCount: 1
## @param workload.port define the port of the main container
containerPort: 3000

image:
## @param workload.image.repository [default: REPOSITORY_NAME/DOCKER_IMAGE_NAME] NGINX image repository
Expand All @@ -33,6 +31,13 @@ workload:
## @param workload.imagePullSecrets Specify docker-registry secret names as an array
imagePullSecrets: []

## @param workload.containerPorts define the ports of the main container
## Leave empty if no ports are exposed
containerPorts:
- name: http
containerPort: 80
protocol: TCP

## @param workload.initContainers define initContainers as an array to run before the main container
## ref: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
## e.g:
Expand Down Expand Up @@ -115,10 +120,16 @@ workload:
# runAsUser: 1000

service:
## @param workload.service.create if you want the service to be created
create: true
## @param workload.service.type define the type of the service
type: ClusterIP
## @param workload.service.port define the port of the service
port: 80
## @param workload.service.ports define the ports of the service
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
## @param workload.service.annotations add annotations for the service
annotations: {}

Expand All @@ -127,6 +138,8 @@ workload:
enabled: false
## @param workload.ingress.className choose the ingress class name
className: ""
## @param workload.ingress.servicePort specify the target service port for ingress routing.
servicePort: 80
## @param workload.ingress.annotations add the ingress annotations
annotations: {}
## @param workload.ingress.hosts define the hosts as an array
Expand Down
Loading