traefik/script/code-gen.sh

37 lines
1.6 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2021-07-23 11:00:07 +02:00
set -e -o pipefail
2025-03-05 09:20:05 +00:00
PROJECT_MODULE="github.com/traefik/traefik"
2025-03-10 15:40:23 +01:00
MODULE_VERSION="v3"
2025-03-05 09:20:05 +00:00
KUBE_VERSION=v0.30.10
CURRENT_DIR="$(pwd)"
2025-03-05 09:20:05 +00:00
go install "k8s.io/code-generator/cmd/deepcopy-gen@${KUBE_VERSION}"
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.1
2025-03-05 09:20:05 +00:00
CODEGEN_PKG="$(go env GOPATH)/pkg/mod/k8s.io/code-generator@${KUBE_VERSION}"
# shellcheck disable=SC1091 # Cannot check source of this file
source "${CODEGEN_PKG}/kube_codegen.sh"
2025-03-05 09:20:05 +00:00
echo "# Generating Traefik clientset and deepcopy code ..."
kube::codegen::gen_helpers \
2025-03-05 09:20:05 +00:00
--boilerplate "$(dirname "${BASH_SOURCE[0]}")/boilerplate.go.tmpl" \
"${CURRENT_DIR}"
kube::codegen::gen_client \
--with-watch \
2025-03-05 09:20:05 +00:00
--output-dir "${CURRENT_DIR}/pkg/provider/kubernetes/crd/generated" \
--output-pkg "${PROJECT_MODULE}/${MODULE_VERSION}/pkg/provider/kubernetes/crd/generated" \
--boilerplate "$(dirname "${BASH_SOURCE[0]}")/boilerplate.go.tmpl" \
"${CURRENT_DIR}/pkg/provider/kubernetes/crd"
echo "# Generating the CRD definitions for the documentation ..."
controller-gen crd:crdVersions=v1 \
2025-03-10 15:40:23 +01:00
paths={./pkg/provider/kubernetes/crd/traefikio/v1alpha1/...} \
2025-03-05 09:20:05 +00:00
output:dir=./docs/content/reference/dynamic-configuration/
echo "# Concatenate the CRD definitions for publication and integration tests ..."
cat "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/traefik.io_*.yaml > "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml
cp -f "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml "${CURRENT_DIR}"/integration/fixtures/k8s/01-traefik-crd.yml