...

Text file src/github.com/GoogleCloudPlatform/k8s-config-connector/scripts/environment-setup/repo-setup.sh

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/scripts/environment-setup

     1#!/bin/bash
     2# Copyright 2022 Google LLC
     3#
     4# Licensed under the Apache License, Version 2.0 (the "License");
     5# you may not use this file except in compliance with the License.
     6# You may obtain a copy of the License at
     7#
     8#      http://www.apache.org/licenses/LICENSE-2.0
     9#
    10# Unless required by applicable law or agreed to in writing, software
    11# distributed under the License is distributed on an "AS IS" BASIS,
    12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13# See the License for the specific language governing permissions and
    14# limitations under the License.
    15set -o errexit
    16[[ ":$PATH:" != *":${GOPATH}/bin:"* ]] && echo "PATH=\"${GOPATH}/bin:\$PATH\"" >> ~/.profile
    17source ~/.profile
    18cd ${GOPATH}/src/github.com/GoogleCloudPlatform/k8s-config-connector
    19GOOS=$(go env GOOS)
    20GOARCH=$(go env GOARCH)
    21
    22# Downloads and configures kubebuilder
    23VERSION=$(source scripts/shared-vars-public.sh && echo ${KUBEBUILDER_VERSION})
    24curl -L -O https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${VERSION}/kubebuilder_${VERSION}_${GOOS}_${GOARCH}.tar.gz
    25tar -zxvf kubebuilder_${VERSION}_${GOOS}_${GOARCH}.tar.gz
    26sudo mv kubebuilder_${VERSION}_${GOOS}_${GOARCH} /usr/local/kubebuilder
    27[[ ":$PATH:" != *":/usr/local/kubebuilder/bin:"* ]] && echo "PATH=\"/usr/local/kubebuilder/bin:\$PATH\"" >> ~/.profile
    28source ~/.profile
    29rm -f kubebuilder_${VERSION}_${GOOS}_${GOARCH}.tar.gz
    30
    31# Downloads and configures kustomize
    32VERSION=$(source scripts/shared-vars-public.sh && echo "${KUSTOMIZE_VERSION}")
    33INSTALL_DIR=/usr/local/kustomize/bin
    34curl -O -L https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${VERSION}/kustomize_v${VERSION}_${GOOS}_${GOARCH}.tar.gz
    35tar -zxvf kustomize_v${VERSION}_${GOOS}_${GOARCH}.tar.gz
    36chmod a+x kustomize
    37sudo mkdir -p "${INSTALL_DIR}"
    38sudo mv kustomize ${INSTALL_DIR}/kustomize
    39[[ ":$PATH:" != *":${INSTALL_DIR}:"* ]] && echo "PATH=\"${INSTALL_DIR}:\$PATH\"" >> ~/.profile
    40source ~/.profile
    41rm -f kustomize_v${VERSION}_${GOOS}_${GOARCH}.tar.gz
    42
    43# Checks to make sure you have all the tools you need
    44kubebuilder version
    45kustomize version
    46etcd --version
    47KUBEAPISERVER_VERSION=$(source scripts/shared-vars-public.sh && echo "${KUBEAPISERVER_VERSION}")
    48KUBE_BIN_DIR=${HOME}/kube/bin
    49
    50# Downloads and configures kube-apiserver
    51mkdir -p $KUBE_BIN_DIR
    52curl -sL --retry 5 dl.k8s.io/v$KUBEAPISERVER_VERSION/bin/linux/amd64/kube-apiserver > $KUBE_BIN_DIR/kube-apiserver
    53chmod a+rx $KUBE_BIN_DIR/kube-apiserver
    54echo "export TEST_ASSET_KUBE_APISERVER=${HOME}/kube/bin/kube-apiserver" >> ~/.profile
    55source ~/.profile
    56
    57GREEN='\033[0;32m'
    58NC='\033[0m'
    59echo -e "${GREEN}Config Connector REPO SETUP SUCCESSFUL${NC}"

View as plain text