Skip to content

InternalPort rename as port and allow config containerPort #157

@yfhui

Description

@yfhui

Recently I am configing chatwoot for k8s deployment, and it confuses me a bit and I found that:

  1. It is better to align with k8s convention. It confuses a bit when setting the port mapping.

charts/chatwoot/templates/web-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: {{ template "chatwoot.fullname" . }}
  creationTimestamp: null
  labels:
    app: {{ template "chatwoot.fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
  {{- with .Values.services.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
    {{- end }}
spec:
  ports:
    - name: {{ .Values.services.name | quote}}
      port: {{ int .Values.services.internalPort }} # here we should use port to align the naming '.Values.services.port'
      targetPort: {{ int .Values.services.targetPort }}
  type: {{ .Values.services.type }}
  selector:
    app: {{ template "chatwoot.fullname" . }}
    role: web
status:
  loadBalancer: {}
  1. also it is better to allow controlling the container port with containerPort

charts/chatwoot/templates/web-deployment.yaml

          ...
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          name: {{ .Chart.Name }}-web
          ports:
            - containerPort: {{ int .Values.services.internalPort }} # should accept container port '.Values.services.containerPort'
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          {{- with .Values.web.resources }}
          resources:
            {{- toYaml . | nindent 12 }}
            {{- end }}
          ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions