2020-11-16 14:38:04 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2019-03-14 14:56:06 +00:00
|
|
|
|
2019-05-06 07:40:04 +00:00
|
|
|
HACK_DIR="$( cd "$( dirname "${0}" )" && pwd -P)"; export HACK_DIR
|
2019-03-14 14:56:06 +00:00
|
|
|
REPO_ROOT=${HACK_DIR}/..
|
2019-08-11 10:20:53 +00:00
|
|
|
TRAEFIK_MODULE_VERSION=v2
|
2019-03-14 14:56:06 +00:00
|
|
|
|
2019-08-03 01:58:23 +00:00
|
|
|
rm -rf "${REPO_ROOT}"/vendor
|
|
|
|
go mod vendor
|
|
|
|
chmod +x "${REPO_ROOT}"/vendor/k8s.io/code-generator/*.sh
|
|
|
|
|
2021-03-03 14:32:04 +00:00
|
|
|
# Generate the crd client
|
2019-05-10 15:24:06 +00:00
|
|
|
"${REPO_ROOT}"/vendor/k8s.io/code-generator/generate-groups.sh \
|
2019-03-14 14:56:06 +00:00
|
|
|
all \
|
2020-09-16 13:46:04 +00:00
|
|
|
github.com/traefik/traefik/${TRAEFIK_MODULE_VERSION}/pkg/provider/kubernetes/crd/generated \
|
|
|
|
github.com/traefik/traefik/${TRAEFIK_MODULE_VERSION}/pkg/provider/kubernetes/crd \
|
2019-03-14 14:56:06 +00:00
|
|
|
traefik:v1alpha1 \
|
2019-05-10 15:24:06 +00:00
|
|
|
--go-header-file "${HACK_DIR}"/boilerplate.go.tmpl \
|
|
|
|
"$@"
|
2019-03-14 14:56:06 +00:00
|
|
|
|
2019-07-19 09:52:04 +00:00
|
|
|
deepcopy-gen \
|
2021-03-03 14:32:04 +00:00
|
|
|
--input-dirs github.com/traefik/traefik/${TRAEFIK_MODULE_VERSION}/pkg/config/dynamic \
|
|
|
|
--input-dirs github.com/traefik/traefik/${TRAEFIK_MODULE_VERSION}/pkg/tls \
|
|
|
|
--input-dirs github.com/traefik/traefik/${TRAEFIK_MODULE_VERSION}/pkg/types \
|
|
|
|
--output-package github.com/traefik/traefik \
|
|
|
|
-O zz_generated.deepcopy --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl
|
2019-08-03 01:58:23 +00:00
|
|
|
|
2019-08-11 10:20:53 +00:00
|
|
|
cp -r "${REPO_ROOT}"/"${TRAEFIK_MODULE_VERSION:?}"/* "${REPO_ROOT}"; rm -rf "${REPO_ROOT}"/"${TRAEFIK_MODULE_VERSION:?}"
|
|
|
|
|
2021-03-03 14:32:04 +00:00
|
|
|
# Generate the CRD definitions for the documentation
|
|
|
|
go run "${REPO_ROOT}"/vendor/sigs.k8s.io/controller-tools/cmd/controller-gen \
|
|
|
|
crd:crdVersions=v1 \
|
|
|
|
paths="${REPO_ROOT}"/pkg/provider/kubernetes/crd/traefik/v1alpha1/... \
|
|
|
|
output:dir="${REPO_ROOT}"/docs/content/reference/dynamic-configuration/
|
|
|
|
|
|
|
|
# Concatenate the CRD definitions for the integration tests
|
|
|
|
cat "${REPO_ROOT}"/docs/content/reference/dynamic-configuration/traefik.containo.us_*.yaml > "${REPO_ROOT}"/integration/fixtures/k8s/01-traefik-crd.yml
|
|
|
|
|
2019-08-03 01:58:23 +00:00
|
|
|
rm -rf "${REPO_ROOT}"/vendor
|