diff --git a/README.md b/README.md index 7cfacf67b..31486424b 100644 --- a/README.md +++ b/README.md @@ -37,43 +37,18 @@ You can just update the image in the webhook Deployment on an existing KIND clus make KIND_CLUSTER_NAME=<> dev.update-webhook-image-on-kind ``` -If creating an AWS cluster using the example files, you will also need to create a secret with your AWS credentials: +Generate a cluster definition from the file specified in the `--from` flag +and apply the generated resource to actually create the cluster in the API. +For example, the following command will create a Docker cluster with Cilium CNI applied via the Helm addon provider: ```shell -kubectl apply --server-side -f - < docker-kubeconfig +clusterctl get kubeconfig ${CLUSTER_NAME} > ${CLUSTER_NAME}.conf ``` If you are not on Linux, you will also need to fix the generated kubeconfig's `server`, run: ```shell -kubectl config set-cluster docker-quick-start-helm-addon-cilium \ - --kubeconfig docker-kubeconfig \ - --server=https://$(docker container port docker-quick-start-helm-addon-cilium-lb 6443/tcp) +kubectl config set-cluster ${CLUSTER_NAME} \ + --kubeconfig ${CLUSTER_NAME}.conf \ + --server=https://$(docker container port ${CLUSTER_NAME}-lb 6443/tcp) ``` Wait until all nodes are ready (this indicates that CNI has been deployed successfully): ```shell -kubectl --kubeconfig docker-kubeconfig wait nodes --all --for=condition=Ready --timeout=5m +kubectl --kubeconfig ${CLUSTER_NAME}.conf wait nodes --all --for=condition=Ready --timeout=5m ``` Show that Cilium is running successfully on the workload cluster: ```shell -kubectl --kubeconfig docker-kubeconfig get daemonsets -n kube-system cilium +kubectl --kubeconfig ${CLUSTER_NAME}.conf get daemonsets -n kube-system cilium ``` -Deploy kube-vip to provide service load-balancer: +Deploy kube-vip to provide service load-balancer functionality for Docker clusters: ```shell helm repo add --force-update kube-vip https://kube-vip.github.io/helm-charts @@ -122,29 +97,29 @@ kubectl create configmap \ --namespace kube-system kubevip \ --from-literal "range-global=${kind_subnet_prefix}100.0-${kind_subnet_prefix}100.20" \ --dry-run=client -oyaml | - kubectl --kubeconfig docker-kubeconfig apply --server-side -n kube-system -f - + kubectl --kubeconfig ${CLUSTER_NAME}.conf apply --server-side -n kube-system -f - helm upgrade kube-vip-cloud-provider kube-vip/kube-vip-cloud-provider --version 0.2.2 \ --install \ --wait --wait-for-jobs \ --namespace kube-system \ - --kubeconfig docker-kubeconfig \ + --kubeconfig ${CLUSTER_NAME}.conf \ --set-string=image.tag=v0.0.6 helm upgrade kube-vip kube-vip/kube-vip --version 0.4.2 \ --install \ --wait --wait-for-jobs \ --namespace kube-system \ - --kubeconfig docker-kubeconfig \ + --kubeconfig ${CLUSTER_NAME}.conf \ --set-string=image.tag=v0.6.0 ``` Deploy traefik as a LB service: ```shell -helm --kubeconfig docker-kubeconfig repo add traefik https://helm.traefik.io/traefik +helm --kubeconfig ${CLUSTER_NAME}.conf repo add traefik https://helm.traefik.io/traefik helm repo update &>/dev/null -helm --kubeconfig docker-kubeconfig upgrade --install traefik traefik/traefik \ +helm --kubeconfig ${CLUSTER_NAME}.conf upgrade --install traefik traefik/traefik \ --version v10.9.1 \ --wait --wait-for-jobs \ --set ports.web.hostPort=80 \ @@ -155,13 +130,13 @@ helm --kubeconfig docker-kubeconfig upgrade --install traefik traefik/traefik \ Watch for traefik LB service to get an external address: ```shell -watch -n 0.5 kubectl --kubeconfig docker-kubeconfig get service/traefik +watch -n 0.5 kubectl --kubeconfig ${CLUSTER_NAME}.conf get service/traefik ``` To delete the workload cluster, run: ```shell -kubectl delete cluster docker-quick-start-helm-addon-cilium +kubectl delete cluster ${CLUSTER_NAME} ``` Notice that the traefik service is deleted before the cluster is actually finally deleted. diff --git a/examples/capi-quick-start/aws-cluster-identity.yaml b/examples/capi-quick-start/aws-cluster-identity.yaml deleted file mode 100644 index 55a8bd851..000000000 --- a/examples/capi-quick-start/aws-cluster-identity.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AWSClusterStaticIdentity -metadata: - labels: - cluster.x-k8s.io/provider: aws - name: ${CLUSTER_NAME} -spec: - allowedNamespaces: - list: - - default - secretRef: aws-quick-start-creds diff --git a/hack/examples/bases/aws/AWSClusterStaticIdentity.yaml b/hack/examples/bases/aws/AWSClusterStaticIdentity.yaml deleted file mode 100644 index e33290f7e..000000000 --- a/hack/examples/bases/aws/AWSClusterStaticIdentity.yaml +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2023 D2iQ, Inc. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: AWSClusterStaticIdentity -metadata: - name: "quick-start" -spec: - secretRef: aws-quick-start-creds - allowedNamespaces: - list: - - "default" diff --git a/hack/examples/bases/aws/kustomization.yaml.tmpl b/hack/examples/bases/aws/kustomization.yaml.tmpl index eada07756..2506d0912 100644 --- a/hack/examples/bases/aws/kustomization.yaml.tmpl +++ b/hack/examples/bases/aws/kustomization.yaml.tmpl @@ -9,7 +9,6 @@ resources: - ./calico/helm-addon - ./cilium/crs - ./cilium/helm-addon -- AWSClusterStaticIdentity.yaml namePrefix: aws- diff --git a/hack/examples/sync.sh b/hack/examples/sync.sh index 22f97f968..d60314b49 100755 --- a/hack/examples/sync.sh +++ b/hack/examples/sync.sh @@ -19,7 +19,6 @@ mkdir -p "${EXAMPLE_CLUSTERCLASSES_DIR}" readonly EXAMPLE_CLUSTERS_DIR=examples/capi-quick-start mkdir -p "${EXAMPLE_CLUSTERS_DIR}" -mkdir -p examples/capi-quick-start # Sync ClusterClasses (including Templates) and Clusters to separate files. kustomize build ./hack/examples | tee \ @@ -95,11 +94,6 @@ kustomize build ./hack/examples | and .spec.topology.variables[0].value.addons.cni.strategy == "HelmAddon" )' >"${EXAMPLE_CLUSTERS_DIR}/aws-cluster-cilium-helm-addon.yaml" ) \ - >( - gojq --yaml-input --yaml-output 'select(.metadata.labels["cluster.x-k8s.io/provider"] == "aws" - and .kind == "AWSClusterStaticIdentity" - )' >"${EXAMPLE_CLUSTERS_DIR}/aws-cluster-identity.yaml" - ) \ >/dev/null #shellcheck disable=SC2016