Skip to content

Commit f59b48c

Browse files
darkowlzzhiddeco
authored andcommitted
Document HelmChart API v1beta2 spec
Signed-off-by: Sunny <[email protected]>
1 parent cbffd82 commit f59b48c

File tree

7 files changed

+684
-165
lines changed

7 files changed

+684
-165
lines changed

api/v1beta2/helmchart_types.go

Lines changed: 41 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -28,55 +28,60 @@ import (
2828
// HelmChartKind is the string representation of a HelmChart.
2929
const HelmChartKind = "HelmChart"
3030

31-
// HelmChartSpec defines the desired state of a Helm chart.
31+
// HelmChartSpec specifies the desired state of a Helm chart.
3232
type HelmChartSpec struct {
33-
// The name or path the Helm chart is available at in the SourceRef.
33+
// Chart is the name or path the Helm chart is available at in the
34+
// SourceRef.
3435
// +required
3536
Chart string `json:"chart"`
3637

37-
// The chart version semver expression, ignored for charts from GitRepository
38-
// and Bucket sources. Defaults to latest when omitted.
38+
// Version is the chart version semver expression, ignored for charts from
39+
// GitRepository and Bucket sources. Defaults to latest when omitted.
3940
// +kubebuilder:default:=*
4041
// +optional
4142
Version string `json:"version,omitempty"`
4243

43-
// The reference to the Source the chart is available at.
44+
// SourceRef is the reference to the Source the chart is available at.
4445
// +required
4546
SourceRef LocalHelmChartSourceReference `json:"sourceRef"`
4647

47-
// The interval at which to check the Source for updates.
48+
// Interval is the interval at which to check the Source for updates.
4849
// +required
4950
Interval metav1.Duration `json:"interval"`
5051

51-
// Determines what enables the creation of a new artifact. Valid values are
52-
// ('ChartVersion', 'Revision').
52+
// ReconcileStrategy determines what enables the creation of a new artifact.
53+
// Valid values are ('ChartVersion', 'Revision').
5354
// See the documentation of the values for an explanation on their behavior.
5455
// Defaults to ChartVersion when omitted.
5556
// +kubebuilder:validation:Enum=ChartVersion;Revision
5657
// +kubebuilder:default:=ChartVersion
5758
// +optional
5859
ReconcileStrategy string `json:"reconcileStrategy,omitempty"`
5960

60-
// Alternative list of values files to use as the chart values (values.yaml
61-
// is not included by default), expected to be a relative path in the SourceRef.
62-
// Values files are merged in the order of this list with the last file overriding
63-
// the first. Ignored when omitted.
61+
// ValuesFiles is an alternative list of values files to use as the chart
62+
// values (values.yaml is not included by default), expected to be a
63+
// relative path in the SourceRef.
64+
// Values files are merged in the order of this list with the last file
65+
// overriding the first. Ignored when omitted.
6466
// +optional
6567
ValuesFiles []string `json:"valuesFiles,omitempty"`
6668

67-
// Alternative values file to use as the default chart values, expected to
68-
// be a relative path in the SourceRef. Deprecated in favor of ValuesFiles,
69-
// for backwards compatibility the file defined here is merged before the
70-
// ValuesFiles items. Ignored when omitted.
69+
// ValuesFile is an alternative values file to use as the default chart
70+
// values, expected to be a relative path in the SourceRef. Deprecated in
71+
// favor of ValuesFiles, for backwards compatibility the file specified here
72+
// is merged before the ValuesFiles items. Ignored when omitted.
7173
// +optional
7274
// +deprecated
7375
ValuesFile string `json:"valuesFile,omitempty"`
7476

75-
// This flag tells the controller to suspend the reconciliation of this source.
77+
// Suspend tells the controller to suspend the reconciliation of this
78+
// source.
7679
// +optional
7780
Suspend bool `json:"suspend,omitempty"`
7881

79-
// AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
82+
// AccessFrom specifies an Access Control List for allowing cross-namespace
83+
// references to this object.
84+
// NOTE: Not implemented, provisional as of https://github.com/fluxcd/flux2/pull/2092
8085
// +optional
8186
AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`
8287
}
@@ -107,18 +112,19 @@ type LocalHelmChartSourceReference struct {
107112
Name string `json:"name"`
108113
}
109114

110-
// HelmChartStatus defines the observed state of the HelmChart.
115+
// HelmChartStatus records the observed state of the HelmChart.
111116
type HelmChartStatus struct {
112-
// ObservedGeneration is the last observed generation.
117+
// ObservedGeneration is the last observed generation of the HelmChart
118+
// object.
113119
// +optional
114120
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
115121

116122
// ObservedSourceArtifactRevision is the last observed Artifact.Revision
117-
// of the Source reference.
123+
// of the HelmChartSpec.SourceRef.
118124
// +optional
119125
ObservedSourceArtifactRevision string `json:"observedSourceArtifactRevision,omitempty"`
120126

121-
// ObservedChartName is the last observed chart name as defined by the
127+
// ObservedChartName is the last observed chart name as specified by the
122128
// resolved chart reference.
123129
// +optional
124130
ObservedChartName string `json:"observedChartName,omitempty"`
@@ -127,31 +133,25 @@ type HelmChartStatus struct {
127133
// +optional
128134
Conditions []metav1.Condition `json:"conditions,omitempty"`
129135

130-
// URL is the fetch link for the last chart pulled.
136+
// URL is the dynamic fetch link for the latest Artifact.
137+
// It is provided on a "best effort" basis, and using the precise
138+
// BucketStatus.Artifact data is recommended.
131139
// +optional
132140
URL string `json:"url,omitempty"`
133141

134-
// Artifact represents the output of the last successful chart sync.
142+
// Artifact represents the output of the last successful reconciliation.
135143
// +optional
136144
Artifact *Artifact `json:"artifact,omitempty"`
137145

138146
meta.ReconcileRequestStatus `json:",inline"`
139147
}
140148

141149
const (
142-
// ChartPullFailedReason represents the fact that the pull of the Helm chart
143-
// failed.
144-
ChartPullFailedReason string = "ChartPullFailed"
145-
146-
// ChartPullSucceededReason represents the fact that the pull of the Helm chart
150+
// ChartPullSucceededReason signals that the pull of the Helm chart
147151
// succeeded.
148152
ChartPullSucceededReason string = "ChartPullSucceeded"
149153

150-
// ChartPackageFailedReason represent the fact that the package of the Helm
151-
// chart failed.
152-
ChartPackageFailedReason string = "ChartPackageFailed"
153-
154-
// ChartPackageSucceededReason represents the fact that the package of the Helm
154+
// ChartPackageSucceededReason signals that the package of the Helm
155155
// chart succeeded.
156156
ChartPackageSucceededReason string = "ChartPackageSucceeded"
157157
)
@@ -166,23 +166,19 @@ func (in *HelmChart) SetConditions(conditions []metav1.Condition) {
166166
in.Status.Conditions = conditions
167167
}
168168

169-
// GetRequeueAfter returns the duration after which the source must be reconciled again.
169+
// GetRequeueAfter returns the duration after which the source must be
170+
// reconciled again.
170171
func (in HelmChart) GetRequeueAfter() time.Duration {
171172
return in.Spec.Interval.Duration
172173
}
173174

174-
// GetInterval returns the interval at which the source is reconciled.
175-
// Deprecated: use GetRequeueAfter instead.
176-
func (in HelmChart) GetInterval() metav1.Duration {
177-
return in.Spec.Interval
178-
}
179-
180-
// GetArtifact returns the latest artifact from the source if present in the status sub-resource.
175+
// GetArtifact returns the latest artifact from the source if present in the
176+
// status sub-resource.
181177
func (in *HelmChart) GetArtifact() *Artifact {
182178
return in.Status.Artifact
183179
}
184180

185-
// GetValuesFiles returns a merged list of ValuesFiles.
181+
// GetValuesFiles returns a merged list of HelmChartSpec.ValuesFiles.
186182
func (in *HelmChart) GetValuesFiles() []string {
187183
valuesFiles := in.Spec.ValuesFiles
188184

@@ -193,12 +189,6 @@ func (in *HelmChart) GetValuesFiles() []string {
193189
return valuesFiles
194190
}
195191

196-
// GetStatusConditions returns a pointer to the Status.Conditions slice.
197-
// Deprecated: use GetConditions instead.
198-
func (in *HelmChart) GetStatusConditions() *[]metav1.Condition {
199-
return &in.Status.Conditions
200-
}
201-
202192
// +genclient
203193
// +genclient:Namespaced
204194
// +kubebuilder:storageversion
@@ -213,7 +203,7 @@ func (in *HelmChart) GetStatusConditions() *[]metav1.Condition {
213203
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description=""
214204
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description=""
215205

216-
// HelmChart is the Schema for the helmcharts API
206+
// HelmChart is the Schema for the helmcharts API.
217207
type HelmChart struct {
218208
metav1.TypeMeta `json:",inline"`
219209
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -223,9 +213,8 @@ type HelmChart struct {
223213
Status HelmChartStatus `json:"status,omitempty"`
224214
}
225215

216+
// HelmChartList contains a list of HelmChart objects.
226217
// +kubebuilder:object:root=true
227-
228-
// HelmChartList contains a list of HelmChart
229218
type HelmChartList struct {
230219
metav1.TypeMeta `json:",inline"`
231220
metav1.ListMeta `json:"metadata,omitempty"`

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

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ spec:
299299
name: v1beta2
300300
schema:
301301
openAPIV3Schema:
302-
description: HelmChart is the Schema for the helmcharts API
302+
description: HelmChart is the Schema for the helmcharts API.
303303
properties:
304304
apiVersion:
305305
description: 'APIVersion defines the versioned schema of this representation
@@ -314,11 +314,12 @@ spec:
314314
metadata:
315315
type: object
316316
spec:
317-
description: HelmChartSpec defines the desired state of a Helm chart.
317+
description: HelmChartSpec specifies the desired state of a Helm chart.
318318
properties:
319319
accessFrom:
320-
description: AccessFrom defines an Access Control List for allowing
321-
cross-namespace references to this object.
320+
description: 'AccessFrom specifies an Access Control List for allowing
321+
cross-namespace references to this object. NOTE: Not implemented,
322+
provisional as of https://github.com/fluxcd/flux2/pull/2092'
322323
properties:
323324
namespaceSelectors:
324325
description: NamespaceSelectors is the list of namespace selectors
@@ -344,24 +345,26 @@ spec:
344345
- namespaceSelectors
345346
type: object
346347
chart:
347-
description: The name or path the Helm chart is available at in the
348-
SourceRef.
348+
description: Chart is the name or path the Helm chart is available
349+
at in the SourceRef.
349350
type: string
350351
interval:
351-
description: The interval at which to check the Source for updates.
352+
description: Interval is the interval at which to check the Source
353+
for updates.
352354
type: string
353355
reconcileStrategy:
354356
default: ChartVersion
355-
description: Determines what enables the creation of a new artifact.
356-
Valid values are ('ChartVersion', 'Revision'). See the documentation
357-
of the values for an explanation on their behavior. Defaults to
358-
ChartVersion when omitted.
357+
description: ReconcileStrategy determines what enables the creation
358+
of a new artifact. Valid values are ('ChartVersion', 'Revision').
359+
See the documentation of the values for an explanation on their
360+
behavior. Defaults to ChartVersion when omitted.
359361
enum:
360362
- ChartVersion
361363
- Revision
362364
type: string
363365
sourceRef:
364-
description: The reference to the Source the chart is available at.
366+
description: SourceRef is the reference to the Source the chart is
367+
available at.
365368
properties:
366369
apiVersion:
367370
description: APIVersion of the referent.
@@ -382,28 +385,30 @@ spec:
382385
- name
383386
type: object
384387
suspend:
385-
description: This flag tells the controller to suspend the reconciliation
388+
description: Suspend tells the controller to suspend the reconciliation
386389
of this source.
387390
type: boolean
388391
valuesFile:
389-
description: Alternative values file to use as the default chart values,
390-
expected to be a relative path in the SourceRef. Deprecated in favor
391-
of ValuesFiles, for backwards compatibility the file defined here
392-
is merged before the ValuesFiles items. Ignored when omitted.
392+
description: ValuesFile is an alternative values file to use as the
393+
default chart values, expected to be a relative path in the SourceRef.
394+
Deprecated in favor of ValuesFiles, for backwards compatibility
395+
the file specified here is merged before the ValuesFiles items.
396+
Ignored when omitted.
393397
type: string
394398
valuesFiles:
395-
description: Alternative list of values files to use as the chart
396-
values (values.yaml is not included by default), expected to be
397-
a relative path in the SourceRef. Values files are merged in the
398-
order of this list with the last file overriding the first. Ignored
399-
when omitted.
399+
description: ValuesFiles is an alternative list of values files to
400+
use as the chart values (values.yaml is not included by default),
401+
expected to be a relative path in the SourceRef. Values files are
402+
merged in the order of this list with the last file overriding the
403+
first. Ignored when omitted.
400404
items:
401405
type: string
402406
type: array
403407
version:
404408
default: '*'
405-
description: The chart version semver expression, ignored for charts
406-
from GitRepository and Bucket sources. Defaults to latest when omitted.
409+
description: Version is the chart version semver expression, ignored
410+
for charts from GitRepository and Bucket sources. Defaults to latest
411+
when omitted.
407412
type: string
408413
required:
409414
- chart
@@ -413,11 +418,11 @@ spec:
413418
status:
414419
default:
415420
observedGeneration: -1
416-
description: HelmChartStatus defines the observed state of the HelmChart.
421+
description: HelmChartStatus records the observed state of the HelmChart.
417422
properties:
418423
artifact:
419424
description: Artifact represents the output of the last successful
420-
chart sync.
425+
reconciliation.
421426
properties:
422427
checksum:
423428
description: Checksum is the SHA256 checksum of the Artifact file.
@@ -528,18 +533,21 @@ spec:
528533
type: string
529534
observedChartName:
530535
description: ObservedChartName is the last observed chart name as
531-
defined by the resolved chart reference.
536+
specified by the resolved chart reference.
532537
type: string
533538
observedGeneration:
534-
description: ObservedGeneration is the last observed generation.
539+
description: ObservedGeneration is the last observed generation of
540+
the HelmChart object.
535541
format: int64
536542
type: integer
537543
observedSourceArtifactRevision:
538544
description: ObservedSourceArtifactRevision is the last observed Artifact.Revision
539-
of the Source reference.
545+
of the HelmChartSpec.SourceRef.
540546
type: string
541547
url:
542-
description: URL is the fetch link for the last chart pulled.
548+
description: URL is the dynamic fetch link for the latest Artifact.
549+
It is provided on a "best effort" basis, and using the precise BucketStatus.Artifact
550+
data is recommended.
543551
type: string
544552
type: object
545553
type: object

0 commit comments

Comments
 (0)