Skip to content

Commit

Permalink
Fix indent.
Browse files Browse the repository at this point in the history
  • Loading branch information
bigkevmcd committed Jul 25, 2023
1 parent 97e09bd commit 0622dfb
Show file tree
Hide file tree
Showing 15 changed files with 647 additions and 663 deletions.
86 changes: 43 additions & 43 deletions website/docs/cluster-management/managing-clusters-without-capi.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,49 +106,49 @@ Here's how to create a kubeconfig secret.
<details><summary>Expand to see script</summary>

```bash title="static-kubeconfig.sh"
#!/bin/bash

if [[ -z "$CLUSTER_NAME" ]]; then
echo "Ensure CLUSTER_NAME has been set"
exit 1
fi

if [[ -z "$CA_CERTIFICATE" ]]; then
echo "Ensure CA_CERTIFICATE has been set to the path of the CA certificate"
exit 1
fi

if [[ -z "$ENDPOINT" ]]; then
echo "Ensure ENDPOINT has been set"
exit 1
fi

if [[ -z "$TOKEN" ]]; then
echo "Ensure TOKEN has been set"
exit 1
fi

export CLUSTER_CA_CERTIFICATE=$(cat "$CA_CERTIFICATE" | base64)

envsubst <<EOF
apiVersion: v1
kind: Config
current-context: $CLUSTER_NAME
clusters:
- name: $CLUSTER_NAME
cluster:
server: https://$ENDPOINT
certificate-authority-data: $CLUSTER_CA_CERTIFICATE
users:
- name: $CLUSTER_NAME
user:
token: $TOKEN
contexts:
- name: $CLUSTER_NAME
context:
cluster: $CLUSTER_NAME
user: $CLUSTER_NAME
EOF
#!/bin/bash

if [[ -z "$CLUSTER_NAME" ]]; then
echo "Ensure CLUSTER_NAME has been set"
exit 1
fi

if [[ -z "$CA_CERTIFICATE" ]]; then
echo "Ensure CA_CERTIFICATE has been set to the path of the CA certificate"
exit 1
fi

if [[ -z "$ENDPOINT" ]]; then
echo "Ensure ENDPOINT has been set"
exit 1
fi

if [[ -z "$TOKEN" ]]; then
echo "Ensure TOKEN has been set"
exit 1
fi

export CLUSTER_CA_CERTIFICATE=$(cat "$CA_CERTIFICATE" | base64)

envsubst <<EOF
apiVersion: v1
kind: Config
current-context: $CLUSTER_NAME
clusters:
- name: $CLUSTER_NAME
cluster:
server: https://$ENDPOINT
certificate-authority-data: $CLUSTER_CA_CERTIFICATE
users:
- name: $CLUSTER_NAME
user:
token: $TOKEN
contexts:
- name: $CLUSTER_NAME
context:
cluster: $CLUSTER_NAME
user: $CLUSTER_NAME
EOF
```
</details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,51 +100,50 @@ TOKEN=$(kubectl get secret demo-01-token-gqz7p -o jsonpath={.data.token} | base6

We'll use a helper script to generate the kubeconfig, save this into `static-kubeconfig.sh`:

```bash title="static-kubeconfig.sh"
#!/bin/bash

if [[ -z "$CLUSTER_NAME" ]]; then
echo "Ensure CLUSTER_NAME has been set"
exit 1
fi

if [[ -z "$CA_CERTIFICATE" ]]; then
echo "Ensure CA_CERTIFICATE has been set to the path of the CA certificate"
exit 1
fi

if [[ -z "$ENDPOINT" ]]; then
echo "Ensure ENDPOINT has been set"
exit 1
fi

if [[ -z "$TOKEN" ]]; then
echo "Ensure TOKEN has been set"
exit 1
fi

export CLUSTER_CA_CERTIFICATE=$(cat "$CA_CERTIFICATE" | base64)

envsubst <<EOF
apiVersion: v1
kind: Config
clusters:
- name: $CLUSTER_NAME
cluster:
server: https://$ENDPOINT
certificate-authority-data: $CLUSTER_CA_CERTIFICATE
users:
- name: $CLUSTER_NAME
user:
token: $TOKEN
contexts:
- name: $CLUSTER_NAME
context:
cluster: $CLUSTER_NAME
user: $CLUSTER_NAME
current-context: $CLUSTER_NAME
EOF
```bash title="static-kubeconfig.sh"
#!/bin/bash

if [[ -z "$CLUSTER_NAME" ]]; then
echo "Ensure CLUSTER_NAME has been set"
exit 1
fi

if [[ -z "$CA_CERTIFICATE" ]]; then
echo "Ensure CA_CERTIFICATE has been set to the path of the CA certificate"
exit 1
fi

if [[ -z "$ENDPOINT" ]]; then
echo "Ensure ENDPOINT has been set"
exit 1
fi

if [[ -z "$TOKEN" ]]; then
echo "Ensure TOKEN has been set"
exit 1
fi

export CLUSTER_CA_CERTIFICATE=$(cat "$CA_CERTIFICATE" | base64)

envsubst <<EOF
apiVersion: v1
kind: Config
current-context: $CLUSTER_NAME
clusters:
- name: $CLUSTER_NAME
cluster:
server: https://$ENDPOINT
certificate-authority-data: $CLUSTER_CA_CERTIFICATE
users:
- name: $CLUSTER_NAME
user:
token: $TOKEN
contexts:
- name: $CLUSTER_NAME
context:
cluster: $CLUSTER_NAME
user: $CLUSTER_NAME
EOF
```
For the next step, the cluster certificate (CA) is needed. How you get hold of the certificate depends on the cluster. For GKE you can view it on the GCP Console: Cluster->Details->Endpoint->”Show cluster certificate”. You will need to copy the contents of the certificate into the `ca.crt` file used below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,51 +100,50 @@ TOKEN=$(kubectl get secret demo-01-token-gqz7p -o jsonpath={.data.token} | base6

We'll use a helper script to generate the kubeconfig, save this into `static-kubeconfig.sh`:

```bash title="static-kubeconfig.sh"
#!/bin/bash

if [[ -z "$CLUSTER_NAME" ]]; then
echo "Ensure CLUSTER_NAME has been set"
exit 1
fi

if [[ -z "$CA_CERTIFICATE" ]]; then
echo "Ensure CA_CERTIFICATE has been set to the path of the CA certificate"
exit 1
fi

if [[ -z "$ENDPOINT" ]]; then
echo "Ensure ENDPOINT has been set"
exit 1
fi

if [[ -z "$TOKEN" ]]; then
echo "Ensure TOKEN has been set"
exit 1
fi

export CLUSTER_CA_CERTIFICATE=$(cat "$CA_CERTIFICATE" | base64)

envsubst <<EOF
apiVersion: v1
kind: Config
clusters:
- name: $CLUSTER_NAME
cluster:
server: https://$ENDPOINT
certificate-authority-data: $CLUSTER_CA_CERTIFICATE
users:
- name: $CLUSTER_NAME
user:
token: $TOKEN
contexts:
- name: $CLUSTER_NAME
context:
cluster: $CLUSTER_NAME
user: $CLUSTER_NAME
current-context: $CLUSTER_NAME
EOF
```bash title="static-kubeconfig.sh"
#!/bin/bash

if [[ -z "$CLUSTER_NAME" ]]; then
echo "Ensure CLUSTER_NAME has been set"
exit 1
fi

if [[ -z "$CA_CERTIFICATE" ]]; then
echo "Ensure CA_CERTIFICATE has been set to the path of the CA certificate"
exit 1
fi

if [[ -z "$ENDPOINT" ]]; then
echo "Ensure ENDPOINT has been set"
exit 1
fi

if [[ -z "$TOKEN" ]]; then
echo "Ensure TOKEN has been set"
exit 1
fi

export CLUSTER_CA_CERTIFICATE=$(cat "$CA_CERTIFICATE" | base64)

envsubst <<EOF
apiVersion: v1
kind: Config
clusters:
- name: $CLUSTER_NAME
cluster:
server: https://$ENDPOINT
certificate-authority-data: $CLUSTER_CA_CERTIFICATE
users:
- name: $CLUSTER_NAME
user:
token: $TOKEN
contexts:
- name: $CLUSTER_NAME
context:
cluster: $CLUSTER_NAME
user: $CLUSTER_NAME
current-context: $CLUSTER_NAME
EOF
```
For the next step, the cluster certificate (CA) is needed. How you get hold of the certificate depends on the cluster. For GKE you can view it on the GCP Console: Cluster->Details->Endpoint->”Show cluster certificate”. You will need to copy the contents of the certificate into the `ca.crt` file used below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,50 +108,49 @@ kubectl create secret generic demo-01-kubeconfig \
<details><summary>Expand to see script</summary>

```bash title="static-kubeconfig.sh"
#!/bin/bash

if [[ -z "$CLUSTER_NAME" ]]; then
echo "Ensure CLUSTER_NAME has been set"
exit 1
fi

if [[ -z "$CA_CERTIFICATE" ]]; then
echo "Ensure CA_CERTIFICATE has been set to the path of the CA certificate"
exit 1
fi

if [[ -z "$ENDPOINT" ]]; then
echo "Ensure ENDPOINT has been set"
exit 1
fi

if [[ -z "$TOKEN" ]]; then
echo "Ensure TOKEN has been set"
exit 1
fi

export CLUSTER_CA_CERTIFICATE=$(cat "$CA_CERTIFICATE" | base64)

envsubst <<EOF
apiVersion: v1
kind: Config
clusters:
- name: $CLUSTER_NAME
cluster:
server: https://$ENDPOINT
certificate-authority-data: $CLUSTER_CA_CERTIFICATE
users:
- name: $CLUSTER_NAME
user:
token: $TOKEN
contexts:
- name: $CLUSTER_NAME
context:
cluster: $CLUSTER_NAME
user: $CLUSTER_NAME
current-context: $CLUSTER_NAME
EOF
#!/bin/bash

if [[ -z "$CLUSTER_NAME" ]]; then
echo "Ensure CLUSTER_NAME has been set"
exit 1
fi

if [[ -z "$CA_CERTIFICATE" ]]; then
echo "Ensure CA_CERTIFICATE has been set to the path of the CA certificate"
exit 1
fi

if [[ -z "$ENDPOINT" ]]; then
echo "Ensure ENDPOINT has been set"
exit 1
fi

if [[ -z "$TOKEN" ]]; then
echo "Ensure TOKEN has been set"
exit 1
fi

export CLUSTER_CA_CERTIFICATE=$(cat "$CA_CERTIFICATE" | base64)

envsubst <<EOF
apiVersion: v1
kind: Config
current-context: $CLUSTER_NAME
clusters:
- name: $CLUSTER_NAME
cluster:
server: https://$ENDPOINT
certificate-authority-data: $CLUSTER_CA_CERTIFICATE
users:
- name: $CLUSTER_NAME
user:
token: $TOKEN
contexts:
- name: $CLUSTER_NAME
context:
cluster: $CLUSTER_NAME
user: $CLUSTER_NAME
EOF
```
</details>
Expand Down
Loading

0 comments on commit 0622dfb

Please sign in to comment.