github.com/m3db/m3@v1.5.0/scripts/vagrant/provision/setup_kube.sh (about)

     1  #!/bin/bash
     2  
     3  set -xe
     4  
     5  # Expects the following installed:
     6  # - docker
     7  # - kubectl
     8  # - kind
     9  # - curl
    10  # - jq
    11  
    12  # Create cluster
    13  kind create cluster --config ./manifests/kind-kube-cluster.yaml
    14  
    15  # Apply common kube manifests
    16  kubectl apply -f ./kube/sysctl-daemonset.yaml
    17  
    18  # Create dedicated m3coordinator 2x
    19  kubectl apply -f ./manifests/m3coordinator-two.yaml
    20  
    21  # Deploy single node etcd
    22  kubectl apply -f ./manifests/etcd-single.yaml
    23  
    24  # Deploy operator
    25  kubectl apply -f ./manifests/operator.yaml
    26  
    27  # Populate the feature branch docker image
    28  perl -pi -e "s/FEATURE_DOCKER_IMAGE/${FEATURE_DOCKER_IMAGE//\//\\/}/" ./manifests/m3db-secondary.yaml
    29  
    30  # Create test cluster (sometimes the CRD not recognized, repeat attempts)
    31  set +x
    32  echo "Creating test cluster "
    33  while true; do
    34      if kubectl apply -f ./manifests/m3db-$MACHINE.yaml; then
    35          printf "\n"
    36          break
    37      fi
    38      sleep 2
    39      printf "."
    40  done
    41  set -x
    42  
    43  # Comment out the set +x and consequent set -x to debug the wait script
    44  set +x
    45  echo "Waiting for cluster to come up"
    46  while true; do
    47      if kubectl exec -it test-cluster-rep0-0 -- sh -c "(which curl || apk add curl) && curl http://localhost:9002/bootstrapped"; then
    48          printf "\n"
    49          break
    50      fi
    51      sleep 2
    52      printf "."
    53  done
    54  set -x
    55  
    56  # Manifests for Operator (prom, grafana, etc)
    57  set +x
    58  echo "Applying Prometheus operator manifests"
    59  while true; do
    60      if kubectl apply -f ./manifests/kube-prometheus; then
    61          printf "\n"
    62          break
    63      fi
    64      sleep 2
    65      printf "."
    66  done
    67  set -x
    68  
    69  # ServiceMonitor CRD for M3DB monitoring
    70  kubectl apply -f ./manifests/prometheus-servicemonitor-dbnode.yaml
    71  # ServiceMonitor CRD for M3Coordinator monitoring
    72  kubectl apply -f ./manifests/prometheus-servicemonitor-coordinator.yaml
    73  
    74  # Ready load generator (but don't scale up yet)
    75  kubectl apply -f ./manifests/promremotebench-zero.yaml