github.com/crossplane-contrib/function-cue@v0.2.2-0.20240508161918-5100fcb5a058/hacking/setup-aws-providers.sh (about)

     1  #!/bin/bash
     2  
     3  set -euo pipefail
     4  
     5  SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
     6  source "${SCRIPT_DIR}/.env"
     7  
     8  if [[ "${XP_PROVIDER_AWS_CONFIGURE}" != "true" ]]
     9  then
    10    echo "AWS providers will not be set up since you have opted out"
    11    exit 0
    12  fi
    13  
    14  XP_PROVIDER_AWS_VERSION=${XP_PROVIDER_AWS_VERSION:-v0.46.0}
    15  
    16  echo "Applying AWS providers"
    17  ${RUN_KUBECTL} apply -f - <<EOF
    18  apiVersion: pkg.crossplane.io/v1
    19  kind: Provider
    20  metadata:
    21    name: provider-aws-s3
    22    labels:
    23      app.kubernetes.io/component: crossplane-aws-provider
    24  spec:
    25    package: xpkg.upbound.io/upbound/provider-aws-s3:${XP_PROVIDER_AWS_VERSION}
    26  EOF
    27  
    28  ${RUN_KUBECTL} apply -f - <<EOF
    29  apiVersion: pkg.crossplane.io/v1
    30  kind: Provider
    31  metadata:
    32    name: provider-aws-iam
    33    labels:
    34      app.kubernetes.io/component: crossplane-aws-provider
    35  spec:
    36    package: xpkg.upbound.io/upbound/provider-aws-iam:${XP_PROVIDER_AWS_VERSION}
    37  EOF
    38  
    39  echo "Waiting for the crossplane AWS providers to be ready. This could take some minutes..."
    40  ${RUN_KUBECTL} wait --timeout=600s --for=condition=Healthy providers.pkg.crossplane.io -l app.kubernetes.io/component=crossplane-aws-provider
    41  
    42  echo apply aws provider config
    43  kubectl apply -f - <<EOF
    44  apiVersion: aws.upbound.io/v1beta1
    45  kind: ProviderConfig
    46  metadata:
    47    name: default
    48  spec:
    49    credentials:
    50      secretRef:
    51        key: creds
    52        name: aws-default
    53        namespace: ${XP_CROSSPLANE_NS}
    54      source: Secret
    55  EOF
    56