[common] v2.2.1 (#480)

* [common] v2.2.1
This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2021-01-08 15:21:03 +01:00 committed by GitHub
parent 28118894f7
commit 61028541f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 3 deletions

View File

@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.2.1]
### Fixed
- Made explicit that `service.port.targetPort` cannot be a named port.
## [2.2.0]
### Added
@ -53,6 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This is the last version before starting this changelog. All sorts of cool stuff was changed, but only `git log` remembers what that was :slightly_frowning_face:
[2.2.1]: https://github.com/k8s-at-home/charts/tree/common-2.2.1/charts/common
[2.2.0]: https://github.com/k8s-at-home/charts/tree/common-2.2.0/charts/common
[2.1.0]: https://github.com/k8s-at-home/charts/tree/common-2.1.0/charts/common

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: common
description: Function library for k8s-at-home charts
type: library
version: 2.2.0
version: 2.2.1
keywords:
- k8s-at-home
- common

View File

@ -32,6 +32,9 @@ Ports included by the controller.
ports:
{{- range $_ := $ports }}
- name: {{ .name }}
{{- if and .targetPort (kindIs "string" .targetPort) }}
{{- fail (printf "Our charts do not support named ports for targetPort. (port name %s, targetPort %s)" .name .targetPort) }}
{{- end }}
containerPort: {{ .targetPort | default .port }}
protocol: {{ .protocol | default "TCP" }}
{{- end -}}

View File

@ -107,8 +107,9 @@ service:
## name defaults to http
name:
protocol: TCP
## targetPort defaults to the service name. If targetPort is specified, this port number
## is used in the container definition instead of service.port.port.
## Specify a service targetPort if you wish to differ the service port from the application port.
## If targetPort is specified, this port number is used in the container definition instead of
## service.port.port. Therefore named ports are not supported for this field.
targetPort:
## Specify the nodePort value for the LoadBalancer and NodePort service types.
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport

View File

@ -81,6 +81,21 @@ class Test < ChartTest
jq('.spec.template.spec.containers[0].ports[0].containerPort', resource('Deployment')).must_equal values[:service][:port][:targetPort]
jq('.spec.template.spec.containers[0].ports[0].name', resource('Deployment')).must_equal default_name
end
it 'targetPort cannot be a named port' do
values = {
service: {
port: {
targetPort: 'test'
}
}
}
chart.value values
exception = assert_raises HelmCompileError do
chart.execute_helm_template!
end
assert_match("Our charts do not support named ports for targetPort. (port name #{default_name}, targetPort #{values[:service][:port][:targetPort]})", exception.message)
end
end
end
end