Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: custom kubeconfigs on checks & topology lookup #295

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions canary-checker/docs/reference/1-kubernetes-resource.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,26 @@ check would be to see if a service is accessible via the ingress as shown in the
]}
/>

### Remote clusters

A single canary-checker instance can connect to any number of remote clusters via custom kubeconfig.
Either the kubeconfig itself or the path to the kubeconfig can be provided.

#### kubeconfig from kubernetes secret

```yaml title="remote-cluster.yaml" file=../../../modules/canary-checker/fixtures/k8s/kubernetes-resource-check-kubeconfig-from-secrets.yaml {12-16}
```

#### Kubeconfig inline

```yaml title="remote-cluster.yaml" yaml title="remote-cluster.yaml" file=../../../modules/canary-checker/fixtures/k8s/kubernetes-resource-check-inline-kubeconfig.yaml {12-33}
```

#### Kubeconfig from local filesystem

```yaml title="remote-cluster.yaml" file=../../../modules/canary-checker/fixtures/k8s/kubernetes-resource-check-kubeconfig-from-file.yaml {12-13}
```

### Templating

The `resources` and `staticResources` fields can be templated using <CommonLink to="gotemplate">Go Templates</CommonLink>.
Expand Down
21 changes: 21 additions & 0 deletions canary-checker/docs/reference/1-kubernetes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,24 @@ dyn(results).all(x, k8s.isReady(x))
```
</div>
</details>


### Remote clusters

A single canary-checker instance can connect to any number of remote clusters via custom kubeconfig.
Either the kubeconfig itself or the path to the kubeconfig can be provided.

#### kubeconfig from kubernetes secret

```yaml title="remote-cluster.yaml" file=../../../modules/canary-checker/fixtures/k8s/kubernetes-check-kubeconfig-from-secrets.yaml {12-16}
```

#### Kubeconfig inline

```yaml title="remote-cluster.yaml" file=../../../modules/canary-checker/fixtures/k8s/kubernetes-check-inline-kubeconfig.yaml {11-32}
```

#### Kubeconfig from local filesystem

```yaml title="remote-cluster.yaml" file=../../../modules/canary-checker/fixtures/k8s/kubernetes-check-kubeconfig-from-file.yaml {11-12}
```
50 changes: 25 additions & 25 deletions mission-control/docs/topology/lookups/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,8 @@ title: Kubernetes

The Kubernetes component lookup fetches kubernetes resources to be used as components.

```yaml title="kube-check.yml"
---
apiVersion: canaries.flanksource.com/v1
kind: Topology
metadata:
name: kubernetes-configs
spec:
type: Config
icon: kubernetes
schedule: '@every 30s'
components:
- name: configs
icon: server
type: ConfigMap
// highlight-start
lookup:
kubernetes:
- kind: ConfigMap
display:
expr: |
dyn(results).map(c, {
'name': c.name,
'type': 'ConfigMap',
}).toJSON()
// highlight-end
```yaml title="kube-configmap-components.yaml" file=../../../modules/canary-checker/fixtures/topology/kubernetes-lookup.yaml {14-22}

```

| Field | Description | Scheme | Required |
Expand All @@ -55,3 +32,26 @@ spec:
## Results

The `results` variable in the template is itself a list of all the kubernetes resources.

## Remote clusters

A single canary-checker instance can connect to any number of remote clusters via custom kubeconfig.
Either the kubeconfig itself or the path to the kubeconfig can be provided.

### From kubernetes secret

```yaml title="remote-cluster.yaml" file=../../../modules/canary-checker/fixtures/topology/kubernetes-lookup-kubeconfig-from-secrets.yaml {23-27}

```

### Kubeconfig inline

```yaml title="remote-cluster.yaml" file=../../../modules/canary-checker/fixtures/topology/kubernetes-lookup-inline-configmap.yaml {22-48}

```

### From local filesystem

```yaml title="remote-cluster.yaml" file=../../../modules/canary-checker/fixtures/topology/kubernetes-lookup-kubeconfig-from-file.yaml {22-23}

```
2 changes: 1 addition & 1 deletion modules/duty
1 change: 1 addition & 0 deletions styles/ignore/words-with-suggestions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ keypairs
knowledgebase
knowledgebases
Kratos
kubeconfig
kubectl
Kuberhealthy
kubernetes
Expand Down
Loading