Add deployment manifest generation scripts

This commit is contained in:
James Munnelly 2018-01-24 19:04:32 +00:00
parent 976a96267a
commit 0d3790567a
5 changed files with 97 additions and 0 deletions

15
docs/deploy/README.md Normal file
View File

@ -0,0 +1,15 @@
# Deployment files
This directory contains example deployment manifests for cert-manager that can
be used in place of the official Helm chart.
This is useful if you are deploying cert-manager into an environment without
Helm, or want to inspect a 'bare minimum' deployment.
## Where do these come from?
The manifests in these subdirectories are generated from the Helm chart
automatically. The `values.yaml` files used to configure cert-manager can be
found in [`hack/deploy`](../../hack/deploy/).
They are automatically generated by running `./hack/update-deploy-gen.sh`.

View File

View File

@ -0,0 +1,5 @@
rbac:
create: false
serviceAccount:
create: false

29
hack/update-deploy-gen.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})
REPO_ROOT="${SCRIPT_ROOT}/.."
# This will set Capabilities.KubeVersion.Major/Minor when generating manifests
KUBE_VERSION=1.9
gen() {
VALUES=$1
OUTPUT_DIR=$2
TMP_OUTPUT=$(mktemp -d)
mkdir -p "${OUTPUT_DIR}"
helm template \
"${REPO_ROOT}/contrib/charts/cert-manager" \
--values "${SCRIPT_ROOT}/deploy/${VALUES}.yaml" \
--kube-version "${KUBE_VERSION}" \
--namespace "default" \
--name "cert-manager" \
--set "fullnameOverride=cert-manager" \
--output-dir "${TMP_OUTPUT}"
mv "${TMP_OUTPUT}"/cert-manager/templates/*.* "${OUTPUT_DIR}/"
}
gen rbac-values "${REPO_ROOT}/docs/deploy/rbac"
gen without-rbac-values "${REPO_ROOT}/docs/deploy/without-rbac"

48
hack/verify-deploy-gen.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/..
DIFFROOT="${SCRIPT_ROOT}/docs"
TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/docs"
_tmp="${SCRIPT_ROOT}/_tmp"
cleanup() {
rm -rf "${_tmp}"
}
trap "cleanup" EXIT SIGINT
cleanup
mkdir -p "${TMP_DIFFROOT}"
cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}"
"${SCRIPT_ROOT}/hack/update-deploy-gen.sh"
echo "diffing ${DIFFROOT} against freshly deploy-gen"
ret=0
diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$?
cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}"
if [[ $ret -eq 0 ]]
then
echo "${DIFFROOT} up to date."
else
echo "${DIFFROOT} is out of date. Please run hack/update-deploy-gen.sh"
exit 1
fi