Add ExternalArtifact types to API

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan 2025-09-03 21:45:22 +03:00
parent c9a5e76d24
commit 4900324ab0
No known key found for this signature in database
GPG Key ID: 3299AEB0E4085BAF
3 changed files with 179 additions and 0 deletions

View File

@ -43,4 +43,7 @@ resources:
- group: source
kind: OCIRepository
version: v1
- group: source
kind: ExternalArtifact
version: v1
version: "2"

View File

@ -0,0 +1,70 @@
/*
Copyright 2025 The Flux authors
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 v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/fluxcd/pkg/apis/meta"
)
// ExternalArtifactSpec defines the desired state of ExternalArtifact
type ExternalArtifactSpec struct {
// SourceRef points to the Kubernetes custom resource for
// which the artifact is generated.
// +optional
SourceRef *meta.NamespacedObjectKindReference `json:"sourceRef,omitempty"`
}
// ExternalArtifactStatus defines the observed state of ExternalArtifact
type ExternalArtifactStatus struct {
// Artifact represents the output of an ExternalArtifact reconciliation.
// +optional
Artifact *meta.Artifact `json:"artifact,omitempty"`
// Conditions holds the conditions for the ExternalArtifact.
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description=""
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description=""
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description=""
// +kubebuilder:printcolumn:name="Source",type="string",JSONPath=".spec.sourceRef.name",description=""
// ExternalArtifact is the Schema for the external artifacts API
type ExternalArtifact struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ExternalArtifactSpec `json:"spec,omitempty"`
Status ExternalArtifactStatus `json:"status,omitempty"`
}
// ExternalArtifactList contains a list of ExternalArtifact
// +kubebuilder:object:root=true
type ExternalArtifactList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ExternalArtifact `json:"items"`
}
func init() {
SchemeBuilder.Register(&ExternalArtifact{}, &ExternalArtifactList{})
}

View File

@ -190,6 +190,112 @@ func (in *BucketStatus) DeepCopy() *BucketStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExternalArtifact) DeepCopyInto(out *ExternalArtifact) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalArtifact.
func (in *ExternalArtifact) DeepCopy() *ExternalArtifact {
if in == nil {
return nil
}
out := new(ExternalArtifact)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ExternalArtifact) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExternalArtifactList) DeepCopyInto(out *ExternalArtifactList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ExternalArtifact, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalArtifactList.
func (in *ExternalArtifactList) DeepCopy() *ExternalArtifactList {
if in == nil {
return nil
}
out := new(ExternalArtifactList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ExternalArtifactList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExternalArtifactSpec) DeepCopyInto(out *ExternalArtifactSpec) {
*out = *in
if in.SourceRef != nil {
in, out := &in.SourceRef, &out.SourceRef
*out = new(meta.NamespacedObjectKindReference)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalArtifactSpec.
func (in *ExternalArtifactSpec) DeepCopy() *ExternalArtifactSpec {
if in == nil {
return nil
}
out := new(ExternalArtifactSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ExternalArtifactStatus) DeepCopyInto(out *ExternalArtifactStatus) {
*out = *in
if in.Artifact != nil {
in, out := &in.Artifact, &out.Artifact
*out = new(meta.Artifact)
(*in).DeepCopyInto(*out)
}
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]metav1.Condition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalArtifactStatus.
func (in *ExternalArtifactStatus) DeepCopy() *ExternalArtifactStatus {
if in == nil {
return nil
}
out := new(ExternalArtifactStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GitRepository) DeepCopyInto(out *GitRepository) {
*out = *in