Skip to content

Commit 6587e0e

Browse files
committed
feat: crd definition
1 parent c2f5fc0 commit 6587e0e

File tree

2 files changed

+192
-0
lines changed

2 files changed

+192
-0
lines changed

crd.yaml

+159
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: channels.spongeprojects.com
5+
labels:
6+
group: spongeprojects
7+
project: kubebigbrother
8+
spec:
9+
group: spongeprojects.com
10+
names:
11+
plural: channels
12+
singular: channel
13+
kind: Channel
14+
scope: Cluster
15+
versions:
16+
- name: v1alpha1
17+
served: true
18+
storage: true
19+
schema:
20+
openAPIV3Schema:
21+
type: object
22+
properties:
23+
spec:
24+
x-kubernetes-preserve-unknown-fields: true
25+
description: "spec contains type and detailed config of a channel, unknown fields are preserved"
26+
type: object
27+
properties:
28+
type:
29+
description: "type is type of channel, some supported values: slack, flock, telegram"
30+
type: string
31+
additionalPrinterColumns:
32+
- name: Type
33+
type: string
34+
description: Type
35+
jsonPath: .spec.type
36+
---
37+
apiVersion: apiextensions.k8s.io/v1
38+
kind: CustomResourceDefinition
39+
metadata:
40+
name: watchers.spongeprojects.com
41+
labels:
42+
group: spongeprojects
43+
project: kubebigbrother
44+
spec:
45+
group: spongeprojects.com
46+
names:
47+
plural: watchers
48+
singular: watcher
49+
kind: Watcher
50+
scope: Namespaced
51+
versions:
52+
- name: v1alpha1
53+
served: true
54+
storage: true
55+
schema:
56+
openAPIV3Schema:
57+
type: object
58+
properties:
59+
spec:
60+
type: object
61+
properties:
62+
resource:
63+
description: "resource is the name of the resource to watch, example: deploy, deployments, deployments.apps, deployments.v1.apps"
64+
type: string
65+
noticeWhenAdded:
66+
description: "noticeWhenAdded is a flag to enable notification when a resource has been added to the cluster"
67+
type: boolean
68+
noticeWhenDeleted:
69+
description: "noticeWhenDeleted is a flag to enable notification when a resource has been deleted from the cluster"
70+
type: boolean
71+
noticeWhenUpdated:
72+
description: "noticeWhenUpdated is a flag to enable notification when a resource has been updated in the cluster"
73+
type: boolean
74+
updateOn:
75+
description: "updateOn is an array of fields to trigger UPDATED notification, when no field in updateOn is changed, no notification will be sent, example: [.data, .spec.replicas]"
76+
type: array
77+
items:
78+
type: string
79+
channelNames:
80+
description: "channelNames is an array of channel names, reference to Channel resources"
81+
type: array
82+
items:
83+
type: string
84+
resyncPeriod:
85+
description: "resyncPeriod for this informer instance, example: 12h, 1d"
86+
type: string
87+
workers:
88+
description: "workers is the number of workers for this informer instance, default to 3"
89+
type: integer
90+
maxRetries:
91+
description: "maxRetries is the max number of retries for this informer instance, default to 3"
92+
type: integer
93+
additionalPrinterColumns:
94+
- name: Resource
95+
type: string
96+
description: Resource
97+
jsonPath: .spec.resource
98+
---
99+
apiVersion: apiextensions.k8s.io/v1
100+
kind: CustomResourceDefinition
101+
metadata:
102+
name: clusterwatchers.spongeprojects.com
103+
labels:
104+
group: spongeprojects
105+
project: kubebigbrother
106+
spec:
107+
group: spongeprojects.com
108+
names:
109+
plural: clusterwatchers
110+
singular: clusterwatcher
111+
kind: ClusterWatcher
112+
scope: Cluster
113+
versions:
114+
- name: v1alpha1
115+
served: true
116+
storage: true
117+
schema:
118+
openAPIV3Schema:
119+
type: object
120+
properties:
121+
spec:
122+
type: object
123+
properties:
124+
resource:
125+
description: "resource is the name of the resource to watch, example: deploy, deployments, deployments.apps, deployments.v1.apps"
126+
type: string
127+
noticeWhenAdded:
128+
description: "noticeWhenAdded is a flag to enable notification when a resource has been added to the cluster"
129+
type: boolean
130+
noticeWhenDeleted:
131+
description: "noticeWhenDeleted is a flag to enable notification when a resource has been deleted from the cluster"
132+
type: boolean
133+
noticeWhenUpdated:
134+
description: "noticeWhenUpdated is a flag to enable notification when a resource has been updated in the cluster"
135+
type: boolean
136+
updateOn:
137+
description: "updateOn is an array of fields to trigger UPDATED notification, when no field in updateOn is changed, no notification will be sent, example: [.data, .spec.replicas]"
138+
type: array
139+
items:
140+
type: string
141+
channelNames:
142+
description: "channelNames is an array of channel names, reference to Channel resources"
143+
type: array
144+
items:
145+
type: string
146+
resyncPeriod:
147+
description: "resyncPeriod for this informer instance, example: 12h, 1d"
148+
type: string
149+
workers:
150+
description: "workers is the number of workers for this informer instance, default to 3"
151+
type: integer
152+
maxRetries:
153+
description: "maxRetries is the max number of retries for this informer instance, default to 3"
154+
type: integer
155+
additionalPrinterColumns:
156+
- name: Resource
157+
type: string
158+
description: Resource
159+
jsonPath: .spec.resource

demo-resources.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apiVersion: "spongeprojects.com/v1alpha1"
2+
kind: Channel
3+
metadata:
4+
name: print-to-stdout
5+
spec:
6+
type: print
7+
print:
8+
writer: stdout
9+
---
10+
apiVersion: "spongeprojects.com/v1alpha1"
11+
kind: Watcher
12+
metadata:
13+
name: secrets
14+
namespace: demo
15+
spec:
16+
resource: secrets
17+
noticeWhenAdded: true
18+
noticeWhenDeleted: true
19+
noticeWhenUpdated: true
20+
channelNames:
21+
- print-to-stdout
22+
---
23+
apiVersion: "spongeprojects.com/v1alpha1"
24+
kind: ClusterWatcher
25+
metadata:
26+
name: configmaps
27+
spec:
28+
resource: configmaps
29+
noticeWhenAdded: true
30+
noticeWhenDeleted: true
31+
noticeWhenUpdated: true
32+
channelNames:
33+
- print-to-stdout

0 commit comments

Comments
 (0)