diff --git a/api/v1alpha1/condition_types.go b/api/v1alpha1/condition_types.go index b9ea19b9..d62c563a 100644 --- a/api/v1alpha1/condition_types.go +++ b/api/v1alpha1/condition_types.go @@ -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" ) diff --git a/api/v1alpha1/gitrepository_types.go b/api/v1alpha1/gitrepository_types.go index 75417902..e63b95ea 100644 --- a/api/v1alpha1/gitrepository_types.go +++ b/api/v1alpha1/gitrepository_types.go @@ -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 { diff --git a/api/v1alpha1/groupversion_info.go b/api/v1alpha1/groupversion_info.go index 57a0cbd3..6025b661 100644 --- a/api/v1alpha1/groupversion_info.go +++ b/api/v1alpha1/groupversion_info.go @@ -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. diff --git a/api/v1alpha1/helmchart_types.go b/api/v1alpha1/helmchart_types.go index a0459759..b61f82c4 100644 --- a/api/v1alpha1/helmchart_types.go +++ b/api/v1alpha1/helmchart_types.go @@ -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"` } diff --git a/api/v1alpha1/helmrepository_types.go b/api/v1alpha1/helmrepository_types.go index 5de60b84..aab539eb 100644 --- a/api/v1alpha1/helmrepository_types.go +++ b/api/v1alpha1/helmrepository_types.go @@ -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"` diff --git a/config/crd/bases/source.fluxcd.io_gitrepositories.yaml b/config/crd/bases/source.fluxcd.io_gitrepositories.yaml index ebb3c7a5..6cd6e1c4 100644 --- a/config/crd/bases/source.fluxcd.io_gitrepositories.yaml +++ b/config/crd/bases/source.fluxcd.io_gitrepositories.yaml @@ -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 diff --git a/config/crd/bases/source.fluxcd.io_helmcharts.yaml b/config/crd/bases/source.fluxcd.io_helmcharts.yaml index 95f238d3..f5829788 100644 --- a/config/crd/bases/source.fluxcd.io_helmcharts.yaml +++ b/config/crd/bases/source.fluxcd.io_helmcharts.yaml @@ -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 diff --git a/config/crd/bases/source.fluxcd.io_helmrepositories.yaml b/config/crd/bases/source.fluxcd.io_helmrepositories.yaml index c43c968a..5f5f3f10 100644 --- a/config/crd/bases/source.fluxcd.io_helmrepositories.yaml +++ b/config/crd/bases/source.fluxcd.io_helmrepositories.yaml @@ -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 diff --git a/config/samples/source_v1alpha1_helmchart.yaml b/config/samples/source_v1alpha1_helmchart.yaml index 44d00e50..01daf960 100644 --- a/config/samples/source_v1alpha1_helmchart.yaml +++ b/config/samples/source_v1alpha1_helmchart.yaml @@ -7,3 +7,4 @@ spec: version: '^2.0.0' helmRepositoryRef: name: helmrepository-sample + interval: 1m