fix(common): Release 3.6.1 (#369)

This commit is contained in:
Bernd Schorgers 2025-01-12 11:28:41 +01:00 committed by GitHub
parent ec94fd49f7
commit 5fdc9e940e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 116 additions and 47 deletions

View file

@ -110,7 +110,11 @@ tests:
- it: with defaultBackend should pass - it: with defaultBackend should pass
set: set:
ingress.main: ingress.main:
defaultBackend: test defaultBackend:
resource:
apiGroup: k8s.example.com
kind: StorageBucket
name: static-assets
asserts: asserts:
- documentIndex: &IngressDocument 2 - documentIndex: &IngressDocument 2
isKind: isKind:
@ -118,7 +122,11 @@ tests:
- documentIndex: *IngressDocument - documentIndex: *IngressDocument
equal: equal:
path: spec.defaultBackend path: spec.defaultBackend
value: test value:
resource:
apiGroup: k8s.example.com
kind: StorageBucket
name: static-assets
- documentIndex: *IngressDocument - documentIndex: *IngressDocument
notExists: notExists:
path: spec.rules path: spec.rules

View file

@ -9,50 +9,51 @@ capabilities:
majorVersion: 1 majorVersion: 1
minorVersion: 29 minorVersion: 29
tests: tests:
- it: default should pass for kubernetes < 1.28 - it: should not be present by default for kubernetes < 1.28
capabilities: capabilities:
majorVersion: 1 majorVersion: 1
minorVersion: 28 minorVersion: 28
documentSelector: &DeploymentSelector
path: $[?(@.kind == "Deployment")].metadata.name
value: RELEASE-NAME
asserts: asserts:
- documentIndex: 0 - notExists:
isKind:
of: Deployment
- documentIndex: 0
notExists:
path: spec.template.spec.hostUsers path: spec.template.spec.hostUsers
- it: default should pass for kubernetes >= 1.29 - it: should not be present even if specified for kubernetes < 1.28
asserts: capabilities:
- documentIndex: 0 majorVersion: 1
isKind: minorVersion: 28
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostUsers
value: true
- it: hostUsers disabled should pass
set: set:
defaultPodOptions: defaultPodOptions:
hostUsers: false hostUsers: false
documentSelector: *DeploymentSelector
asserts: asserts:
- documentIndex: 0 - notExists:
isKind: path: spec.template.spec.hostUsers
of: Deployment
- documentIndex: 0 - it: should not be present by default for kubernetes >= 1.29
equal: documentSelector: *DeploymentSelector
asserts:
- notExists:
path: spec.template.spec.hostUsers
- it: hostUsers disabled should set for kubernetes >= 1.29
set:
defaultPodOptions:
hostUsers: false
documentSelector: *DeploymentSelector
asserts:
- equal:
path: spec.template.spec.hostUsers path: spec.template.spec.hostUsers
value: false value: false
- it: hostUsers enabled should pass - it: hostUsers enabled should be set for kubernetes >= 1.29
set: set:
defaultPodOptions: defaultPodOptions:
hostUsers: true hostUsers: true
documentSelector: *DeploymentSelector
asserts: asserts:
- documentIndex: 0 - equal:
isKind:
of: Deployment
- documentIndex: 0
equal:
path: spec.template.spec.hostUsers path: spec.template.spec.hostUsers
value: true value: true

View file

@ -3,7 +3,7 @@ apiVersion: v2
name: common name: common
description: Function library for Helm charts description: Function library for Helm charts
type: library type: library
version: 3.6.0 version: 3.6.1
kubeVersion: ">=1.22.0-0" kubeVersion: ">=1.22.0-0"
keywords: keywords:
- common - common
@ -14,9 +14,12 @@ maintainers:
email: me@bjw-s.dev email: me@bjw-s.dev
annotations: annotations:
artifacthub.io/changes: |- artifacthub.io/changes: |-
- kind: added - kind: fixed
description: |- description: |-
Add hostUsers field to pod spec for k8s clusters >= 1.29 Only add hostUsers when explicitly configured
- kind: added - kind: fixed
description: |- description: |-
Allow propagating global labels and annotations to Pod metadata `hosts` should be an optional field for Ingress resources
- kind: fixed
description: |-
`defaultBackend` should be an object for Ingress resources

View file

@ -1,6 +1,6 @@
# common # common
![Version: 3.6.0](https://img.shields.io/badge/Version-3.6.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![Version: 3.6.1](https://img.shields.io/badge/Version-3.6.1-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)
Function library for Helm charts Function library for Helm charts
@ -27,7 +27,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
# Chart.yaml # Chart.yaml
dependencies: dependencies:
- name: common - name: common
version: 3.6.0 version: 3.6.1
repository: https://bjw-s.github.io/helm-charts/ repository: https://bjw-s.github.io/helm-charts/
``` ```

View file

@ -18,7 +18,7 @@
}, },
"defaultBackend": { "defaultBackend": {
"type": "string" "$ref": "k8s-api.json#/networking.v1.ingressBackend"
}, },
"hosts": { "hosts": {
@ -42,8 +42,7 @@
"$ref": "#/tlsEntry" "$ref": "#/tlsEntry"
} }
} }
}, }
"required": ["hosts"]
}, },
"hostEntry": { "hostEntry": {

View file

@ -967,5 +967,62 @@
} }
}, },
"type": "object" "type": "object"
},
"networking.v1.ingressBackend": {
"description": "IngressBackend describes all endpoints for a given service and port.",
"properties": {
"resource": {
"description": "resource is an ObjectRef to another Kubernetes resource in the namespace of the Ingress object. If resource is specified, a service.Name and service.Port must not be specified. This is a mutually exclusive setting with \"Service\".",
"properties": {
"apiGroup": {
"description": "APIGroup is the group for the resource being referenced. If APIGroup is not specified, the specified Kind must be in the core API group. For any other third-party types, APIGroup is required.",
"type": "string"
},
"kind": {
"description": "Kind is the type of resource being referenced",
"type": "string"
},
"name": {
"description": "Name is the name of resource being referenced",
"type": "string"
}
},
"required": [
"kind",
"name"
],
"type": "object"
},
"service": {
"description": "service references a service as a backend. This is a mutually exclusive setting with \"Resource\".",
"properties": {
"name": {
"description": "name is the referenced service. The service must exist in the same namespace as the Ingress object.",
"type": "string"
},
"port": {
"description": "port of the referenced service. A port name or port number is required for a IngressServiceBackend.",
"properties": {
"name": {
"description": "name is the name of the port on the Service. This is a mutually exclusive setting with \"Number\".",
"type": "string"
},
"number": {
"description": "number is the numerical port number (e.g. 80) on the Service. This is a mutually exclusive setting with \"Name\".",
"format": "int32",
"type": "integer"
}
},
"type": "object"
}
},
"required": [
"name"
],
"type": "object"
}
},
"type": "object"
} }
} }

