pluralsh / deployment-operator

thin kubernetes agent to execute deployments of plural services
1 stars 1 forks source link

feat(agent): add vcluster crd and controller #259

Closed floreks closed 2 weeks ago

floreks commented 3 weeks ago

CRD

apiVersion: v1
kind: Namespace
metadata:
  name: vcluster
---
apiVersion: v1
kind: Secret
metadata:
  name: sebastian-vcluster-basic-console-token
  namespace: vcluster
stringData:
  token: "CHANGEME"
---
apiVersion: deployments.plural.sh/v1alpha1
kind: VirtualCluster
metadata:
  name: sebastian
  namespace: vcluster
spec:
  kubeconfigRef:
    name: vc-sebastian-vcluster-basic
  credentialsRef:
    name: sebastian-vcluster-basic-console-token
    key: token

CRD (for testing locally)

apiVersion: v1
kind: Namespace
metadata:
  name: vcluster
---
apiVersion: v1
kind: Secret
metadata:
  name: sebastian-vcluster-basic-console-token
  namespace: vcluster
stringData:
  token: "CHANGEME"
---
apiVersion: deployments.plural.sh/v1alpha1
kind: VirtualCluster
metadata:
  name: sebastian-vcluster-basic
  namespace: vcluster
spec:
  kubeconfigRef:
    name: vc-sebastian-vcluster-basic
  credentialsRef:
    name: sebastian-vcluster-basic-console-token
    key: token
  helm:
    vcluster:
      values:
        exportKubeConfig:
          server: https://localhost:8443
linear[bot] commented 3 weeks ago

PROD-2544 VirtualCluster crd

michaeljguarino commented 3 weeks ago

how do you customize the helm values for installing our agent in the cluster w/ this structure?

i think a single crd to install vcluster + agent is not a bad idea (my original thought was you'd just use a service deployment for the vcluster though), but we also need to be able to specify agent helm values and helm repository

michaeljguarino commented 3 weeks ago

Oh wait there's helm values for vcluster plus the agent, that's nice

michaeljguarino commented 3 weeks ago

I think we should still want to support separately created vclusters. So if we could add a bool field to the spec specifying maybe external and bypass the creation of the vcluster helm chart (so either people can manage that themselves, via Plural service deployment or loft.sh's tooling) they would be able to.

floreks commented 3 weeks ago

Ok, so when external flag is set then we only upsert to the API, install the agent using provided kubeconfig ref and skip the vcluster chart installation?

michaeljguarino commented 3 weeks ago

Ok, so when external flag is set then we only upsert to the API, install the agent using provided kubeconfig ref and skip the vcluster chart installation?

Yeah precisely