|
| 1 | +/* |
| 2 | +Copyright 2025 The Flux authors |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package v1 |
| 18 | + |
| 19 | +import ( |
| 20 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | + |
| 22 | + "github.com/fluxcd/pkg/apis/meta" |
| 23 | +) |
| 24 | + |
| 25 | +// ExternalArtifactSpec defines the desired state of ExternalArtifact |
| 26 | +type ExternalArtifactSpec struct { |
| 27 | + // SourceRef points to the Kubernetes custom resource for |
| 28 | + // which the artifact is generated. |
| 29 | + // +optional |
| 30 | + SourceRef *meta.NamespacedObjectKindReference `json:"sourceRef,omitempty"` |
| 31 | +} |
| 32 | + |
| 33 | +// ExternalArtifactStatus defines the observed state of ExternalArtifact |
| 34 | +type ExternalArtifactStatus struct { |
| 35 | + // Artifact represents the output of an ExternalArtifact reconciliation. |
| 36 | + // +optional |
| 37 | + Artifact *meta.Artifact `json:"artifact,omitempty"` |
| 38 | + |
| 39 | + // Conditions holds the conditions for the ExternalArtifact. |
| 40 | + // +optional |
| 41 | + Conditions []metav1.Condition `json:"conditions,omitempty"` |
| 42 | +} |
| 43 | + |
| 44 | +// +kubebuilder:object:root=true |
| 45 | +// +kubebuilder:subresource:status |
| 46 | +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="" |
| 47 | +// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description="" |
| 48 | +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description="" |
| 49 | +// +kubebuilder:printcolumn:name="Source",type="string",JSONPath=".spec.sourceRef.name",description="" |
| 50 | + |
| 51 | +// ExternalArtifact is the Schema for the external artifacts API |
| 52 | +type ExternalArtifact struct { |
| 53 | + metav1.TypeMeta `json:",inline"` |
| 54 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 55 | + |
| 56 | + Spec ExternalArtifactSpec `json:"spec,omitempty"` |
| 57 | + Status ExternalArtifactStatus `json:"status,omitempty"` |
| 58 | +} |
| 59 | + |
| 60 | +// ExternalArtifactList contains a list of ExternalArtifact |
| 61 | +// +kubebuilder:object:root=true |
| 62 | +type ExternalArtifactList struct { |
| 63 | + metav1.TypeMeta `json:",inline"` |
| 64 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 65 | + Items []ExternalArtifact `json:"items"` |
| 66 | +} |
| 67 | + |
| 68 | +func init() { |
| 69 | + SchemeBuilder.Register(&ExternalArtifact{}, &ExternalArtifactList{}) |
| 70 | +} |
0 commit comments