loft-sh / loft

Namespace & Virtual Cluster Manager for Kubernetes - Lightweight Virtual Clusters, Self-Service Provisioning for Engineers and 70% Cost Savings with Sleep Mode
https://loft.sh/docs/introduction
Other
724 stars 64 forks source link

How to apply configuration dev cluster configuration? #171

Closed withinboredom closed 2 years ago

withinboredom commented 2 years ago

I'm trying to be able to programmatically bring up a loft cluster with everything pre-configured (I'm limited to pure k8s constructs atm, but if I have to, I'll try to script with the loft-cli -- though I'm not sure it can do all of the things I want to do).

Here's the vcluster kubectl is trying to apply. I can't help but feel I'm missing something obvious...

apiVersion: management.loft.sh/v1
kind: VirtualClusterTemplate
metadata:
  name: development-cluster
spec:
  displayName: Development Cluster
  owner:
    user: roblanders
  template:
    metadata:
      annotations:
        vcluster.loft.sh/skip-translate: 'false'
    helmRelease:
      values: |-
        storage:
          size: 5Gi

        syncer:
          extraArgs:
            - --fake-persistent-volumes=false
            - --enable-storage-classes
            - --enable-priority-classes
            - --fake-nodes=false
            - --sync-all-nodes

        rbac:
          clusterRole:
            create: true
    apps:
      - name: metric-server
        namespace: kube-system
  spaceTemplateRef:
    name: dev-space
  access:
    - verbs:
        - '*'
      subresources:
        - '*'
      users:
        - '*'
status:
  apps:
    - name: metric-server
      displayName: Metric Server

However, this is the error I receive:

failed: failed to create development-cluster management.loft.sh/v1, Kind=VirtualClusterTemplate for  kube-system/dev-cluster: invalid owner. must specify user or team or leave empty"

This also happens for the space template and app as well, fwiw.

FabianKramm commented 2 years ago

@withinboredom you probably want to use the api group storage.loft.sh/v1 instead of the management.loft.sh/v1 which should not produce this error.

withinboredom commented 2 years ago

Yep, that was the bit I was missing!