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
set:
ingress.main:
defaultBackend: test
defaultBackend:
resource:
apiGroup: k8s.example.com
kind: StorageBucket
name: static-assets
asserts:
- documentIndex: &IngressDocument 2
isKind:
@ -118,7 +122,11 @@ tests:
- documentIndex: *IngressDocument
equal:
path: spec.defaultBackend
value: test
value:
resource:
apiGroup: k8s.example.com
kind: StorageBucket
name: static-assets
- documentIndex: *IngressDocument
notExists:
path: spec.rules

View file

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

View file

@ -3,7 +3,7 @@ apiVersion: v2
name: common
description: Function library for Helm charts
type: library
version: 3.6.0
version: 3.6.1
kubeVersion: ">=1.22.0-0"
keywords:
- common
@ -14,9 +14,12 @@ maintainers:
email: me@bjw-s.dev
annotations:
artifacthub.io/changes: |-
- kind: added
- kind: fixed
description: |-
Add hostUsers field to pod spec for k8s clusters >= 1.29
- kind: added
Only add hostUsers when explicitly configured
- kind: fixed
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
![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
@ -27,7 +27,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
# Chart.yaml
dependencies:
- name: common
version: 3.6.0
version: 3.6.1
repository: https://bjw-s.github.io/helm-charts/
```

View file

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

View file

@ -967,5 +967,62 @@
}
},
"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": {
"type": "boolean",
"default": "false"
"default": false
},
"hostPID": {
"type": "boolean",
"default": false
},
"hostUsers": {
"type": "boolean",
"default": false
"type": ["boolean", "null"]
},
"hostname": {
"type": "string"

View file

@ -50,7 +50,7 @@ spec:
{{- end }}
{{- end }}
{{- if $ingressObject.defaultBackend }}
defaultBackend: {{ $ingressObject.defaultBackend }}
defaultBackend: {{ $ingressObject.defaultBackend | toYaml | nindent 4 }}
{{- else }}
rules:
{{- 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) }}
hostPID: {{ include "bjw-s.common.lib.pod.getOption" (dict "ctx" $ctx "option" "hostPID" "default" false) }}
{{- 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 }}
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")) }}

View file

@ -1,6 +1,6 @@
{
"$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",
"properties": {
"global": {

View file

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