-
Notifications
You must be signed in to change notification settings - Fork 130
SPL-298478: Add App CRD on M1 milestone branch #1826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2426dfe
add app crd
jzywiecki a2a33c6
fix: Change AppPausedAnnotation to apps endpoint
jzywiecki de670c7
fix: align the App CRD with ERD
jzywiecki 43688f2
feat: add field validation to appSourceRef
jzywiecki 37f723e
fix: review comments
jzywiecki 4d74cad
fix: remove min length with enums
jzywiecki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| // Copyright (c) 2018-2026 Splunk Inc. All rights reserved. | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| const ( | ||
| // AppPausedAnnotation is the annotation that pauses the reconciliation (triggers | ||
| // an immediate requeue) | ||
| AppPausedAnnotation = "apps.splunk.com/paused" | ||
| ) | ||
|
|
||
| // AppTargetRef defines the target environment the app should bind to. | ||
| type AppTargetRef struct { | ||
| // +kubebuilder:validation:Required | ||
| // +kubebuilder:validation:Enum="ClusterManager";"ClusterMaster";"IndexerCluster";"IngestorCluster";"LicenseManager";"LicenseMaster";"MonitoringConsole";"SearchHeadCluster";"Standalone" | ||
| Kind string `json:"kind"` | ||
|
|
||
| // +kubebuilder:validation:Required | ||
| // +kubebuilder:validation:MinLength=1 | ||
| Name string `json:"name"` | ||
| } | ||
|
|
||
| // AppPackageSpec defines the package location within the source. | ||
| type AppPackageSpec struct { | ||
| // +kubebuilder:validation:Required | ||
| // +kubebuilder:validation:MinLength=1 | ||
| Path string `json:"path"` | ||
| } | ||
|
|
||
| // AppSourceRef defines the app source details. | ||
| type AppSourceRef struct { | ||
| // +kubebuilder:validation:Required | ||
| // +kubebuilder:validation:MinLength=1 | ||
| Name string `json:"name"` | ||
| } | ||
|
|
||
| // AppSpec defines the desired state of App. | ||
| type AppSpec struct { | ||
| // +kubebuilder:validation:Required | ||
| // +kubebuilder:validation:MinLength=1 | ||
| AppID string `json:"appID"` | ||
|
|
||
| // +kubebuilder:validation:Required | ||
| // +kubebuilder:validation:MinLength=1 | ||
| Version string `json:"version"` | ||
|
|
||
| // +kubebuilder:validation:Required | ||
| TargetRef AppTargetRef `json:"targetRef"` | ||
|
|
||
| // +kubebuilder:validation:Required | ||
| SourceRef AppSourceRef `json:"sourceRef"` | ||
|
|
||
| // +kubebuilder:validation:Required | ||
| Package AppPackageSpec `json:"package"` | ||
|
|
||
| // +kubebuilder:validation:Required | ||
| // +kubebuilder:validation:Enum="local";"cluster" | ||
| Scope string `json:"scope"` | ||
|
naimulh247 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| // AppStatus defines the observed state of App. | ||
| type AppStatus struct { | ||
| // Phase of the app resource | ||
| Phase string `json:"phase,omitempty"` | ||
|
|
||
| // Auxiliary message describing CR status | ||
| Message string `json:"message,omitempty"` | ||
|
|
||
| // InstalledVersion is the app version installed on target | ||
| InstalledVersion string `json:"installedVersion,omitempty"` | ||
|
|
||
| // Artifact tracks the resolved app package details | ||
| Artifact *AppArtifactStatus `json:"artifact,omitempty"` | ||
|
|
||
| // ObservedGeneration tracks the latest reconciled generation | ||
| ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
|
|
||
| // Conditions represent the latest available observations of the app | ||
| Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
| } | ||
|
|
||
| // AppArtifactStatus defines resolved app artifact details. | ||
| type AppArtifactStatus struct { | ||
| // ResolvedPath is the resolved artifact path within the source | ||
| ResolvedPath string `json:"resolvedPath,omitempty"` | ||
|
|
||
| // Etag is the artifact hash or ETag used for change detection | ||
| Etag string `json:"etag,omitempty"` | ||
|
|
||
| // LastFetchedTime is the last time the artifact was fetched | ||
| LastFetchedTime metav1.Time `json:"lastFetchedTime,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:subresource:status | ||
|
|
||
| // App is the Schema for the apps API. | ||
| // +k8s:openapi-gen=true | ||
| // +kubebuilder:resource:path=apps,scope=Namespaced | ||
| // +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Status of app" | ||
| // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age of app resource" | ||
| // +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message",description="Auxiliary message describing CR status" | ||
| // +kubebuilder:storageversion | ||
| type App struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty,omitzero"` | ||
|
|
||
| Spec AppSpec `json:"spec"` | ||
| Status AppStatus `json:"status,omitempty,omitzero"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // AppList contains a list of App. | ||
| type AppList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []App `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&App{}, &AppList{}) | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.