kubernetes / autoscaler

Autoscaling components for Kubernetes
Apache License 2.0
8.04k stars 3.96k forks source link

clusterIP: "{{ .Values.service.clusterIP }}" not define in values #6631

Open marcossilvestrini opened 7 months ago

marcossilvestrini commented 7 months ago

Hi.

I find a error in to definitions of templates and values.

{{- if .Values.service.clusterIP }} clusterIP: "{{ .Values.service.clusterIP }}" {{- end }}

This key\value is not define in values.yaml

Values: https://github.com/kubernetes/autoscaler/blob/2c2128e983b6fb918ce86de8fafe6c10030e6041/charts/cluster-autoscaler/values.yaml#L328

Template: https://github.com/kubernetes/autoscaler/blob/2c2128e983b6fb918ce86de8fafe6c10030e6041/charts/cluster-autoscaler/templates/service.yaml#L17

gjtempleton commented 7 months ago

/good-first-issue /kind bug

k8s-ci-robot commented 7 months ago

@gjtempleton: This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to [this](https://github.com/kubernetes/autoscaler/issues/6631): >/good-first-issue >/kind bug Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
Shubham82 commented 7 months ago

/triage accepted

Shubham82 commented 7 months ago

We also have to update the link for External IPs, present under the comment as a reference.

Line to update: https://github.com/kubernetes/autoscaler/blob/2c2128e983b6fb918ce86de8fafe6c10030e6041/charts/cluster-autoscaler/values.yaml#L335

Current Link: https://kubernetes.io/docs/user-guide/services/#external-ips Updated Link: https://kubernetes.io/docs/concepts/services-networking/service/#external-ips

TronSkywalker commented 7 months ago

I cannot reproduce a bug or error for the not defined clusterID, shouldn't this then be kind/cleanup?

Will provide PR if I may pick this issue up. (Will include your comment https://github.com/kubernetes/autoscaler/issues/6631#issuecomment-2006828378)

jackfrancis commented 3 weeks ago

Hi @marcossilvestrini , in fact this is not really a bug. The fact that we don't declare a default in the values.yaml of the chart doesn't mean we can't use it in the template. For example:

$ helm template cas cluster-autoscaler --set service.clusterIP="10.0.0.10" | grep 'kind: Service$' -A10
kind: Service
metadata:
  labels:
    app.kubernetes.io/instance: "cas"
    app.kubernetes.io/name: "aws-cluster-autoscaler"
    app.kubernetes.io/managed-by: "Helm"
    helm.sh/chart: "cluster-autoscaler-9.40.0"
  name: cas-aws-cluster-autoscaler
  namespace: default
spec:
  clusterIP: "10.0.0.10"

As described here, there are three ways to input values to be interpreted by the helm template, only one of which is via the values.yaml file.

You could argue that it is a best-practice to include a default in the values.yaml, and more importantly because we're using helm-docs to auto-generate helm values documentation, we should include it there and then re-gen documentation. We can call that a cleanup item.