Create a Tenant

The following example manifest will create a tenant:

apiVersion: syn.tools/v1alpha1
kind: Tenant
metadata:
  name: t-aezoo6
  namespace: lieutenant
spec:
  displayName: Big Corp.
  gitRepoTemplate:
    path: tenant
    repoName: tenant1
    deletionPolicy: Delete
    apiSecretRef:
      name: lieutenant-secret
  clusterTemplate:
    gitRepoTemplate:
      apiSecretRef:
        name: lieutenant-secret
      path: cluster-catalogs
      repoName: catalog-{{ .Name }}

Please be aware that you first need to have a valid secret containing the endpoint information, see Connection to GitLab.

Tenant Templating

Values common to all new tenants, can be put into a TenantTemplate. When a new tenant gets created, the operator looks for a TenantTemplate object named default in the same namespace as Tenant. A TenantTemplate has the same spec data structure as a Tenant. If present, the template’s values from the template will be merged into the Tenant spec. The values set on the tenant will take precedence. In addition, a reference to the template will be added as an annotation. The annotation is named lieutenant.syn.tools/tenant-template, and the value will be the name of the TenantTemplate.

Cluster Templating

The spec.clusterTemplate of a tenant can contain a template which is used to set default values for clusters of this tenant. All fields of a cluster’s .spec can be set by this template if they’re not already set by the cluster itself. The fields can contain Go templates and use the data of a cluster. See the templating explanation for further details.