3 # Copyright (c) 2019 AT&T Intellectual Property.
4 # Copyright (c) 2019 Nokia.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
20 export ENTITIES=${ENTITIES:-helm tiller}
21 export KUBECONFIG=${KUBECONFIG:-/kubeconfig}
22 export CA_DIR=${CA_DIR:-/pki}
23 if [ ! -z ${TARGET_NAMESPACE} ]; then
24 SECRET_NS="--namespace ${TARGET_NAMESPACE}"
29 if [ ! -f ${KUBECONFIG} ]; then
30 export SVCACCT_NAME=${SVCACCT_NAME:-tiller}
31 /bin/svcacct-to-kubeconfig.sh
34 if [ ! -f ${CA_DIR}/helm.key.pem -o \
35 ! -f ${CA_DIR}/tiller.key.pem ]; then
39 # i'm assuming we can just lose the CA key.
40 for entity in ${ENTITIES}; do
41 kubectl create secret generic \
42 --from-file=ca.crt=/pki/ca.cert.pem \
43 --from-file=tls.crt=/pki/${entity}.cert.pem \
44 --from-file=tls.key=/pki/${entity}.key.pem \
45 ${SECRET_NS} ${entity}
47 kubectl label secret \
48 ${SECRET_NS} ${entity} \