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 ipFamily-related options #167

Closed
wants to merge 2 commits into from
Closed

Add ipFamily-related options #167

wants to merge 2 commits into from

Conversation

hrntknr
Copy link
Contributor

@hrntknr hrntknr commented Aug 21, 2023

Add support for ipFamilyPolicy,ipFamilies.
ref: https://kubernetes.io/docs/concepts/services-networking/dual-stack/

The actual output of yaml when values are not specified is as follows.

$ helm install minecraft oci://**********/library/minecraft --dry-run --debug
(omit)
---
# Source: minecraft/templates/minecraft-svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: minecraft-minecraft
  labels:
    app: minecraft-minecraft
    chart: "minecraft-4.9.4"
    release: "minecraft"
    heritage: "Helm"
    app.kubernetes.io/name: "minecraft"
    app.kubernetes.io/instance: minecraft-minecraft
    app.kubernetes.io/version: "4.9.4"
  annotations:
    {}
spec:
  type: ClusterIP
  ports:
  - name: minecraft
    port: 25565
    targetPort: minecraft
    protocol: TCP
  selector:
    app: minecraft-minecraft

ipFamilyPolicy,ipFamilies can be specified as follows

helm install minecraft oci://**********/library/minecraft --dry-run --debug --values helm/minecraft/server01.yaml
(omit)
# Source: minecraft/templates/minecraft-svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: minecraft-minecraft
  labels:
    app: minecraft-minecraft
    chart: "minecraft-4.9.4"
    release: "minecraft"
    heritage: "Helm"
    app.kubernetes.io/name: "minecraft"
    app.kubernetes.io/instance: minecraft-minecraft
    app.kubernetes.io/version: "4.9.4"
  annotations:
    {}
spec:
  type: LoadBalancer
  ipFamilyPolicy: RequireDualStack
  ipFamilies:
    - IPv4
    - IPv6
  ports:
  - name: minecraft
    port: 25565
    targetPort: minecraft
    protocol: TCP
  selector:
    app: minecraft-minecraft

@hrntknr hrntknr changed the title Added ipFamily-related options Add ipFamily-related options Aug 21, 2023
@hrntknr
Copy link
Contributor Author

hrntknr commented Aug 21, 2023

I set PreferDualStack as the default policy, the yaml without the value would be as follows.

# Source: minecraft/templates/minecraft-svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: minecraft-minecraft
  labels:
    app: minecraft-minecraft
    chart: "minecraft-4.9.5"
    release: "minecraft"
    heritage: "Helm"
    app.kubernetes.io/name: "minecraft"
    app.kubernetes.io/instance: minecraft-minecraft
    app.kubernetes.io/version: "4.9.5"
  annotations:
    {}
spec:
  type: ClusterIP
  ipFamilyPolicy: PreferDualStack
  ports:
  - name: minecraft
    port: 25565
    targetPort: minecraft
    protocol: TCP
  selector:
    app: minecraft-minecraft

Copy link
Owner

@itzg itzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. I'm wondering if this should be more generalized to something like extraServiceSpec which is an object value that'll get "appended" into the spec. My worry is that the values gradually become a flattened representation of the entire kubernetes data model.

Admittedly the risk is that a user will include a colliding field in the extra fields, but that'll fail early at validation/deploy.

@hrntknr
Copy link
Contributor Author

hrntknr commented Aug 22, 2023

Thanks for the review.
You are right, it would be better to make it more generalized as extraServiceSpec.
We will implement and propose extraServiceSpec in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants