1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-26 06:23:37 +00:00
catalog/task/buildkit/0.1/create-certs.sh
Shivam Mukhade eb64b91b6a Modifies buildkit task according to the new reorg proposal
Changes include:
   - adds version label
   - adds a minimum pipeline versions supported by the task
   - adds tags for task
   - modified description to add a summary

This patch moves the buildkit files to the task directory and
renames the yaml file
   - The yaml filename is changed to match the resource name.

Issue: #386

Signed-off-by: Shivam Mukhade <smukhade@redhat.com>
2020-07-10 22:06:57 +01:00

44 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# from https://github.com/moby/buildkit/tree/a038b5d98379646995275830a4f778bc707b2356/examples/kubernetes
set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
PRODUCT=buildkit
DIR=./.certs
if [[ "$#" -lt 1 ]]; then
echo "Usage: $0 SAN [SAN...]"
echo
echo "Example: $0 buildkitd.default.svc 127.0.0.1"
echo
echo "The following iles will be created under ${DIR}"
echo "- daemon/{ca.pem,cert.pem,key.pem}"
echo "- client/{ca.pem,cert.pem,key.pem}"
echo "- ${PRODUCT}-daemon-certs.yaml"
echo "- ${PRODUCT}-client-certs.yaml"
echo "- SAN"
exit 1
fi
if ! command -v mkcert >/dev/null; then
echo "Missing mkcert (https://github.com/FiloSottile/mkcert)"
exit 1
fi
SAN=$@
SAN_CLIENT=client
mkdir -p $DIR ${DIR}/daemon ${DIR}/client
(
cd $DIR
echo $SAN | tr " " "\n" >SAN
CAROOT=$(pwd) mkcert -cert-file daemon/cert.pem -key-file daemon/key.pem ${SAN} >/dev/null 2>&1
CAROOT=$(pwd) mkcert -client -cert-file client/cert.pem -key-file client/key.pem ${SAN_CLIENT} >/dev/null 2>&1
cp -f rootCA.pem daemon/ca.pem
cp -f rootCA.pem client/ca.pem
rm -f rootCA.pem rootCA-key.pem
kubectl create secret generic ${PRODUCT}-daemon-certs --dry-run -o yaml --from-file=./daemon >${PRODUCT}-daemon-certs.yaml
kubectl create secret generic ${PRODUCT}-client-certs --dry-run -o yaml --from-file=./client >${PRODUCT}-client-certs.yaml
)