View file

@ -37,15 +37,14 @@
}, },
"hostNetwork": { "hostNetwork": {
"type": "boolean", "type": "boolean",
"default": "false" "default": false
}, },
"hostPID": { "hostPID": {
"type": "boolean", "type": "boolean",
"default": false "default": false
}, },
"hostUsers": { "hostUsers": {
"type": "boolean", "type": ["boolean", "null"]
"default": false
}, },
"hostname": { "hostname": {
"type": "string" "type": "string"

View file

@ -50,7 +50,7 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if $ingressObject.defaultBackend }} {{- if $ingressObject.defaultBackend }}
defaultBackend: {{ $ingressObject.defaultBackend }} defaultBackend: {{ $ingressObject.defaultBackend | toYaml | nindent 4 }}
{{- else }} {{- else }}
rules: rules:
{{- range $ingressObject.hosts }} {{- range $ingressObject.hosts }}

View file

@ -28,7 +28,9 @@ hostIPC: {{ include "bjw-s.common.lib.pod.getOption" (dict "ctx" $ctx "option" "
hostNetwork: {{ include "bjw-s.common.lib.pod.getOption" (dict "ctx" $ctx "option" "hostNetwork" "default" false) }} hostNetwork: {{ include "bjw-s.common.lib.pod.getOption" (dict "ctx" $ctx "option" "hostNetwork" "default" false) }}
hostPID: {{ include "bjw-s.common.lib.pod.getOption" (dict "ctx" $ctx "option" "hostPID" "default" false) }} hostPID: {{ include "bjw-s.common.lib.pod.getOption" (dict "ctx" $ctx "option" "hostPID" "default" false) }}
{{- if ge ($rootContext.Capabilities.KubeVersion.Minor | int) 29 }} {{- if ge ($rootContext.Capabilities.KubeVersion.Minor | int) 29 }}
hostUsers: {{ include "bjw-s.common.lib.pod.getOption" (dict "ctx" $ctx "option" "hostUsers" "default" true) }} {{- with (include "bjw-s.common.lib.pod.getOption" (dict "ctx" $ctx "option" "hostUsers")) }}
hostUsers: {{ . | trim }}
{{- end -}}
{{- end }} {{- end }}
dnsPolicy: {{ include "bjw-s.common.lib.pod.field.dnsPolicy" (dict "ctx" $ctx) | trim }} dnsPolicy: {{ include "bjw-s.common.lib.pod.field.dnsPolicy" (dict "ctx" $ctx) | trim }}
{{- with (include "bjw-s.common.lib.pod.getOption" (dict "ctx" $ctx "option" "dnsConfig")) }} {{- with (include "bjw-s.common.lib.pod.getOption" (dict "ctx" $ctx "option" "dnsConfig")) }}

View file

@ -1,6 +1,6 @@
{ {
"$schema": "http://json-schema.org/draft-07/schema", "$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.6.0/charts/library/common/values.schema.json", "$id": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.6.1/charts/library/common/values.schema.json",
"type": "object", "type": "object",
"properties": { "properties": {
"global": { "global": {

View file

@ -51,7 +51,7 @@ defaultPodOptions:
hostPID: false hostPID: false
# -- Use the host's user namespace (requires 1.29 or newer) # -- Use the host's user namespace (requires 1.29 or newer)
hostUsers: true hostUsers:
# -- Set image pull secrets # -- Set image pull secrets
imagePullSecrets: [] imagePullSecrets: []