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

Added support for service.spec.loadBalancerIP #8774

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 49 additions & 0 deletions docs/pages/kubernetes-access/helm/reference.mdx
Expand Up @@ -838,6 +838,55 @@ Kubernetes annotations which should be applied to the `secret` generated by
</TabItem>
</Tabs>

## `service.type`

| Type | Default value | Required? | Can be used in `custom` mode? |
| - | - | - | - |
| `string` | `LoadBalancer` | Yes | ✅ |

[Kubernetes reference](https://kubernetes.io/docs/concepts/services-networking/service/)

Allows to specify the service type.

<Tabs>
<TabItem label="values.yaml">
```yaml
service:
type: LoadBalancer
```
</TabItem>
<TabItem label="--set">
```code
$ --set service.type=LoadBalancer
```
</TabItem>
</Tabs>

## `service.spec.loadBalancerIP`

| Type | Default value | Required? | Can be used in `custom` mode? |
| - | - | - | - |
| `string` | `nil` | No | ✅ |

[Kubernetes reference](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer)

Allows to specify the `loadBalancerIP`.

<Tabs>
<TabItem label="values.yaml">
```yaml
service:
spec:
loadBalancerIP: 1.2.3.4
```
</TabItem>
<TabItem label="--set">
```code
$ --set service.spec.loadBalancerIP=1.2.3.4
```
</TabItem>
</Tabs>

## `extraArgs`

| Type | Default value | Can be used in `custom` mode? |
Expand Down
5 changes: 5 additions & 0 deletions examples/chart/teleport-cluster/.lint/service.yml
@@ -0,0 +1,5 @@
clusterName: helm-lint
service:
type: LoadBalancer
spec:
loadBalancerIP: 1.2.3.4
5 changes: 4 additions & 1 deletion examples/chart/teleport-cluster/templates/service.yaml
Expand Up @@ -17,7 +17,10 @@ metadata:
{{- end }}
{{- end }}
spec:
type: LoadBalancer
type: {{- default "LoadBalancer" .Values.service.type }}
{{- with .Values.service.spec }}
{{- toYaml . | nindent 4 }}
Copy link
Contributor

Choose a reason for hiding this comment

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

The nindent should be 2 instead of 4 here as it produces invalid yaml otherwise that looks like below

# Source: teleport-cluster/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: teleport
  namespace: cert-manager
  labels:
    app: teleport
spec:
  type: LoadBalancer
    loadBalancerIP: 1.1.1.1

and produces the following error

Error: YAML parse error on teleport-cluster/templates/service.yaml: error converting YAML to JSON: yaml: line 10: mapping values are not allowed in this context

for the following values

clusterName: teleport.example.com
service:
  spec:
    loadBalancerIP: "1.1.1.1"

Copy link
Contributor

Choose a reason for hiding this comment

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

PR to fix #9772

Copy link
Contributor

Choose a reason for hiding this comment

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

Handled in #9645, thanks

{{- end }}
ports:
- name: https
port: 443
Expand Down
19 changes: 19 additions & 0 deletions examples/chart/teleport-cluster/values.schema.json
Expand Up @@ -299,6 +299,25 @@
}
}
},
"service": {
"$id": "#/properties/service",
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"$id": "#properties/service/type",
"type": "string",
"default": "LoadBalancer"
},
"spec": {
"$id": "#/properties/service/spec",
"type": "object",
"default": {}
}
}
},
"extraArgs": {
"$id": "#/properties/extraArgs",
"type": "array",
Expand Down
7 changes: 7 additions & 0 deletions examples/chart/teleport-cluster/values.yaml
Expand Up @@ -182,6 +182,13 @@ annotations:
# highAvailability.certManager.enabled is true
certSecret: {}

# Options for the Teleport service
service:
type: LoadBalancer
# Additional entries here will be added to the service spec.
spec: {}
# loadBalancerIP: "1.2.3.4"

# Extra arguments to pass to 'teleport start' for the main Teleport pod
extraArgs: []

Expand Down