Add artifact type to API

This commit is contained in:
stefanprodan 2020-04-12 13:15:56 +03:00
parent fa6bccbc72
commit 461c015273
7 changed files with 141 additions and 29 deletions

41
api/v1alpha1/artifact.go Normal file
View File

@ -0,0 +1,41 @@
/*
Copyright 2020 The Flux CD contributors.
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"
// Artifact represents the output of a source synchronisation
type Artifact struct {
// Path is the local file path of this artifact.
// +required
Path string `json:"path"`
// URL is the HTTP address of this artifact.
// +required
URL string `json:"url"`
// Revision is a human readable identifier traceable in the origin source system.
// It can be a commit sha, git tag, a helm index timestamp,
// a helm chart version, a checksum, etc.
// +optional
Revision string `json:"revision"`
// LastUpdateTime is the timestamp corresponding to the last
// update of this artifact.
// +required
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
}

View File

@ -1,3 +1,19 @@
/*
Copyright 2020 The Flux CD contributors.
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 (

View File

@ -67,14 +67,13 @@ type GitRepositoryStatus struct {
// +optional
Conditions []SourceCondition `json:"conditions,omitempty"`
// LastUpdateTime is the timestamp corresponding to the last status
// change of this repository.
// URL is the download link for the artifact output of the last repository sync.
// +optional
LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`
URL string `json:"url,omitempty"`
// Path to the artifact output of the last repository sync.
// Artifact represents the output of the last successful repository sync.
// +optional
Artifact string `json:"artifacts,omitempty"`
Artifact *Artifact `json:"artifact,omitempty"`
}
// +kubebuilder:object:root=true

View File

@ -37,14 +37,13 @@ type HelmRepositoryStatus struct {
// +optional
Conditions []SourceCondition `json:"conditions,omitempty"`
// LastUpdateTime is the timestamp corresponding to the last status
// change of this repository.
// URL is the download link for the last index fetched.
// +optional
LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`
URL string `json:"url,omitempty"`
// Path to the artifact of the last repository index.
// Artifact represents the output of the last successful repository sync.
// +optional
Artifact string `json:"artifact,omitempty"`
Artifact *Artifact `json:"artifact,omitempty"`
}
// +kubebuilder:object:root=true

View File

@ -25,6 +25,22 @@ import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Artifact) DeepCopyInto(out *Artifact) {
*out = *in
in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Artifact.
func (in *Artifact) DeepCopy() *Artifact {
if in == nil {
return nil
}
out := new(Artifact)
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
@ -135,9 +151,10 @@ func (in *GitRepositoryStatus) DeepCopyInto(out *GitRepositoryStatus) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.LastUpdateTime != nil {
in, out := &in.LastUpdateTime, &out.LastUpdateTime
*out = (*in).DeepCopy()
if in.Artifact != nil {
in, out := &in.Artifact, &out.Artifact
*out = new(Artifact)
(*in).DeepCopyInto(*out)
}
}
@ -236,9 +253,10 @@ func (in *HelmRepositoryStatus) DeepCopyInto(out *HelmRepositoryStatus) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.LastUpdateTime != nil {
in, out := &in.LastUpdateTime, &out.LastUpdateTime
*out = (*in).DeepCopy()
if in.Artifact != nil {
in, out := &in.Artifact, &out.Artifact
*out = new(Artifact)
(*in).DeepCopyInto(*out)
}
}

View File

@ -93,9 +93,30 @@ spec:
status:
description: GitRepositoryStatus defines the observed state of GitRepository
properties:
artifacts:
description: Path to the artifact output of the last repository sync.
type: string
artifact:
description: Artifact represents the output of the last successful repository
sync.
properties:
lastUpdateTime:
description: LastUpdateTime is the timestamp corresponding to the
last update of this artifact.
format: date-time
type: string
path:
description: Path is the local file path of this artifact.
type: string
revision:
description: Revision is a human readable identifier traceable in
the origin source system. It can be a commit sha, git tag, a helm
index timestamp, a helm chart version, a checksum, etc.
type: string
url:
description: URL is the HTTP address of this artifact.
type: string
required:
- path
- url
type: object
conditions:
items:
description: SourceCondition contains condition information for a
@ -126,10 +147,9 @@ spec:
- type
type: object
type: array
lastUpdateTime:
description: LastUpdateTime is the timestamp corresponding to the last
status change of this repository.
format: date-time
url:
description: URL is the download link for the artifact output of the
last repository sync.
type: string
type: object
type: object

View File

@ -64,8 +64,29 @@ spec:
description: HelmRepositoryStatus defines the observed state of HelmRepository
properties:
artifact:
description: Path to the artifact of the last repository index.
type: string
description: Artifact represents the output of the last successful repository
sync.
properties:
lastUpdateTime:
description: LastUpdateTime is the timestamp corresponding to the
last update of this artifact.
format: date-time
type: string
path:
description: Path is the local file path of this artifact.
type: string
revision:
description: Revision is a human readable identifier traceable in
the origin source system. It can be a commit sha, git tag, a helm
index timestamp, a helm chart version, a checksum, etc.
type: string
url:
description: URL is the HTTP address of this artifact.
type: string
required:
- path
- url
type: object
conditions:
items:
description: SourceCondition contains condition information for a
@ -96,10 +117,8 @@ spec:
- type
type: object
type: array
lastUpdateTime:
description: LastUpdateTime is the timestamp corresponding to the last
status change of this repository.
format: date-time
url:
description: URL is the download link for the last index fetched.
type: string
type: object
type: object