Skip to content

Commit 4e02511

Browse files
author
Dmitri Kozlov
committed
Add CRD file
1 parent bfd8217 commit 4e02511

1 file changed

Lines changed: 124 additions & 0 deletions

File tree

crd.yaml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
# name must match the spec fields below, and be in the form: <plural>.<group>
5+
name: tenants.mobius.digitaled.com
6+
spec:
7+
# group name to use for REST API: /apis/<group>/<version>
8+
group: mobius.digitaled.com
9+
# list of versions supported by this CustomResourceDefinition
10+
versions:
11+
- name: v1beta1
12+
# Each version can be enabled/disabled by Served flag.
13+
served: true
14+
# One and only one version must be marked as the storage version.
15+
storage: true
16+
schema:
17+
openAPIV3Schema:
18+
type: object
19+
required:
20+
- spec
21+
properties:
22+
spec:
23+
type: object
24+
required:
25+
- tenantId
26+
- hostname
27+
- appVersion
28+
- uuid
29+
- conn
30+
- pl
31+
properties:
32+
replicas:
33+
type: integer
34+
default: 1
35+
# As stated below, this may not make any sense in our multi-tenant world, but I'd rather
36+
# put the infrastructure in place in case we have to go down this road later. If we don't,
37+
# then this will effectivley just be ignored.
38+
description: "How many replicas of the current tenant are to be deployed"
39+
tenantId:
40+
type: string
41+
pattern: '^[a-z][a-z0-9-]{1,24}[a-z0-9]$'
42+
description: "The tenant identifier"
43+
hostname:
44+
type: string
45+
# This is actually a really difficult value to apply a regex to reliably
46+
description: "The tenant hostname, usually <tenant_id>.mobius.cloud"
47+
appVersion:
48+
type: string
49+
pattern: '^[a-f0-9]+$|^20(19|2[0-9]).[0-9]+(.[0-9]+)?-((dev|rel|rc[0-9]+)-)?([a-f0-9]+)$'
50+
description: "The tenant Möbius application version"
51+
uuid:
52+
type: string
53+
# uuid v4
54+
pattern: '^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89AB][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
55+
format: uuid
56+
description: "The tenant's UUID"
57+
conn:
58+
type: object
59+
x-kubernetes-preserve-unknown-fields: true # This prevents k8s from pruning away any unknown JSON
60+
description: "The tenant's database connection settings"
61+
pl:
62+
type: object
63+
x-kubernetes-preserve-unknown-fields: true
64+
description: "The tenant's private labelling settings"
65+
props:
66+
type: object
67+
x-kubernetes-preserve-unknown-fields: true
68+
description: "The tenant's system property settings"
69+
status:
70+
type: object
71+
x-kubernetes-preserve-unknown-fields: true
72+
properties:
73+
replicas:
74+
type: integer
75+
labelSelector:
76+
type: string
77+
subresources:
78+
# status enables the status subresource.
79+
status: {}
80+
# scale enables the scale subresource. They may not make any sense in our MT world, but
81+
# I'd rather have it available now in case there are ways we can "scale" a tenant.
82+
scale:
83+
# specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.
84+
specReplicasPath: .spec.replicas
85+
# statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.
86+
statusReplicasPath: .status.replicas
87+
# labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.
88+
labelSelectorPath: .status.labelSelector
89+
additionalPrinterColumns:
90+
- name: ID
91+
type: string
92+
description: "The tenant ID"
93+
jsonPath: .spec.tenantId
94+
- name: Hostname
95+
type: string
96+
description: "The tenant hostname"
97+
jsonPath: .spec.hostname
98+
- name: Release
99+
type: string
100+
description: "The tenant Möbius application version"
101+
jsonPath: .spec.appVersion
102+
- name: UUID
103+
type: string
104+
description: "The tenant Möbius UUID"
105+
jsonPath: .spec.uuid
106+
- name: Status
107+
type: string
108+
description: "The tenant provisioning status"
109+
jsonPath: .status.prov_status
110+
- name: Age
111+
type: date
112+
jsonPath: .metadata.creationTimestamp
113+
# either Namespaced or Cluster
114+
scope: Namespaced
115+
names:
116+
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
117+
plural: tenants
118+
# singular name to be used as an alias on the CLI and for display
119+
singular: tenant
120+
# kind is normally the CamelCased singular type. Your resource manifests use this.
121+
kind: Tenant
122+
# shortNames allow shorter string to match your resource on the CLI
123+
shortNames:
124+
- tnnt

0 commit comments

Comments
 (0)