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

Add loadbalancer #48

Merged
merged 4 commits into from
Jul 19, 2022
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
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
FROM nginx:1.23.0-alpine

# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk -U upgrade

RUN apk -U upgrade --available
RUN apk add --no-cache bash

# Add 2048 stuff into Nginx server
Expand Down
2 changes: 1 addition & 1 deletion charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.registry }} / {{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
Expand Down
18 changes: 13 additions & 5 deletions charts/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ metadata:
{{- include "dao-2048.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerSourceRanges)) }}
loadBalancerSourceRanges: {{ .Values.service.loadBalancerSourceRanges }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
selector:
{{- include "dao-2048.selectorLabels" . | nindent 4 }}
ports:
- name: http
port: {{ .Values.service.ports.http }}
targetPort: {{ .Values.service.targetPort.http }}
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.http)) }}
nodePort: {{ .Values.service.nodePorts.http }}
{{- end }}
43 changes: 42 additions & 1 deletion charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,50 @@ securityContext: {}
# runAsNonRoot: true
# runAsUser: 1000

## Service properties
##
service:
## @param service.type Service type
## NodePort or ClusterIP or LoadBalancer
##
type: ClusterIP
port: 80
## @param service.ports.http Service HTTP port
## @param service.ports.https Service HTTPS port
##
ports:
http: 80

##
## @param service.nodePorts [object] Specify the nodePort(s) value(s) for the LoadBalancer and NodePort service types.
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
##
nodePorts:
http: ""

## @param service.targetPort [object] Target port reference value for the Loadbalancer service types can be specified explicitly.
## Listeners for the Loadbalancer can be custom mapped to the http or https service.
## Example: Mapping the https listener to targetPort http [http: https]
##
targetPort:
http: http

## @param service.clusterIP NGINX service Cluster IP
## e.g.:
## clusterIP: None
##
clusterIP: ""
## @param service.loadBalancerIP LoadBalancer service IP address
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
##
loadBalancerIP: ""
## @param service.loadBalancerSourceRanges NGINX service Load Balancer sources
## ref: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/#restrict-access-for-loadbalancer-service
## e.g:
## loadBalancerSourceRanges:
## - 10.10.10.0/24
##
loadBalancerSourceRanges: []


resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
Expand Down