Skip to content

Commit 00b494e

Browse files
authored
Merge pull request #20 from fluxcd/api-matches-spec
api: corrections to match v1alpha1 spec
2 parents 45da462 + dbe3f4f commit 00b494e

9 files changed

+57
-37
lines changed

api/v1alpha1/condition_types.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
)
2323

24-
// SourceCondition contains condition information for a source
24+
// SourceCondition contains condition information for a source.
2525
type SourceCondition struct {
2626
// Type of the condition, currently ('Ready').
2727
// +required
@@ -50,17 +50,19 @@ type SourceCondition struct {
5050
const (
5151
// ReadyCondition represents the fact that a given source is in ready state.
5252
ReadyCondition string = "Ready"
53+
)
5354

54-
// InitializingReason represents the fact that a given source is being initialize.
55+
const (
56+
// InitializingReason represents the fact that a given source is being initialized.
5557
InitializingReason string = "Initializing"
5658

57-
// StorageOperationFailedReason signals a failure caused by a storage operation.
58-
StorageOperationFailedReason string = "StorageOperationFailed"
59-
6059
// URLInvalidReason represents the fact that a given source has an invalid URL.
6160
URLInvalidReason string = "URLInvalid"
6261

63-
// AuthenticationFailedReason represents the fact that a given secret doesn't
64-
// have the required fields or the provided credentials don't match.
62+
// StorageOperationFailedReason signals a failure caused by a storage operation.
63+
StorageOperationFailedReason string = "StorageOperationFailed"
64+
65+
// AuthenticationFailedReason represents the fact that a given secret does not
66+
// have the required fields or the provided credentials do not match.
6567
AuthenticationFailedReason string = "AuthenticationFailed"
6668
)

api/v1alpha1/gitrepository_types.go

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,32 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
)
2323

24-
// GitRepositorySpec defines the desired state of GitRepository
24+
// GitRepositorySpec defines the desired state of a Git repository.
2525
type GitRepositorySpec struct {
2626
// The repository URL, can be a HTTP or SSH address.
2727
// +kubebuilder:validation:Pattern="^(http|https|ssh)://"
2828
// +required
2929
URL string `json:"url"`
3030

3131
// The secret name containing the Git credentials.
32-
// For HTTPS repositories the secret must contain username and password fields.
33-
// For SSH repositories the secret must contain identity, identity.pub and known_hosts fields.
32+
// For HTTPS repositories the secret must contain username and password
33+
// fields.
34+
// For SSH repositories the secret must contain identity, identity.pub and
35+
// known_hosts fields.
3436
// +optional
3537
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
3638

3739
// The interval at which to check for repository updates.
3840
// +required
3941
Interval metav1.Duration `json:"interval"`
4042

41-
// The git reference to checkout and monitor for changes, defaults to master branch.
43+
// The git reference to checkout and monitor for changes, defaults to
44+
// master branch.
4245
// +optional
4346
Reference *GitRepositoryRef `json:"ref,omitempty"`
4447
}
4548

46-
// GitRepositoryRef defines the git ref used for pull and checkout operations
49+
// GitRepositoryRef defines the git ref used for pull and checkout operations.
4750
type GitRepositoryRef struct {
4851
// The git branch to checkout, defaults to master.
4952
// +optional
@@ -57,17 +60,19 @@ type GitRepositoryRef struct {
5760
// +optional
5861
SemVer string `json:"semver"`
5962

60-
// The git commit sha to checkout, if specified tag filters will be ignored.
63+
// The git commit sha to checkout, if specified tag filters will be
64+
// ignored.
6165
// +optional
6266
Commit string `json:"commit"`
6367
}
6468

65-
// GitRepositoryStatus defines the observed state of GitRepository
69+
// GitRepositoryStatus defines the observed state of the GitRepository.
6670
type GitRepositoryStatus struct {
6771
// +optional
6872
Conditions []SourceCondition `json:"conditions,omitempty"`
6973

70-
// URL is the download link for the artifact output of the last repository sync.
74+
// URL is the download link for the artifact output of the last repository
75+
// sync.
7176
// +optional
7277
URL string `json:"url,omitempty"`
7378

@@ -77,8 +82,13 @@ type GitRepositoryStatus struct {
7782
}
7883

7984
const (
85+
// GitOperationSucceedReason represents the fact that the git clone, pull
86+
// and checkout operations succeeded.
8087
GitOperationSucceedReason string = "GitOperationSucceed"
81-
GitOperationFailedReason string = "GitOperationFailed"
88+
89+
// GitOperationFailedReason represents the fact that the git clone, pull or
90+
// checkout operations failed.
91+
GitOperationFailedReason string = "GitOperationFailed"
8292
)
8393

8494
func GitRepositoryReady(repository GitRepository, artifact Artifact, url, reason, message string) GitRepository {

api/v1alpha1/groupversion_info.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ import (
2525
)
2626

2727
var (
28-
// GroupVersion is group version used to register these objects
28+
// GroupVersion is group version used to register these objects.
2929
GroupVersion = schema.GroupVersion{Group: "source.fluxcd.io", Version: "v1alpha1"}
3030

31-
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
31+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
3232
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
3333

3434
// AddToScheme adds the types in this group-version to the given scheme.

api/v1alpha1/helmchart_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
)
2323

24-
// HelmChartSpec defines the desired state of HelmChart
24+
// HelmChartSpec defines the desired state of a Helm chart.
2525
type HelmChartSpec struct {
2626
// The name of the Helm chart, as made available by the referenced
2727
// Helm repository.
@@ -39,10 +39,10 @@ type HelmChartSpec struct {
3939

4040
// The interval at which to check the Helm repository for updates.
4141
// +required
42-
Interval metav1.Duration `json:"interval,omitempty"`
42+
Interval metav1.Duration `json:"interval"`
4343
}
4444

45-
// HelmChartStatus defines the observed state of HelmChart
45+
// HelmChartStatus defines the observed state of the HelmChart.
4646
type HelmChartStatus struct {
4747
// +optional
4848
Conditions []SourceCondition `json:"conditions,omitempty"`
@@ -51,7 +51,7 @@ type HelmChartStatus struct {
5151
// +optional
5252
URL string `json:"url,omitempty"`
5353

54-
// URI for the artifact of the latest successful chart pull.
54+
// Artifact represents the output of the last successful chart sync.
5555
// +optional
5656
Artifact *Artifact `json:"artifact,omitempty"`
5757
}

api/v1alpha1/helmrepository_types.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
)
2323

24-
// HelmRepositorySpec defines the desired state of HelmRepository
24+
// HelmRepositorySpec defines the reference to a Helm repository.
2525
type HelmRepositorySpec struct {
2626
// The Helm repository URL, a valid URL contains at least a
2727
// protocol and host.
@@ -30,15 +30,18 @@ type HelmRepositorySpec struct {
3030

3131
// The name of the secret containing authentication credentials
3232
// for the Helm repository.
33+
// For HTTP/S basic auth the secret must contain username and password
34+
// fields.
35+
// For TLS the secret must contain caFile, keyFile and caCert fields.
3336
// +optional
3437
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
3538

36-
// The interval at which to check for repository updates
39+
// The interval at which to check the upstream for updates.
3740
// +required
3841
Interval metav1.Duration `json:"interval"`
3942
}
4043

41-
// HelmRepositoryStatus defines the observed state of HelmRepository
44+
// HelmRepositoryStatus defines the observed state of the HelmRepository.
4245
type HelmRepositoryStatus struct {
4346
// +optional
4447
Conditions []SourceCondition `json:"conditions,omitempty"`

config/crd/bases/source.fluxcd.io_gitrepositories.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ spec:
4747
metadata:
4848
type: object
4949
spec:
50-
description: GitRepositorySpec defines the desired state of GitRepository
50+
description: GitRepositorySpec defines the desired state of a Git repository.
5151
properties:
5252
interval:
5353
description: The interval at which to check for repository updates.
@@ -91,7 +91,7 @@ spec:
9191
- url
9292
type: object
9393
status:
94-
description: GitRepositoryStatus defines the observed state of GitRepository
94+
description: GitRepositoryStatus defines the observed state of the GitRepository.
9595
properties:
9696
artifact:
9797
description: Artifact represents the output of the last successful repository
@@ -120,7 +120,7 @@ spec:
120120
conditions:
121121
items:
122122
description: SourceCondition contains condition information for a
123-
source
123+
source.
124124
properties:
125125
lastTransitionTime:
126126
description: LastTransitionTime is the timestamp corresponding

config/crd/bases/source.fluxcd.io_helmcharts.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ spec:
5353
metadata:
5454
type: object
5555
spec:
56-
description: HelmChartSpec defines the desired state of HelmChart
56+
description: HelmChartSpec defines the desired state of a Helm chart.
5757
properties:
5858
helmRepositoryRef:
5959
description: The name of the HelmRepository the chart is available at.
@@ -77,13 +77,15 @@ spec:
7777
type: string
7878
required:
7979
- helmRepositoryRef
80+
- interval
8081
- name
8182
type: object
8283
status:
83-
description: HelmChartStatus defines the observed state of HelmChart
84+
description: HelmChartStatus defines the observed state of the HelmChart.
8485
properties:
8586
artifact:
86-
description: URI for the artifact of the latest successful chart pull.
87+
description: Artifact represents the output of the last successful chart
88+
sync.
8789
properties:
8890
lastUpdateTime:
8991
description: LastUpdateTime is the timestamp corresponding to the
@@ -108,7 +110,7 @@ spec:
108110
conditions:
109111
items:
110112
description: SourceCondition contains condition information for a
111-
source
113+
source.
112114
properties:
113115
lastTransitionTime:
114116
description: LastTransitionTime is the timestamp corresponding

config/crd/bases/source.fluxcd.io_helmrepositories.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ spec:
4747
metadata:
4848
type: object
4949
spec:
50-
description: HelmRepositorySpec defines the desired state of HelmRepository
50+
description: HelmRepositorySpec defines the reference to a Helm repository.
5151
properties:
5252
interval:
53-
description: The interval at which to check for repository updates
53+
description: The interval at which to check the upstream for updates.
5454
type: string
5555
secretRef:
5656
description: The name of the secret containing authentication credentials
57-
for the Helm repository.
57+
for the Helm repository. For HTTP/S basic auth the secret must contain
58+
username and password fields. For TLS the secret must contain caFile,
59+
keyFile and caCert fields.
5860
properties:
5961
name:
6062
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
@@ -70,7 +72,7 @@ spec:
7072
- url
7173
type: object
7274
status:
73-
description: HelmRepositoryStatus defines the observed state of HelmRepository
75+
description: HelmRepositoryStatus defines the observed state of the HelmRepository.
7476
properties:
7577
artifact:
7678
description: Artifact represents the output of the last successful repository
@@ -99,7 +101,7 @@ spec:
99101
conditions:
100102
items:
101103
description: SourceCondition contains condition information for a
102-
source
104+
source.
103105
properties:
104106
lastTransitionTime:
105107
description: LastTransitionTime is the timestamp corresponding

config/samples/source_v1alpha1_helmchart.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ spec:
77
version: '^2.0.0'
88
helmRepositoryRef:
99
name: helmrepository-sample
10+
interval: 1m

0 commit comments

Comments
 (0)