Skip to content

Commit 425b7a3

Browse files
committed
Generate ExternalArtifact CRD
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 4900324 commit 425b7a3

File tree

5 files changed

+395
-0
lines changed

5 files changed

+395
-0
lines changed
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.19.0
7+
name: externalartifacts.source.toolkit.fluxcd.io
8+
spec:
9+
group: source.toolkit.fluxcd.io
10+
names:
11+
kind: ExternalArtifact
12+
listKind: ExternalArtifactList
13+
plural: externalartifacts
14+
singular: externalartifact
15+
scope: Namespaced
16+
versions:
17+
- additionalPrinterColumns:
18+
- jsonPath: .metadata.creationTimestamp
19+
name: Age
20+
type: date
21+
- jsonPath: .status.conditions[?(@.type=="Ready")].status
22+
name: Ready
23+
type: string
24+
- jsonPath: .status.conditions[?(@.type=="Ready")].message
25+
name: Status
26+
type: string
27+
- jsonPath: .spec.sourceRef.name
28+
name: Source
29+
type: string
30+
name: v1
31+
schema:
32+
openAPIV3Schema:
33+
description: ExternalArtifact is the Schema for the external artifacts API
34+
properties:
35+
apiVersion:
36+
description: |-
37+
APIVersion defines the versioned schema of this representation of an object.
38+
Servers should convert recognized schemas to the latest internal value, and
39+
may reject unrecognized values.
40+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
41+
type: string
42+
kind:
43+
description: |-
44+
Kind is a string value representing the REST resource this object represents.
45+
Servers may infer this from the endpoint the client submits requests to.
46+
Cannot be updated.
47+
In CamelCase.
48+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
49+
type: string
50+
metadata:
51+
type: object
52+
spec:
53+
description: ExternalArtifactSpec defines the desired state of ExternalArtifact
54+
properties:
55+
sourceRef:
56+
description: |-
57+
SourceRef points to the Kubernetes custom resource for
58+
which the artifact is generated.
59+
properties:
60+
apiVersion:
61+
description: API version of the referent, if not specified the
62+
Kubernetes preferred version will be used.
63+
type: string
64+
kind:
65+
description: Kind of the referent.
66+
type: string
67+
name:
68+
description: Name of the referent.
69+
type: string
70+
namespace:
71+
description: Namespace of the referent, when not specified it
72+
acts as LocalObjectReference.
73+
type: string
74+
required:
75+
- kind
76+
- name
77+
type: object
78+
type: object
79+
status:
80+
description: ExternalArtifactStatus defines the observed state of ExternalArtifact
81+
properties:
82+
artifact:
83+
description: Artifact represents the output of an ExternalArtifact
84+
reconciliation.
85+
properties:
86+
digest:
87+
description: Digest is the digest of the file in the form of '<algorithm>:<checksum>'.
88+
pattern: ^[a-z0-9]+(?:[.+_-][a-z0-9]+)*:[a-zA-Z0-9=_-]+$
89+
type: string
90+
lastUpdateTime:
91+
description: |-
92+
LastUpdateTime is the timestamp corresponding to the last update of the
93+
Artifact.
94+
format: date-time
95+
type: string
96+
metadata:
97+
additionalProperties:
98+
type: string
99+
description: Metadata holds upstream information such as OCI annotations.
100+
type: object
101+
path:
102+
description: |-
103+
Path is the relative file path of the Artifact. It can be used to locate
104+
the file in the root of the Artifact storage on the local file system of
105+
the controller managing the Source.
106+
type: string
107+
revision:
108+
description: |-
109+
Revision is a human-readable identifier traceable in the origin source
110+
system. It can be a Git commit SHA, Git tag, a Helm chart version, etc.
111+
type: string
112+
size:
113+
description: Size is the number of bytes in the file.
114+
format: int64
115+
type: integer
116+
url:
117+
description: |-
118+
URL is the HTTP address of the Artifact as exposed by the controller
119+
managing the Source. It can be used to retrieve the Artifact for
120+
consumption, e.g. by another controller applying the Artifact contents.
121+
type: string
122+
required:
123+
- digest
124+
- lastUpdateTime
125+
- path
126+
- revision
127+
- url
128+
type: object
129+
conditions:
130+
description: Conditions holds the conditions for the ExternalArtifact.
131+
items:
132+
description: Condition contains details for one aspect of the current
133+
state of this API Resource.
134+
properties:
135+
lastTransitionTime:
136+
description: |-
137+
lastTransitionTime is the last time the condition transitioned from one status to another.
138+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
139+
format: date-time
140+
type: string
141+
message:
142+
description: |-
143+
message is a human readable message indicating details about the transition.
144+
This may be an empty string.
145+
maxLength: 32768
146+
type: string
147+
observedGeneration:
148+
description: |-
149+
observedGeneration represents the .metadata.generation that the condition was set based upon.
150+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
151+
with respect to the current state of the instance.
152+
format: int64
153+
minimum: 0
154+
type: integer
155+
reason:
156+
description: |-
157+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
158+
Producers of specific condition types may define expected values and meanings for this field,
159+
and whether the values are considered a guaranteed API.
160+
The value should be a CamelCase string.
161+
This field may not be empty.
162+
maxLength: 1024
163+
minLength: 1
164+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
165+
type: string
166+
status:
167+
description: status of the condition, one of True, False, Unknown.
168+
enum:
169+
- "True"
170+
- "False"
171+
- Unknown
172+
type: string
173+
type:
174+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
175+
maxLength: 316
176+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
177+
type: string
178+
required:
179+
- lastTransitionTime
180+
- message
181+
- reason
182+
- status
183+
- type
184+
type: object
185+
type: array
186+
type: object
187+
type: object
188+
served: true
189+
storage: true
190+
subresources:
191+
status: {}

config/crd/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ resources:
66
- bases/source.toolkit.fluxcd.io_helmcharts.yaml
77
- bases/source.toolkit.fluxcd.io_buckets.yaml
88
- bases/source.toolkit.fluxcd.io_ocirepositories.yaml
9+
- bases/source.toolkit.fluxcd.io_externalartifacts.yaml
910
# +kubebuilder:scaffold:crdkustomizeresource
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# permissions for end users to edit externalartifacts.
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: externalartifact-editor-role
6+
rules:
7+
- apiGroups:
8+
- source.toolkit.fluxcd.io
9+
resources:
10+
- externalartifacts
11+
verbs:
12+
- create
13+
- delete
14+
- get
15+
- list
16+
- patch
17+
- update
18+
- watch
19+
- apiGroups:
20+
- source.toolkit.fluxcd.io
21+
resources:
22+
- externalartifacts/status
23+
verbs:
24+
- get
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# permissions for end users to view externalartifacts.
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: externalartifacts-viewer-role
6+
rules:
7+
- apiGroups:
8+
- source.toolkit.fluxcd.io
9+
resources:
10+
- externalartifacts
11+
verbs:
12+
- get
13+
- list
14+
- watch
15+
- apiGroups:
16+
- source.toolkit.fluxcd.io
17+
resources:
18+
- externalartifacts/status
19+
verbs:
20+
- get

0 commit comments

Comments
 (0)