Skip to content

Commit 86d1d80

Browse files
committed
Document HelmRepository API v1beta2 spec
Signed-off-by: Hidde Beydals <[email protected]>
1 parent 5832296 commit 86d1d80

File tree

7 files changed

+716
-159
lines changed

7 files changed

+716
-159
lines changed

api/v1beta2/helmrepository_types.go

Lines changed: 40 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -28,82 +28,86 @@ import (
2828
const (
2929
// HelmRepositoryKind is the string representation of a HelmRepository.
3030
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.
3333
HelmRepositoryURLIndexKey = ".metadata.helmRepositoryURL"
3434
)
3535

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.
3738
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.
3941
// +required
4042
URL string `json:"url"`
4143

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.
4850
// +optional
4951
SecretRef *meta.LocalObjectReference `json:"secretRef,omitempty"`
5052

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.
5759
// +optional
5860
PassCredentials bool `json:"passCredentials,omitempty"`
5961

60-
// The interval at which to check the upstream for updates.
62+
// Interval at which to check the URL for updates.
6163
// +required
6264
Interval metav1.Duration `json:"interval"`
6365

64-
// The timeout of index fetching, defaults to 60s.
66+
// Timeout of the index fetch operation, defaults to 60s.
6567
// +kubebuilder:default:="60s"
6668
// +optional
6769
Timeout *metav1.Duration `json:"timeout,omitempty"`
6870

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.
7073
// +optional
7174
Suspend bool `json:"suspend,omitempty"`
7275

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
7479
// +optional
7580
AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`
7681
}
7782

78-
// HelmRepositoryStatus defines the observed state of the HelmRepository.
83+
// HelmRepositoryStatus records the observed state of the HelmRepository.
7984
type HelmRepositoryStatus struct {
80-
// ObservedGeneration is the last observed generation.
85+
// ObservedGeneration is the last observed generation of the HelmRepository
86+
// object.
8187
// +optional
8288
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
8389

8490
// Conditions holds the conditions for the HelmRepository.
8591
// +optional
8692
Conditions []metav1.Condition `json:"conditions,omitempty"`
8793

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.
8997
// +optional
9098
URL string `json:"url,omitempty"`
9199

92-
// Artifact represents the output of the last successful repository sync.
100+
// Artifact represents the last successful HelmRepository reconciliation.
93101
// +optional
94102
Artifact *Artifact `json:"artifact,omitempty"`
95103

96104
meta.ReconcileRequestStatus `json:",inline"`
97105
}
98106

99107
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.
102110
IndexationFailedReason string = "IndexationFailed"
103-
104-
// IndexationSucceededReason represents the fact that the indexation of the
105-
// given Helm repository succeeded.
106-
IndexationSucceededReason string = "IndexationSucceed"
107111
)
108112

109113
// GetConditions returns the status conditions of the object.
@@ -116,28 +120,18 @@ func (in *HelmRepository) SetConditions(conditions []metav1.Condition) {
116120
in.Status.Conditions = conditions
117121
}
118122

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.
120125
func (in HelmRepository) GetRequeueAfter() time.Duration {
121126
return in.Spec.Interval.Duration
122127
}
123128

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.
131131
func (in *HelmRepository) GetArtifact() *Artifact {
132132
return in.Status.Artifact
133133
}
134134

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-
141135
// +genclient
142136
// +genclient:Namespaced
143137
// +kubebuilder:storageversion
@@ -149,7 +143,7 @@ func (in *HelmRepository) GetStatusConditions() *[]metav1.Condition {
149143
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description=""
150144
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description=""
151145

152-
// HelmRepository is the Schema for the helmrepositories API
146+
// HelmRepository is the Schema for the helmrepositories API.
153147
type HelmRepository struct {
154148
metav1.TypeMeta `json:",inline"`
155149
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -159,7 +153,7 @@ type HelmRepository struct {
159153
Status HelmRepositoryStatus `json:"status,omitempty"`
160154
}
161155

162-
// HelmRepositoryList contains a list of HelmRepository
156+
// HelmRepositoryList contains a list of HelmRepository objects.
163157
// +kubebuilder:object:root=true
164158
type HelmRepositoryList struct {
165159
metav1.TypeMeta `json:",inline"`

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

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ spec:
253253
name: v1beta2
254254
schema:
255255
openAPIV3Schema:
256-
description: HelmRepository is the Schema for the helmrepositories API
256+
description: HelmRepository is the Schema for the helmrepositories API.
257257
properties:
258258
apiVersion:
259259
description: 'APIVersion defines the versioned schema of this representation
@@ -268,11 +268,13 @@ spec:
268268
metadata:
269269
type: object
270270
spec:
271-
description: HelmRepositorySpec defines the reference to a Helm repository.
271+
description: HelmRepositorySpec specifies the required configuration to
272+
produce an Artifact for a Helm repository index YAML.
272273
properties:
273274
accessFrom:
274-
description: AccessFrom defines an Access Control List for allowing
275-
cross-namespace references to this object.
275+
description: 'AccessFrom specifies an Access Control List for allowing
276+
cross-namespace references to this object. NOTE: Not implemented,
277+
provisional as of https://github.com/fluxcd/flux2/pull/2092'
276278
properties:
277279
namespaceSelectors:
278280
description: NamespaceSelectors is the list of namespace selectors
@@ -298,7 +300,7 @@ spec:
298300
- namespaceSelectors
299301
type: object
300302
interval:
301-
description: The interval at which to check the upstream for updates.
303+
description: Interval at which to check the URL for updates.
302304
type: string
303305
passCredentials:
304306
description: PassCredentials allows the credentials from the SecretRef
@@ -309,10 +311,10 @@ spec:
309311
getting stolen in a MITM-attack.
310312
type: boolean
311313
secretRef:
312-
description: The name of the secret containing authentication credentials
313-
for the Helm repository. For HTTP/S basic auth the secret must contain
314-
username and password fields. For TLS the secret must contain a
315-
certFile and keyFile, and/or caCert fields.
314+
description: SecretRef specifies the Secret containing authentication
315+
credentials for the HelmRepository. For HTTP/S basic auth the secret
316+
must contain 'username' and 'password' fields. For TLS the secret
317+
must contain a 'certFile' and 'keyFile', and/or 'caCert' fields.
316318
properties:
317319
name:
318320
description: Name of the referent.
@@ -321,15 +323,15 @@ spec:
321323
- name
322324
type: object
323325
suspend:
324-
description: This flag tells the controller to suspend the reconciliation
325-
of this source.
326+
description: Suspend tells the controller to suspend the reconciliation
327+
of this HelmRepository.
326328
type: boolean
327329
timeout:
328330
default: 60s
329-
description: The timeout of index fetching, defaults to 60s.
331+
description: Timeout of the index fetch operation, defaults to 60s.
330332
type: string
331333
url:
332-
description: The Helm repository URL, a valid URL contains at least
334+
description: URL of the Helm repository, a valid URL contains at least
333335
a protocol and host.
334336
type: string
335337
required:
@@ -339,11 +341,11 @@ spec:
339341
status:
340342
default:
341343
observedGeneration: -1
342-
description: HelmRepositoryStatus defines the observed state of the HelmRepository.
344+
description: HelmRepositoryStatus records the observed state of the HelmRepository.
343345
properties:
344346
artifact:
345-
description: Artifact represents the output of the last successful
346-
repository sync.
347+
description: Artifact represents the last successful HelmRepository
348+
reconciliation.
347349
properties:
348350
checksum:
349351
description: Checksum is the SHA256 checksum of the Artifact file.
@@ -453,11 +455,14 @@ spec:
453455
be detected.
454456
type: string
455457
observedGeneration:
456-
description: ObservedGeneration is the last observed generation.
458+
description: ObservedGeneration is the last observed generation of
459+
the HelmRepository object.
457460
format: int64
458461
type: integer
459462
url:
460-
description: URL is the fetch link for the last index fetched.
463+
description: URL is the dynamic fetch link for the latest Artifact.
464+
It is provided on a "best effort" basis, and using the precise HelmRepositoryStatus.Artifact
465+
data is recommended.
461466
type: string
462467
type: object
463468
type: object

0 commit comments

Comments
 (0)