library-charts icon indicating copy to clipboard operation
library-charts copied to clipboard

Add `hostPort` support to the common chart

Open utkuozdemir opened this issue 3 years ago • 1 comments

Details

Helm chart name: common

Describe the solution you'd like: Add possibility to specify a hostPort

Anything else you would like to add: It can be useful

Additional Information: none

utkuozdemir avatar Dec 27 '21 22:12 utkuozdemir

Until this gets added, it is possible to get it done when using FluxCD - use postRenderers on your HelmRelease like the following (example for Samba):

 postRenderers:
  - kustomize:
      patchesStrategicMerge:
        - apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: samba
          spec:
            template:
              spec:
                containers:
                  - name: samba
                    ports:
                      - containerPort: 139
                        protocol: TCP
                        hostPort: 139
                      - containerPort: 445
                        protocol: TCP
                        hostPort: 445

Alternatively, using JSON Patch:

patchesJson6902:
  - target:
      group: apps
      version: v1
      kind: Deployment
      name: samba
    patch:
      - op: add
        path: "/spec/template/spec/containers/0/ports/0/hostPort"
        value: 139
      - op: add
        path: "/spec/template/spec/containers/0/ports/1/hostPort"
        value: 445

Both will give the same result.

utkuozdemir avatar Jan 04 '22 19:01 utkuozdemir