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

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