k8s-at-home / charts

⚠️ Deprecated : Helm charts for applications you run at home
https://docs.k8s-at-home.com
Apache License 2.0
1.45k stars 623 forks source link

[owncast] Cannot set Service type to `ClusterIP` for `owncast-rtmp` and override `externalTrafficPolicy` default #1676

Closed Matthew-Beckett closed 2 years ago

Matthew-Beckett commented 2 years ago

Helm chart name

owncast

Helm chart version

3.3.2

Container name

gabekangas/owncast

Container tag

latest

Description

When deploying Owncast with the rtmp service deployed on a ClusterIP Service instead of the provided LoadBalancer service type deployment will fail as there is guard rails in the chart for checking the value of externalTrafficPolicy.

When providing an externalTrafficPolicy of Cluster the following output is returned:

Service "owncast-rtmp" is invalid: spec.externalTrafficPolicy: Invalid value: "Cluster": may only be set when `type` is 'NodePort' or 'LoadBalancer'

and when providing an externalTrafficPolicy of Local the following output is returned:

reconciliation failed: Helm upgrade failed: failed to create resource: Service "owncast-rtmp" is invalid: spec.externalTrafficPolicy: Invalid value: "Local": may only be set when `type` is 'NodePort' or 'LoadBalancer'

I also could not set it to nil.

Expected result

I should be able to provide an externalTrafficPolicy of Local or Cluster depending on my use case.

Helm values to reproduce

---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
  name: k8s-at-home
  namespace: owncast
spec:
  interval: 1h0m0s
  url: https://k8s-at-home.com/charts/
---
apiVersion: v1
kind: Namespace
metadata:
  name: owncast
  labels:
    app: owncast
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: owncast
  namespace: owncast
spec:
  chart:
    spec:
      chart: owncast
      sourceRef:
        kind: HelmRepository
        name: k8s-at-home
  values:
    image:
      tag: latest
    service:
      rtmp:
        type: ClusterIP
        externalTrafficPolicy: Cluster

Additional Information

No response

Repo link

No response

bjw-s commented 2 years ago

The chart is not throwing that error, it is the Kubernetes API telling you that it is not possible to use externalTrafficPolicy in combination with a ClusterIP service type.

As you can see here, we only put it in 1:1 if it is specified: https://github.com/k8s-at-home/library-charts/blob/main/charts/stable/common/templates/classes/_service.tpl#L52-L54

I did notice that the ownCast chart has a default value set for externalTrafficPolicy, that might be the cause. Could you try setting service.rtmp.externalTrafficPolicy: "" in your values.yaml file and see if that helps?

Matthew-Beckett commented 2 years ago

HI @bjw-s

Providing a null value string successfully overrode the default externalTrafficPolicy in the owncast chart and allowed me to deploy the RTMP service in ClusterIP type.

Thanks for your help!