ves-io-schema-k8s_cluster-API-Create

Examples of creating k8s_cluster

Usecase:

Create k8s cluster for a site

Request using vesctl:

vesctl configuration create k8s_cluster -i k8s_cluster.yaml

where file k8scluster.yaml has following contents (k8scluster.CreateRequest):

metadata:
  name: k8s-cluster-1
  namespace: system
spec:
  localAccessConfig:
    defaultPort: {}
    localDomain: example.com
  noClusterWideApps: {}
  noGlobalAccess: {}
  noInsecureRegistries: {}
  useDefaultClusterRoleBindings: {}
  useDefaultClusterRoles: {}
  useDefaultPsp: {}

vesctl yaml response:

metadata:
  annotations: {}
  labels: {}
  name: k8s-cluster-1
  namespace: system
spec:
  localAccessConfig:
    defaultPort: {}
    localDomain: example.com
  noClusterWideApps: {}
  noGlobalAccess: {}
  noInsecureRegistries: {}
  useDefaultClusterRoleBindings: {}
  useDefaultClusterRoles: {}
  useDefaultPsp: {}
systemMetadata:
  creationTimestamp: "2021-08-25T09:03:11.801239769Z"
  creatorClass: examplesvc
  creatorId: examplesvc
  finalizers: []
  tenant: acmecorp
  uid: eb168630-9a52-43c3-be0a-9a5aa82fdfe5

Request using curl:

curl -X 'POST' -d '{"metadata":{"name":"k8s-cluster-1","namespace":"system"},"spec":{"localAccessConfig":{"localDomain":"example.com","defaultPort":{}},"noGlobalAccess":{},"useDefaultPsp":{},"useDefaultClusterRoles":{},"useDefaultClusterRoleBindings":{},"noClusterWideApps":{},"noInsecureRegistries":{}}}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build970361017_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/config/namespaces/system/k8s_clusters'

curl response:

HTTP/1.1 200 OK
Content-Length: 934
Content-Type: application/json
Date: Wed, 25 Aug 2021 09:03:11 GMT
Vary: Accept-Encoding

{
  "metadata": {
    "name": "k8s-cluster-1",
    "namespace": "system",
    "labels": {
    },
    "annotations": {
    },
    "description": "",
    "disable": false
  },
  "system_metadata": {
    "uid": "eb168630-9a52-43c3-be0a-9a5aa82fdfe5",
    "creation_timestamp": "2021-08-25T09:03:11.801239769Z",
    "deletion_timestamp": null,
    "modification_timestamp": null,
    "initializers": null,
    "finalizers": [
    ],
    "tenant": "acmecorp",
    "creator_class": "examplesvc",
    "creator_id": "examplesvc",
    "object_index": 0,
    "owner_view": null
  },
  "spec": {
    "local_access_config": {
      "local_domain": "example.com",
      "default_port": {

      }
    },
    "no_global_access": {

    },
    "use_default_psp": {

    },
    "use_default_cluster_roles": {

    },
    "use_default_cluster_role_bindings": {

    },
    "no_cluster_wide_apps": {

    },
    "no_insecure_registries": {

    }
  }
}