api: corrections to match v1alpha1 spec

This commit is contained in:
Hidde Beydals 2020-04-14 10:42:59 +02:00
parent 45da46216c
commit dbe3f4fa9c
9 changed files with 57 additions and 37 deletions

View File

@ -21,7 +21,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// SourceCondition contains condition information for a source
// SourceCondition contains condition information for a source.
type SourceCondition struct {
// Type of the condition, currently ('Ready').
// +required
@ -50,17 +50,19 @@ type SourceCondition struct {
const (
// ReadyCondition represents the fact that a given source is in ready state.
ReadyCondition string = "Ready"
)
// InitializingReason represents the fact that a given source is being initialize.
const (
// InitializingReason represents the fact that a given source is being initialized.
InitializingReason string = "Initializing"
// StorageOperationFailedReason signals a failure caused by a storage operation.
StorageOperationFailedReason string = "StorageOperationFailed"
// URLInvalidReason represents the fact that a given source has an invalid URL.
URLInvalidReason string = "URLInvalid"
// AuthenticationFailedReason represents the fact that a given secret doesn't
// have the required fields or the provided credentials don't match.
// StorageOperationFailedReason signals a failure caused by a storage operation.
StorageOperationFailedReason string = "StorageOperationFailed"
// AuthenticationFailedReason represents the fact that a given secret does not
// have the required fields or the provided credentials do not match.
AuthenticationFailedReason string = "AuthenticationFailed"
)

View File

@ -21,7 +21,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// GitRepositorySpec defines the desired state of GitRepository
// GitRepositorySpec defines the desired state of a Git repository.
type GitRepositorySpec struct {
// The repository URL, can be a HTTP or SSH address.
// +kubebuilder:validation:Pattern="^(http|https|ssh)://"
@ -29,8 +29,10 @@ type GitRepositorySpec struct {
URL string `json:"url"`
// The secret name containing the Git credentials.
// For HTTPS repositories the secret must contain username and password fields.
// For SSH repositories the secret must contain identity, identity.pub and known_hosts fields.
// For HTTPS repositories the secret must contain username and password
// fields.
// For SSH repositories the secret must contain identity, identity.pub and
// known_hosts fields.
// +optional
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
@ -38,12 +40,13 @@ type GitRepositorySpec struct {
// +required
Interval metav1.Duration `json:"interval"`
// The git reference to checkout and monitor for changes, defaults to master branch.
// The git reference to checkout and monitor for changes, defaults to
// master branch.
// +optional
Reference *GitRepositoryRef `json:"ref,omitempty"`
}
// GitRepositoryRef defines the git ref used for pull and checkout operations
// GitRepositoryRef defines the git ref used for pull and checkout operations.
type GitRepositoryRef struct {
// The git branch to checkout, defaults to master.
// +optional
@ -57,17 +60,19 @@ type GitRepositoryRef struct {
// +optional
SemVer string `json:"semver"`
// The git commit sha to checkout, if specified tag filters will be ignored.
// The git commit sha to checkout, if specified tag filters will be
// ignored.
// +optional
Commit string `json:"commit"`
}
// GitRepositoryStatus defines the observed state of GitRepository
// GitRepositoryStatus defines the observed state of the GitRepository.
type GitRepositoryStatus struct {
// +optional
Conditions []SourceCondition `json:"conditions,omitempty"`
// URL is the download link for the artifact output of the last repository sync.
// URL is the download link for the artifact output of the last repository
// sync.
// +optional
URL string `json:"url,omitempty"`
@ -77,8 +82,13 @@ type GitRepositoryStatus struct {
}
const (
// GitOperationSucceedReason represents the fact that the git clone, pull
// and checkout operations succeeded.
GitOperationSucceedReason string = "GitOperationSucceed"
GitOperationFailedReason string = "GitOperationFailed"
// GitOperationFailedReason represents the fact that the git clone, pull or
// checkout operations failed.
GitOperationFailedReason string = "GitOperationFailed"
)
func GitRepositoryReady(repository GitRepository, artifact Artifact, url, reason, message string) GitRepository {

View File

@ -25,10 +25,10 @@ import (
)
var (
// GroupVersion is group version used to register these objects
// GroupVersion is group version used to register these objects.
GroupVersion = schema.GroupVersion{Group: "source.fluxcd.io", Version: "v1alpha1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
// AddToScheme adds the types in this group-version to the given scheme.

View File

@ -21,7 +21,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// HelmChartSpec defines the desired state of HelmChart
// HelmChartSpec defines the desired state of a Helm chart.
type HelmChartSpec struct {
// The name of the Helm chart, as made available by the referenced
// Helm repository.
@ -39,10 +39,10 @@ type HelmChartSpec struct {
// The interval at which to check the Helm repository for updates.
// +required
Interval metav1.Duration `json:"interval,omitempty"`
Interval metav1.Duration `json:"interval"`
}
// HelmChartStatus defines the observed state of HelmChart
// HelmChartStatus defines the observed state of the HelmChart.
type HelmChartStatus struct {
// +optional
Conditions []SourceCondition `json:"conditions,omitempty"`
@ -51,7 +51,7 @@ type HelmChartStatus struct {
// +optional
URL string `json:"url,omitempty"`
// URI for the artifact of the latest successful chart pull.
// Artifact represents the output of the last successful chart sync.
// +optional
Artifact *Artifact `json:"artifact,omitempty"`
}

View File

@ -21,7 +21,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// HelmRepositorySpec defines the desired state of HelmRepository
// HelmRepositorySpec defines the reference to a Helm repository.
type HelmRepositorySpec struct {
// The Helm repository URL, a valid URL contains at least a
// protocol and host.
@ -30,15 +30,18 @@ type HelmRepositorySpec struct {
// The name of the secret containing authentication credentials
// for the Helm repository.
// For HTTP/S basic auth the secret must contain username and password
// fields.
// For TLS the secret must contain caFile, keyFile and caCert fields.
// +optional
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
// The interval at which to check for repository updates
// The interval at which to check the upstream for updates.
// +required
Interval metav1.Duration `json:"interval"`
}
// HelmRepositoryStatus defines the observed state of HelmRepository
// HelmRepositoryStatus defines the observed state of the HelmRepository.
type HelmRepositoryStatus struct {
// +optional
Conditions []SourceCondition `json:"conditions,omitempty"`

View File

@ -47,7 +47,7 @@ spec:
metadata:
type: object
spec:
description: GitRepositorySpec defines the desired state of GitRepository
description: GitRepositorySpec defines the desired state of a Git repository.
properties:
interval:
description: The interval at which to check for repository updates.
@ -91,7 +91,7 @@ spec:
- url
type: object
status:
description: GitRepositoryStatus defines the observed state of GitRepository
description: GitRepositoryStatus defines the observed state of the GitRepository.
properties:
artifact:
description: Artifact represents the output of the last successful repository
@ -120,7 +120,7 @@ spec:
conditions:
items:
description: SourceCondition contains condition information for a
source
source.
properties:
lastTransitionTime:
description: LastTransitionTime is the timestamp corresponding

View File

@ -53,7 +53,7 @@ spec:
metadata:
type: object
spec:
description: HelmChartSpec defines the desired state of HelmChart
description: HelmChartSpec defines the desired state of a Helm chart.
properties:
helmRepositoryRef:
description: The name of the HelmRepository the chart is available at.
@ -77,13 +77,15 @@ spec:
type: string
required:
- helmRepositoryRef
- interval
- name
type: object
status:
description: HelmChartStatus defines the observed state of HelmChart
description: HelmChartStatus defines the observed state of the HelmChart.
properties:
artifact:
description: URI for the artifact of the latest successful chart pull.
description: Artifact represents the output of the last successful chart
sync.
properties:
lastUpdateTime:
description: LastUpdateTime is the timestamp corresponding to the
@ -108,7 +110,7 @@ spec:
conditions:
items:
description: SourceCondition contains condition information for a
source
source.
properties:
lastTransitionTime:
description: LastTransitionTime is the timestamp corresponding

View File

@ -47,14 +47,16 @@ spec:
metadata:
type: object
spec:
description: HelmRepositorySpec defines the desired state of HelmRepository
description: HelmRepositorySpec defines the reference to a Helm repository.
properties:
interval:
description: The interval at which to check for repository updates
description: The interval at which to check the upstream for updates.
type: string
secretRef:
description: The name of the secret containing authentication credentials
for the Helm repository.
for the Helm repository. For HTTP/S basic auth the secret must contain
username and password fields. For TLS the secret must contain caFile,
keyFile and caCert fields.
properties:
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
@ -70,7 +72,7 @@ spec:
- url
type: object
status:
description: HelmRepositoryStatus defines the observed state of HelmRepository
description: HelmRepositoryStatus defines the observed state of the HelmRepository.
properties:
artifact:
description: Artifact represents the output of the last successful repository
@ -99,7 +101,7 @@ spec:
conditions:
items:
description: SourceCondition contains condition information for a
source
source.
properties:
lastTransitionTime:
description: LastTransitionTime is the timestamp corresponding

View File

@ -7,3 +7,4 @@ spec:
version: '^2.0.0'
helmRepositoryRef:
name: helmrepository-sample
interval: 1m