@@ -28,82 +28,86 @@ import (
28
28
const (
29
29
// HelmRepositoryKind is the string representation of a HelmRepository.
30
30
HelmRepositoryKind = "HelmRepository"
31
- // HelmRepositoryURLIndexKey is the key to use for indexing HelmRepository
32
- // resources by their HelmRepositorySpec.URL.
31
+ // HelmRepositoryURLIndexKey is the key used for indexing HelmRepository
32
+ // objects by their HelmRepositorySpec.URL.
33
33
HelmRepositoryURLIndexKey = ".metadata.helmRepositoryURL"
34
34
)
35
35
36
- // HelmRepositorySpec defines the reference to a Helm repository.
36
+ // HelmRepositorySpec specifies the required configuration to produce an
37
+ // Artifact for a Helm repository index YAML.
37
38
type HelmRepositorySpec struct {
38
- // The Helm repository URL, a valid URL contains at least a protocol and host.
39
+ // URL of the Helm repository, a valid URL contains at least a protocol and
40
+ // host.
39
41
// +required
40
42
URL string `json:"url"`
41
43
42
- // The name of the secret containing authentication credentials for the Helm
43
- // repository .
44
- // For HTTP/S basic auth the secret must contain username and
45
- // password fields.
46
- // For TLS the secret must contain a certFile and keyFile, and/or
47
- // caCert fields.
44
+ // SecretRef specifies the Secret containing authentication credentials
45
+ // for the HelmRepository .
46
+ // For HTTP/S basic auth the secret must contain ' username' and 'password'
47
+ // fields.
48
+ // For TLS the secret must contain a ' certFile' and ' keyFile' , and/or
49
+ // ' caCert' fields.
48
50
// +optional
49
51
SecretRef * meta.LocalObjectReference `json:"secretRef,omitempty"`
50
52
51
- // PassCredentials allows the credentials from the SecretRef to be passed on to
52
- // a host that does not match the host as defined in URL.
53
- // This may be required if the host of the advertised chart URLs in the index
54
- // differ from the defined URL.
55
- // Enabling this should be done with caution, as it can potentially result in
56
- // credentials getting stolen in a MITM-attack.
53
+ // PassCredentials allows the credentials from the SecretRef to be passed
54
+ // on to a host that does not match the host as defined in URL.
55
+ // This may be required if the host of the advertised chart URLs in the
56
+ // index differ from the defined URL.
57
+ // Enabling this should be done with caution, as it can potentially result
58
+ // in credentials getting stolen in a MITM-attack.
57
59
// +optional
58
60
PassCredentials bool `json:"passCredentials,omitempty"`
59
61
60
- // The interval at which to check the upstream for updates.
62
+ // Interval at which to check the URL for updates.
61
63
// +required
62
64
Interval metav1.Duration `json:"interval"`
63
65
64
- // The timeout of index fetching , defaults to 60s.
66
+ // Timeout of the index fetch operation , defaults to 60s.
65
67
// +kubebuilder:default:="60s"
66
68
// +optional
67
69
Timeout * metav1.Duration `json:"timeout,omitempty"`
68
70
69
- // This flag tells the controller to suspend the reconciliation of this source.
71
+ // Suspend tells the controller to suspend the reconciliation of this
72
+ // HelmRepository.
70
73
// +optional
71
74
Suspend bool `json:"suspend,omitempty"`
72
75
73
- // AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
76
+ // AccessFrom specifies an Access Control List for allowing cross-namespace
77
+ // references to this object.
78
+ // NOTE: Not implemented, provisional as of https://github.com/fluxcd/flux2/pull/2092
74
79
// +optional
75
80
AccessFrom * acl.AccessFrom `json:"accessFrom,omitempty"`
76
81
}
77
82
78
- // HelmRepositoryStatus defines the observed state of the HelmRepository.
83
+ // HelmRepositoryStatus records the observed state of the HelmRepository.
79
84
type HelmRepositoryStatus struct {
80
- // ObservedGeneration is the last observed generation.
85
+ // ObservedGeneration is the last observed generation of the HelmRepository
86
+ // object.
81
87
// +optional
82
88
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
83
89
84
90
// Conditions holds the conditions for the HelmRepository.
85
91
// +optional
86
92
Conditions []metav1.Condition `json:"conditions,omitempty"`
87
93
88
- // URL is the fetch link for the last index fetched.
94
+ // URL is the dynamic fetch link for the latest Artifact.
95
+ // It is provided on a "best effort" basis, and using the precise
96
+ // HelmRepositoryStatus.Artifact data is recommended.
89
97
// +optional
90
98
URL string `json:"url,omitempty"`
91
99
92
- // Artifact represents the output of the last successful repository sync .
100
+ // Artifact represents the last successful HelmRepository reconciliation .
93
101
// +optional
94
102
Artifact * Artifact `json:"artifact,omitempty"`
95
103
96
104
meta.ReconcileRequestStatus `json:",inline"`
97
105
}
98
106
99
107
const (
100
- // IndexationFailedReason represents the fact that the indexation of the given
101
- // Helm repository failed.
108
+ // IndexationFailedReason signals that the HelmRepository index fetch
109
+ // failed.
102
110
IndexationFailedReason string = "IndexationFailed"
103
-
104
- // IndexationSucceededReason represents the fact that the indexation of the
105
- // given Helm repository succeeded.
106
- IndexationSucceededReason string = "IndexationSucceed"
107
111
)
108
112
109
113
// GetConditions returns the status conditions of the object.
@@ -116,28 +120,18 @@ func (in *HelmRepository) SetConditions(conditions []metav1.Condition) {
116
120
in .Status .Conditions = conditions
117
121
}
118
122
119
- // GetRequeueAfter returns the duration after which the source must be reconciled again.
123
+ // GetRequeueAfter returns the duration after which the source must be
124
+ // reconciled again.
120
125
func (in HelmRepository ) GetRequeueAfter () time.Duration {
121
126
return in .Spec .Interval .Duration
122
127
}
123
128
124
- // GetInterval returns the interval at which the source is reconciled.
125
- // Deprecated: use GetRequeueAfter instead.
126
- func (in HelmRepository ) GetInterval () metav1.Duration {
127
- return in .Spec .Interval
128
- }
129
-
130
- // GetArtifact returns the latest artifact from the source if present in the status sub-resource.
129
+ // GetArtifact returns the latest artifact from the source if present in the
130
+ // status sub-resource.
131
131
func (in * HelmRepository ) GetArtifact () * Artifact {
132
132
return in .Status .Artifact
133
133
}
134
134
135
- // GetStatusConditions returns a pointer to the Status.Conditions slice.
136
- // Deprecated: use GetConditions instead.
137
- func (in * HelmRepository ) GetStatusConditions () * []metav1.Condition {
138
- return & in .Status .Conditions
139
- }
140
-
141
135
// +genclient
142
136
// +genclient:Namespaced
143
137
// +kubebuilder:storageversion
@@ -149,7 +143,7 @@ func (in *HelmRepository) GetStatusConditions() *[]metav1.Condition {
149
143
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description=""
150
144
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description=""
151
145
152
- // HelmRepository is the Schema for the helmrepositories API
146
+ // HelmRepository is the Schema for the helmrepositories API.
153
147
type HelmRepository struct {
154
148
metav1.TypeMeta `json:",inline"`
155
149
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -159,7 +153,7 @@ type HelmRepository struct {
159
153
Status HelmRepositoryStatus `json:"status,omitempty"`
160
154
}
161
155
162
- // HelmRepositoryList contains a list of HelmRepository
156
+ // HelmRepositoryList contains a list of HelmRepository objects.
163
157
// +kubebuilder:object:root=true
164
158
type HelmRepositoryList struct {
165
159
metav1.TypeMeta `json:",inline"`
0 commit comments