k8s.io/kubernetes@v1.31.0-alpha.0.0.20240520171757-56147500dadc/test/kubemark/skeleton/util.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Copyright 2017 The Kubernetes Authors.
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #     http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  # This script contains the helper functions that each provider hosting
    18  # Kubermark must implement to use test/kubemark/start-kubemark.sh and
    19  # test/kubemark/stop-kubemark.sh scripts.
    20  
    21  # This function should authenticate docker to be able to read/write to
    22  # the right container registry (needed for pushing kubemark image).
    23  function authenticate-docker {
    24  	echo "Configuring registry authentication" 1>&2
    25  }
    26  
    27  # This function should create kubemark master and write kubeconfig to
    28  # "${RESOURCE_DIRECTORY}/kubeconfig.kubemark".
    29  # If a cluster uses private master IP, create-kubemark-master might also write
    30  # a second kubeconfig to "${RESOURCE_DIRECTORY}/kubeconfig-internal.kubemark".
    31  # The difference between these two kubeconfigs is that the internal one uses
    32  # private master IP, which might be better suited for setting up hollow nodes.
    33  function create-kubemark-master {
    34    echo "Creating cluster..."
    35  }
    36  
    37  # This function should delete kubemark master.
    38  function delete-kubemark-master {
    39    echo "Deleting cluster..."
    40  }
    41  
    42  # This function should return node labels.
    43  function calculate-node-labels {
    44    echo ""
    45  }
    46  
    47  # Common colors used throughout the kubemark scripts
    48  if [[ -z "${color_start-}" ]]; then
    49    declare -r color_start="\033["
    50    # shellcheck disable=SC2034
    51    declare -r color_red="${color_start}0;31m"
    52    # shellcheck disable=SC2034
    53    declare -r color_yellow="${color_start}0;33m"
    54    # shellcheck disable=SC2034
    55    declare -r color_green="${color_start}0;32m"
    56    # shellcheck disable=SC2034
    57    declare -r color_blue="${color_start}1;34m"
    58    # shellcheck disable=SC2034
    59    declare -r color_cyan="${color_start}1;36m"
    60    # shellcheck disable=SC2034
    61    declare -r color_norm="${color_start}0m"
    62  fi