github.com/verrazzano/verrazzano@v1.7.1/tests/e2e/config/scripts/install-metallb.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright (c) 2021, 2023, Oracle and/or its affiliates.
     4  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     5  #
     6  
     7  set -e
     8  
     9  ADDRESS_RANGE=${1:-"172.18.0.230-172.18.0.254"}
    10  CLUSTER_NAME=${CLUSTER_NAME:-verrazzano}
    11  
    12  # Kind load the MetalLB images
    13  # We should ignore these errors because they are not blocking for most pipelines
    14  kind load docker-image quay.io/metallb/controller:v0.13.7 --name "${CLUSTER_NAME}" || true
    15  kind load docker-image quay.io/metallb/speaker:v0.13.7 --name "${CLUSTER_NAME}" || true
    16  
    17  # Apply the MetalLB manifest
    18  if [ -f "$HOME"/metallb-native.yaml ] ; then
    19    kubectl apply -f "$HOME"/metallb-native.yaml --wait=true
    20  else
    21    wget https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml
    22    sed -i -e "s|log-level=info|log-level=debug|g" metallb-native.yaml
    23    sed -i -e "s|failureThreshold: 3|failureThreshold: 6|g" metallb-native.yaml
    24    kubectl apply -f metallb-native.yaml --wait=true
    25  fi
    26  
    27  sleep 5 # wait a few before checking the status, sometimes we get some resource errors on MacOS if we check too soon
    28  kubectl rollout status -n metallb-system deployment controller --timeout=600s
    29  kubectl rollout status -n metallb-system daemonset speaker --timeout=600s
    30  
    31  kubectl set resources daemonset -n metallb-system speaker --limits memory=256Mi,cpu=200m
    32  
    33  # Create the IPAddressPool for the cluster
    34  kubectl apply -f - <<-EOF
    35  apiVersion: metallb.io/v1beta1
    36  kind: IPAddressPool
    37  metadata:
    38    name: vzlocalpool
    39    namespace: metallb-system
    40  spec:
    41    addresses:
    42    - ${ADDRESS_RANGE}
    43  EOF
    44  
    45  # Create the L2Advertisment resource for the cluster
    46  kubectl apply -f - <<-EOF
    47  apiVersion: metallb.io/v1beta1
    48  kind: L2Advertisement
    49  metadata:
    50    name: vzmetallb
    51    namespace: metallb-system
    52  spec:
    53    ipAddressPools:
    54    - vzlocalpool
    55  EOF
    56