added repo

This commit is contained in:
Your Name
2026-08-26 03:39:42 +05:30
parent 45c25a95af
commit b8575bb8b9
6889 changed files with 1217125 additions and 0 deletions
@@ -0,0 +1,47 @@
suite: test operator webhook
templates:
- templates/webhook.yaml
tests:
- it: should render clientConfig.caBundle when certs are managed by the user
set:
webhook:
manageCerts: false
caBundle: Y2VydGlmaWNhdGU=
asserts:
- documentIndex: 0
isKind:
of: ValidatingWebhookConfiguration
- documentIndex: 0
equal:
path: webhooks[0].clientConfig.caBundle
value: Y2VydGlmaWNhdGU=
- documentIndex: 0
equal:
path: webhooks[12].clientConfig.caBundle
value: Y2VydGlmaWNhdGU=
- it: should NOT render clientConfig.caBundle when certs are managed by the operator
set:
webhook:
manageCerts: true
caBundle: Cg==
asserts:
- documentIndex: 0
isKind:
of: ValidatingWebhookConfiguration
- documentIndex: 0
notExists:
path: webhooks[0].clientConfig.caBundle
- it: should NOT render webhook clientConfig.caBundle when certs are managed by the cert manager
set:
webhook:
manageCerts: false
certManagerCert: "cert-manager-cert"
caBundle: Cg==
asserts:
- documentIndex: 0
isKind:
of: ValidatingWebhookConfiguration
- documentIndex: 0
notExists:
path: webhooks[0].clientConfig.caBundle
@@ -0,0 +1,79 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: test operator service monitor
templates:
- service-monitor.yaml
tests:
- it: default service monitor
set:
config:
metrics:
secureMode:
enabled: true
asserts:
- template: service-monitor.yaml
equal:
path: spec
value:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
interval: 30s
path: /metrics
port: https
scheme: https
tlsConfig:
insecureSkipVerify: true
namespaceSelector:
matchNames:
- NAMESPACE
selector:
matchLabels:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: elastic-operator-metrics-service
- it: legacy values
set:
config:
metrics:
secureMode:
enabled: true
tls:
insecureSkipVerify: false
caSecret: metrics-ca
caMountDirectory: /etc/custom-ca/
asserts:
- template: service-monitor.yaml
equal:
path: spec.endpoints[0].tlsConfig
value:
caFile: /etc/custom-ca/metrics-ca/ca.crt
insecureSkipVerify: false
serverName: elastic-operator-metrics.NAMESPACE.svc
- it: serviceMonitor values
set:
config:
metrics:
secureMode:
enabled: true
serviceMonitor:
insecureSkipVerify: false
caSecret: metrics-ca
caMountDirectory: /etc/custom-ca/
asserts:
- template: service-monitor.yaml
equal:
path: spec.endpoints[0].tlsConfig
value:
caFile: /etc/custom-ca/metrics-ca/ca.crt
insecureSkipVerify: false
serverName: elastic-operator-metrics.NAMESPACE.svc
- it: secure mode without service monitor
set:
serviceMonitor:
enabled: false
config:
metrics:
secureMode:
enabled: true
asserts:
- template: service-monitor.yaml
hasDocuments:
count: 0
@@ -0,0 +1,156 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: test operator statefulset
templates:
- statefulset.yaml
- configmap.yaml
tests:
- it: ECK image, fips + ubi
set:
config.ubiOnly: true
image.fips: true
image.tag: "2.16.1"
asserts:
- template: statefulset.yaml
equal:
path: spec.template.spec.containers[0].image
value: "docker.elastic.co/eck/eck-operator-ubi-fips:2.16.1"
- it: ECK image, no fips, no ubi
set:
image.tag: "2.16.1"
asserts:
- template: statefulset.yaml
equal:
path: spec.template.spec.containers[0].image
value: "docker.elastic.co/eck/eck-operator:2.16.1"
- it: ECK image, fips, no ubi
set:
image.fips: true
image.tag: "2.16.1"
asserts:
- template: statefulset.yaml
equal:
path: spec.template.spec.containers[0].image
value: "docker.elastic.co/eck/eck-operator-fips:2.16.1"
- it: ECK image, no fips, ubi
set:
config.ubiOnly: true
image.tag: "2.16.1"
asserts:
- template: statefulset.yaml
equal:
path: spec.template.spec.containers[0].image
value: "docker.elastic.co/eck/eck-operator-ubi:2.16.1"
- it: should have automount service account tokens set by default
asserts:
- template: statefulset.yaml
equal:
path: spec.template.spec.automountServiceAccountToken
value: true
- it: should disable automount service account tokens
set:
automountServiceAccountToken: false
serviceAccount:
automountServiceAccountToken: false
asserts:
- template: statefulset.yaml
equal:
path: spec.template.spec.automountServiceAccountToken
value: false
- it: should render custom labels, and annotations values properly
set:
statefulsetAnnotations:
key1: value1
statefulsetLabels:
key2: value2
podLabels:
key3: value3
asserts:
- template: statefulset.yaml
equal:
path: metadata.annotations
value:
key1: value1
- template: statefulset.yaml
equal:
path: metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: elastic-operator
app.kubernetes.io/version: 3.3.1
helm.sh/chart: eck-operator-3.3.1
key2: value2
- template: statefulset.yaml
equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: elastic-operator
app.kubernetes.io/version: 3.3.1
helm.sh/chart: eck-operator-3.3.1
key3: value3
- it: should use the specified webhook secret name
set:
webhook:
manageCerts: false
certsSecret: "my-webhook-server-cert"
asserts:
- template: statefulset.yaml
equal:
path: spec.template.spec.volumes[1].name
value: cert
- template: statefulset.yaml
equal:
path: spec.template.spec.volumes[1].secret.secretName
value: my-webhook-server-cert
- template: statefulset.yaml
equal:
path: spec.template.spec.containers[0].env[2].name
value: WEBHOOK_SECRET
- template: statefulset.yaml
equal:
path: spec.template.spec.containers[0].env[2].value
value: my-webhook-server-cert
- it: should set dnsPolicy to ClusterFirstWithHostNet when hostNetwork is enabled
set:
hostNetwork: true
asserts:
- template: statefulset.yaml
equal:
path: spec.template.spec.hostNetwork
value: true
- template: statefulset.yaml
equal:
path: spec.template.spec.dnsPolicy
value: "ClusterFirstWithHostNet"
- it: should render dnsPolicy properly when hostNetwork is enabled
set:
hostNetwork: true
dnsPolicy: ClusterFirst
asserts:
- template: statefulset.yaml
equal:
path: spec.template.spec.hostNetwork
value: true
- template: statefulset.yaml
equal:
path: spec.template.spec.dnsPolicy
value: "ClusterFirst"
- it: should render dnsPolicy and dnsConfig properly
set:
dnsPolicy: ClusterFirst
dnsConfig:
nameservers: "1.2.3.4"
asserts:
- template: statefulset.yaml
notExists:
path: spec.template.spec.hostNetwork
- template: statefulset.yaml
equal:
path: spec.template.spec.dnsPolicy
value: "ClusterFirst"
- template: statefulset.yaml
equal:
path: spec.template.spec.dnsConfig.nameservers
value: "1.2.3.4"