github.com/cilium/cilium@v1.16.2/test/controlplane/services/nodeport/generate.sh (about)

     1  #!/usr/bin/env bash
     2  #
     3  # Generate the golden test files for the NodePort test.
     4  # Reuses kind configs from the dual-stack test.
     5  #
     6  
     7  set -eux
     8  
     9  dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
    10  
    11  . "${dir}/../../k8s_versions.sh"
    12  
    13  export KUBECONFIG="${dir}/kubeconfig"
    14  
    15  for version in ${versions[*]}; do
    16      mkdir -p "${dir}/v${version}"
    17  
    18      : Start a kind cluster
    19      kind create cluster --config "${dir}/../dualstack/manifests/kind-config-${version}.yaml" --name nodeport
    20  
    21      : Wait for service account to be created
    22      until kubectl get serviceaccount/default; do
    23          sleep 5
    24      done
    25  
    26      : Preloading images
    27      kind load --name nodeport docker-image "${cilium_container_repo}/${cilium_container_image}:${cilium_version}" || true
    28      kind load --name nodeport docker-image "${cilium_container_repo}/${cilium_operator_container_image}:${cilium_version}" || true || true
    29  
    30      : Install cilium
    31      cilium install --wait
    32  
    33      : Dump the initial state
    34      kubectl get nodes,ciliumnodes,services,endpoints,endpointslices -o yaml > "${dir}/v${version}/init.yaml"
    35  
    36      : Apply the manifest
    37      kubectl create namespace test
    38      kubectl apply -f "${dir}/manifests/nodeport.yaml"
    39  
    40      : Wait for all pods
    41      kubectl wait -n test --for=condition=ready --timeout=60s --all pods
    42  
    43      : Dump the services and endpoints
    44      kubectl get -n test services,endpoints,endpointslices,pods -o yaml > "${dir}/v${version}/state1.yaml"
    45  
    46      : Tear down the cluster
    47      kind delete clusters nodeport
    48      rm -f "${KUBECONFIG}"
    49  
    50  done