Skip to content

Commit f5518fe

Browse files
committed
fix: align the App CRD with ERD
Signed-off-by: jzywieck <jzywiecki@splunk.com>
1 parent 99d10eb commit f5518fe

4 files changed

Lines changed: 29 additions & 187 deletions

File tree

api/apps/v1alpha1/app_types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ type AppPackageSpec struct {
4242
Path string `json:"path"`
4343
}
4444

45+
// AppSourceSpec defines the app source details.
46+
type AppSourceRef struct {
47+
// +kubebuilder:validation:Required
48+
Name string `json:"name"`
49+
}
50+
4551
// AppSpec defines the desired state of App.
4652
type AppSpec struct {
4753
// +kubebuilder:validation:Required
@@ -56,7 +62,7 @@ type AppSpec struct {
5662
TargetRef AppTargetRef `json:"targetRef"`
5763

5864
// +kubebuilder:validation:Required
59-
SourceRef AppSource `json:"sourceRef"`
65+
SourceRef AppSourceRef `json:"sourceRef"`
6066

6167
// +kubebuilder:validation:Required
6268
Package AppPackageSpec `json:"package"`

api/apps/v1alpha1/zz_generated.deepcopy.go

Lines changed: 17 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/apps.splunk.com_apps.yaml

Lines changed: 4 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -69,180 +69,12 @@ spec:
6969
minLength: 1
7070
type: string
7171
sourceRef:
72-
description: AppSource is the Schema for the appsources API.
72+
description: AppSourceSpec defines the app source details.
7373
properties:
74-
apiVersion:
75-
description: |-
76-
APIVersion defines the versioned schema of this representation of an object.
77-
Servers should convert recognized schemas to the latest internal value, and
78-
may reject unrecognized values.
79-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
80-
type: string
81-
kind:
82-
description: |-
83-
Kind is a string value representing the REST resource this object represents.
84-
Servers may infer this from the endpoint the client submits requests to.
85-
Cannot be updated.
86-
In CamelCase.
87-
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
74+
name:
8875
type: string
89-
metadata:
90-
type: object
91-
spec:
92-
description: AppSourceSpec defines the desired state of AppSource.
93-
properties:
94-
auth:
95-
description: Authentication configuration
96-
properties:
97-
secretRef:
98-
description: |-
99-
LocalObjectReference contains enough information to let you locate the
100-
referenced object inside the same namespace.
101-
properties:
102-
name:
103-
default: ""
104-
description: |-
105-
Name of the referent.
106-
This field is effectively required, but due to backwards compatibility is
107-
allowed to be empty. Instances of this type with an empty value here are
108-
almost certainly wrong.
109-
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
110-
type: string
111-
type: object
112-
x-kubernetes-map-type: atomic
113-
required:
114-
- secretRef
115-
type: object
116-
git:
117-
description: Git specific configuration
118-
properties:
119-
ref:
120-
default: main
121-
type: string
122-
repo:
123-
type: string
124-
required:
125-
- repo
126-
type: object
127-
pollIntervalSeconds:
128-
default: 60
129-
description: PollIntervalSeconds is the interval in seconds
130-
to poll remote repository
131-
format: int32
132-
type: integer
133-
s3:
134-
description: S3 specific configuration
135-
properties:
136-
basePath:
137-
type: string
138-
bucket:
139-
type: string
140-
endpoint:
141-
type: string
142-
region:
143-
type: string
144-
required:
145-
- endpoint
146-
type: object
147-
type:
148-
description: |-
149-
Type of the App Source
150-
Valid values are "git", "s3", "gcp", "azure"
151-
enum:
152-
- git
153-
- s3
154-
- gcp
155-
- azure
156-
type: string
157-
required:
158-
- auth
159-
- type
160-
type: object
161-
x-kubernetes-validations:
162-
- message: s3 configuration is required when type is s3
163-
rule: self.type != 's3' || has(self.s3)
164-
- message: git configuration is required when type is git
165-
rule: self.type != 'git' || has(self.git)
166-
- message: exactly one of s3 or git must be specified
167-
rule: '[has(self.s3), has(self.git)].filter(x, x == true).size()
168-
== 1'
169-
status:
170-
description: AppSourceStatus defines the observed state of AppSource.
171-
properties:
172-
condition:
173-
description: Conditions represent the current state of the
174-
AppSource
175-
items:
176-
description: Condition contains details for one aspect of
177-
the current state of this API Resource.
178-
properties:
179-
lastTransitionTime:
180-
description: |-
181-
lastTransitionTime is the last time the condition transitioned from one status to another.
182-
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
183-
format: date-time
184-
type: string
185-
message:
186-
description: |-
187-
message is a human readable message indicating details about the transition.
188-
This may be an empty string.
189-
maxLength: 32768
190-
type: string
191-
observedGeneration:
192-
description: |-
193-
observedGeneration represents the .metadata.generation that the condition was set based upon.
194-
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
195-
with respect to the current state of the instance.
196-
format: int64
197-
minimum: 0
198-
type: integer
199-
reason:
200-
description: |-
201-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
202-
Producers of specific condition types may define expected values and meanings for this field,
203-
and whether the values are considered a guaranteed API.
204-
The value should be a CamelCase string.
205-
This field may not be empty.
206-
maxLength: 1024
207-
minLength: 1
208-
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
209-
type: string
210-
status:
211-
description: status of the condition, one of True, False,
212-
Unknown.
213-
enum:
214-
- "True"
215-
- "False"
216-
- Unknown
217-
type: string
218-
type:
219-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
220-
maxLength: 316
221-
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])$
222-
type: string
223-
required:
224-
- lastTransitionTime
225-
- message
226-
- reason
227-
- status
228-
- type
229-
type: object
230-
type: array
231-
x-kubernetes-list-map-keys:
232-
- type
233-
x-kubernetes-list-type: map
234-
lastPolledTime:
235-
description: LastPolledTime represents the last time the AppSource
236-
was polled
237-
format: date-time
238-
type: string
239-
observedGeneration:
240-
description: |-
241-
ObservedGeneration represents the most recent generation observed for this AppSource
242-
This will be used to determine if the AppSource needs to be reconciled
243-
format: int64
244-
type: integer
245-
type: object
76+
required:
77+
- name
24678
type: object
24779
targetRef:
24880
description: AppTargetRef defines the target environment the app should

config/samples/apps_v1alpha1_app.yaml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,7 @@ spec:
1212
kind: Standalone
1313
name: standalone-sample
1414
sourceRef:
15-
kind: AppSource
16-
apiVersion: apps.splunk.com/v1alpha1
17-
spec:
18-
type: s3
19-
s3:
20-
endpoint: "https://s3.amazonaws.com"
21-
bucket: "my-bucket"
22-
basePath: "my-path"
23-
auth:
24-
secretRef:
25-
name: "my-secret"
26-
polling: 60
15+
name: appsource-sample-s3
2716
package:
2817
path: apps/sample-app.tgz
2918
scope: local

0 commit comments

Comments
 (0)