Skip to content

Commit

Permalink
Merge pull request #188 from zerbitx/ryanswanson/doc-193-documentatio…
Browse files Browse the repository at this point in the history
…n-for-the-virtualclusterinstancekubeconfig-api

Update kubeconfig docs to POST instead of GET
  • Loading branch information
deniseschannon authored Jul 16, 2024
2 parents 07a3391 + f3c84be commit aeb2ea9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 42 deletions.
4 changes: 2 additions & 2 deletions hack/platform/partials/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func main() {
Kind: "VirtualClusterInstanceKubeConfig",
APIVersion: managementv1.SchemeGroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{},
ObjectMeta: metav1.ObjectMeta{Namespace: "your-namespace"},
Spec: managementv1.VirtualClusterInstanceKubeConfigSpec{},
Status: managementv1.VirtualClusterInstanceKubeConfigStatus{
KubeConfig: `apiVersion: v1
Expand All @@ -81,7 +81,7 @@ clusters:
...`,
},
},
SubResourceGet: true,
SubResourceCreate: true,
SubResourceGetDescription: "If ingress endpoint is configured for the virtual cluster, you can retrieve the kube config for a virtual cluster like shown below.",
})

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'



<Tabs
defaultValue="curl"
values={[
{label: 'curl', value: 'curl'},
]}>
<TabItem value="curl">


Create a file `object.yaml` with the following contents:
```yaml
apiVersion: management.loft.sh/v1
kind: VirtualClusterInstanceKubeConfig
metadata:
creationTimestamp: null
namespace: your-namespace
spec: {}
status:
kubeConfig: |-
apiVersion: v1
kind: Config
clusters:
- cluster:
...
```
Then run the following curl command:
```bash
# Exchange my-object in the url below with the name of the Virtual Cluster Kube Config
curl -s -X POST --insecure \
"https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/namespaces/your-namespace/virtualclusterinstances/my-object/kubeconfig" \
--data-binary "$(cat object.yaml)" \
-H "Content-Type: application/yaml" \
-H "Authorization: Bearer $ACCESS_KEY"
```
</TabItem>
</Tabs>

This file was deleted.

7 changes: 4 additions & 3 deletions platform/api/resources/virtualclusterinstance/kubeconfig.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Retrieve Kube Config (Ingress)
sidebar_label: Retrieve Kube Config (Ingress)
---
import Reference from "../../_partials/resources/virtualclusterinstances/kubeconfig/reference.mdx"
import SubResourceGet from "../../_partials/resources/virtualclusterinstances/kubeconfig/subresourceget.mdx"
import SubResourceCreate from "../../_partials/resources/virtualclusterinstances/kubeconfig/subresourcecreate.mdx"

If ingress endpoint is configured for the virtual cluster, you can retrieve the kube config for the virtual cluster through this endpoint

Expand All @@ -15,6 +15,7 @@ apiVersion: management.loft.sh/v1
kind: VirtualClusterInstanceKubeConfig
metadata:
creationTimestamp: null
namespace: your-namespace
spec: {}
status:
kubeConfig: |-
Expand All @@ -30,8 +31,8 @@ status:
<Reference />
## Virtual Cluster Kube Config (Get)
## Virtual Cluster Kube Config (Create)
<SubResourceGet />
<SubResourceCreate />

0 comments on commit aeb2ea9

Please sign in to comment.