Skip to content

Commit

Permalink
Adding support of ingressClassParams in helm charts (#2478)
Browse files Browse the repository at this point in the history
* Adding support of ingressClassParams in helm charts

* Update charts to let users to create ingressClassParams with specs

* Simplying the spec in values yaml

* Adding support for customer's ingressClassParams

* Using values fields directly instead of function

* eks1.19 doesn't allow null spec and need move if check out from spec block.
  • Loading branch information
haouc authored Feb 7, 2022
1 parent fe212ae commit 8b7f864
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helm/aws-load-balancer-controller/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: aws-load-balancer-controller
description: AWS Load Balancer Controller Helm chart for Kubernetes
version: 1.3.4
version: 1.3.5
appVersion: v2.3.1
home: https://github.com/aws/eks-charts
icon: https://raw.githubusercontent.com/aws/eks-charts/master/docs/logo/aws.png
Expand Down
3 changes: 3 additions & 0 deletions helm/aws-load-balancer-controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ The default values set by the application itself can be confirmed [here](https:/
| `terminationGracePeriodSeconds` | Time period for controller pod to do a graceful shutdown | 10 |
| `ingressClass` | The ingress class to satisfy | alb |
| `createIngressClassResource` | Create ingressClass resource | true |
| `ingressClassParams.name` | IngressClassParams resource's name, default to the aws load balancer controller's name | None
| `ingressClassParams.create` | If `true`, create a new ingressClassParams | true
| `ingressClassParams.spec` | IngressClassParams defined ingress specifications | {}
| `region` | The AWS region for the kubernetes cluster | None |
| `vpcId` | The VPC ID for the Kubernetes cluster | None |
| `awsMaxRetries` | Maximum retries for AWS APIs | None |
Expand Down
7 changes: 7 additions & 0 deletions helm/aws-load-balancer-controller/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,10 @@ Convert map to comma separated key=value string
{{- define "aws-load-balancer-controller.convertMapToCsv" -}}
{{- range $key, $value := . -}} {{ $key }}={{ $value }}, {{- end -}}
{{- end -}}

{{/*
Create the name of the ingressClassParams
*/}}
{{- define "aws-load-balancer-controller.ingressClassParamsName" -}}
{{ default (include "aws-load-balancer-controller.fullname" .) .Values.ingressClassParams.name }}
{{- end -}}
6 changes: 6 additions & 0 deletions helm/aws-load-balancer-controller/templates/ingressclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ metadata:
{{- include "aws-load-balancer-controller.labels" . | nindent 4 }}
spec:
controller: ingress.k8s.aws/alb
{{- if or .Values.ingressClassParams.create .Values.ingressClassParams.name }}
parameters:
apiGroup: elbv2.k8s.aws
kind: IngressClassParams
name: {{ include "aws-load-balancer-controller.ingressClassParamsName" . }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if .Values.ingressClassParams.create }}
apiVersion: elbv2.k8s.aws/v1beta1
kind: IngressClassParams
metadata:
name: {{ include "aws-load-balancer-controller.ingressClassParamsName" . }}
{{- if .Values.ingressClassParams.spec }}
spec:
{{ toYaml .Values.ingressClassParams.spec | nindent 2}}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions helm/aws-load-balancer-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ enableCertManager: false
# ingresses without ingress class annotation and ingresses of type alb
ingressClass: alb

# ingressClassParams specify the IngressCLassParams that enforce settings for a set of Ingresses when using with ingress Controller.
ingressClassParams:
create: true
# The name of ingressClassParams resource will be referred in ingressClass
name:
spec: {}
# You always can set specifications in `helm install` command through `--set` or `--set-string`
# If you do want to specify specifications in values.yaml, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'spec:'.
# namespaceSelector:
# matchLabels:
# group:
# scheme:
# ipAddressType:
# tags:

# To use IngressClass resource instead of annotation, before you need to install the IngressClass resource pointing to controller.
# If specified as true, the IngressClass resource will be created.
createIngressClassResource: true
Expand Down

0 comments on commit 8b7f864

Please sign in to comment.