Skip to content

Commit 45df2d7

Browse files
darkowlzzhiddeco
authored andcommitted
Update API descriptions and messages to be consistent
- Update v1beta2 API descriptions and reconciling messages to be consistent. - Replace 'download' with 'fetch'. Since the status condition for download failure is called FetchFailed, using the term 'fetch' makes the messaging more consistent. - Replace `BucketOperationSucceed` with `BucketOperationSucceeded` and generate api docs. Signed-off-by: Sunny <[email protected]>
1 parent d997876 commit 45df2d7

16 files changed

+113
-53
lines changed

api/v1beta2/artifact_types.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,17 @@ import (
2323
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2424
)
2525

26-
// Artifact represents the output of a source synchronisation.
26+
// Artifact represents the output of a Source synchronisation.
2727
type Artifact struct {
28-
// Path is the relative file path of this artifact.
28+
// Path is the relative file path of this Artifact.
29+
// It can be used to locate the Artifact file in the root of the Artifact
30+
// storage on the local file system of the controller managing the Source.
2931
// +required
3032
Path string `json:"path"`
3133

3234
// URL is the HTTP address of this artifact.
35+
// It is used by the consumers of the artifacts to fetch and use the
36+
// artifacts. It is expected to be resolvable from within the cluster.
3337
// +required
3438
URL string `json:"url"`
3539

api/v1beta2/bucket_types.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type BucketSpec struct {
6969
// +required
7070
Interval metav1.Duration `json:"interval"`
7171

72-
// The timeout for download operations, defaults to 60s.
72+
// The timeout for fetch operations, defaults to 60s.
7373
// +kubebuilder:default="60s"
7474
// +optional
7575
Timeout *metav1.Duration `json:"timeout,omitempty"`
@@ -99,7 +99,7 @@ type BucketStatus struct {
9999
// +optional
100100
Conditions []metav1.Condition `json:"conditions,omitempty"`
101101

102-
// URL is the download link for the artifact output of the last Bucket sync.
102+
// URL is the fetch link for the artifact output of the last Bucket sync.
103103
// +optional
104104
URL string `json:"url,omitempty"`
105105

@@ -111,12 +111,12 @@ type BucketStatus struct {
111111
}
112112

113113
const (
114-
// BucketOperationSucceedReason represents the fact that the bucket listing and
115-
// download operations succeeded.
116-
BucketOperationSucceedReason string = "BucketOperationSucceed"
114+
// BucketOperationSucceededReason represents the fact that the bucket listing and
115+
// fetch operations succeeded.
116+
BucketOperationSucceededReason string = "BucketOperationSucceeded"
117117

118118
// BucketOperationFailedReason represents the fact that the bucket listing or
119-
// download operations failed.
119+
// fetch operations failed.
120120
BucketOperationFailedReason string = "BucketOperationFailed"
121121
)
122122

api/v1beta2/gitrepository_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ type GitRepositoryStatus struct {
168168
// +optional
169169
Conditions []metav1.Condition `json:"conditions,omitempty"`
170170

171-
// URL is the download link for the artifact output of the last repository sync.
171+
// URL is the fetch link for the artifact output of the last repository sync.
172172
// +optional
173173
URL string `json:"url,omitempty"`
174174

api/v1beta2/helmchart_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ type HelmChartStatus struct {
127127
// +optional
128128
Conditions []metav1.Condition `json:"conditions,omitempty"`
129129

130-
// URL is the download link for the last chart pulled.
130+
// URL is the fetch link for the last chart pulled.
131131
// +optional
132132
URL string `json:"url,omitempty"`
133133

api/v1beta2/helmrepository_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ type HelmRepositorySpec struct {
6161
// +required
6262
Interval metav1.Duration `json:"interval"`
6363

64-
// The timeout of index downloading, defaults to 60s.
64+
// The timeout of index fetching, defaults to 60s.
6565
// +kubebuilder:default:="60s"
6666
// +optional
6767
Timeout *metav1.Duration `json:"timeout,omitempty"`
@@ -85,7 +85,7 @@ type HelmRepositoryStatus struct {
8585
// +optional
8686
Conditions []metav1.Condition `json:"conditions,omitempty"`
8787

88-
// URL is the download link for the last index fetched.
88+
// URL is the fetch link for the last index fetched.
8989
// +optional
9090
URL string `json:"url,omitempty"`
9191

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ spec:
356356
type: boolean
357357
timeout:
358358
default: 60s
359-
description: The timeout for download operations, defaults to 60s.
359+
description: The timeout for fetch operations, defaults to 60s.
360360
type: string
361361
required:
362362
- bucketName
@@ -381,15 +381,20 @@ spec:
381381
format: date-time
382382
type: string
383383
path:
384-
description: Path is the relative file path of this artifact.
384+
description: Path is the relative file path of this Artifact.
385+
It can be used to locate the Artifact file in the root of the
386+
Artifact storage on the local file system of the controller
387+
managing the Source.
385388
type: string
386389
revision:
387390
description: Revision is a human readable identifier traceable
388391
in the origin source system. It can be a Git commit SHA, Git
389392
tag, a Helm index timestamp, a Helm chart version, etc.
390393
type: string
391394
url:
392-
description: URL is the HTTP address of this artifact.
395+
description: URL is the HTTP address of this artifact. It is used
396+
by the consumers of the artifacts to fetch and use the artifacts.
397+
It is expected to be resolvable from within the cluster.
393398
type: string
394399
required:
395400
- path
@@ -475,7 +480,7 @@ spec:
475480
format: int64
476481
type: integer
477482
url:
478-
description: URL is the download link for the artifact output of the
483+
description: URL is the fetch link for the artifact output of the
479484
last Bucket sync.
480485
type: string
481486
type: object

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -549,15 +549,20 @@ spec:
549549
format: date-time
550550
type: string
551551
path:
552-
description: Path is the relative file path of this artifact.
552+
description: Path is the relative file path of this Artifact.
553+
It can be used to locate the Artifact file in the root of the
554+
Artifact storage on the local file system of the controller
555+
managing the Source.
553556
type: string
554557
revision:
555558
description: Revision is a human readable identifier traceable
556559
in the origin source system. It can be a Git commit SHA, Git
557560
tag, a Helm index timestamp, a Helm chart version, etc.
558561
type: string
559562
url:
560-
description: URL is the HTTP address of this artifact.
563+
description: URL is the HTTP address of this artifact. It is used
564+
by the consumers of the artifacts to fetch and use the artifacts.
565+
It is expected to be resolvable from within the cluster.
561566
type: string
562567
required:
563568
- path
@@ -637,7 +642,7 @@ spec:
637642
description: IncludedArtifacts represents the included artifacts from
638643
the last successful repository sync.
639644
items:
640-
description: Artifact represents the output of a source synchronisation.
645+
description: Artifact represents the output of a Source synchronisation.
641646
properties:
642647
checksum:
643648
description: Checksum is the SHA256 checksum of the artifact.
@@ -648,15 +653,21 @@ spec:
648653
format: date-time
649654
type: string
650655
path:
651-
description: Path is the relative file path of this artifact.
656+
description: Path is the relative file path of this Artifact.
657+
It can be used to locate the Artifact file in the root of
658+
the Artifact storage on the local file system of the controller
659+
managing the Source.
652660
type: string
653661
revision:
654662
description: Revision is a human readable identifier traceable
655663
in the origin source system. It can be a Git commit SHA, Git
656664
tag, a Helm index timestamp, a Helm chart version, etc.
657665
type: string
658666
url:
659-
description: URL is the HTTP address of this artifact.
667+
description: URL is the HTTP address of this artifact. It is
668+
used by the consumers of the artifacts to fetch and use the
669+
artifacts. It is expected to be resolvable from within the
670+
cluster.
660671
type: string
661672
required:
662673
- path
@@ -673,7 +684,7 @@ spec:
673684
format: int64
674685
type: integer
675686
url:
676-
description: URL is the download link for the artifact output of the
687+
description: URL is the fetch link for the artifact output of the
677688
last repository sync.
678689
type: string
679690
type: object

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,15 +428,20 @@ spec:
428428
format: date-time
429429
type: string
430430
path:
431-
description: Path is the relative file path of this artifact.
431+
description: Path is the relative file path of this Artifact.
432+
It can be used to locate the Artifact file in the root of the
433+
Artifact storage on the local file system of the controller
434+
managing the Source.
432435
type: string
433436
revision:
434437
description: Revision is a human readable identifier traceable
435438
in the origin source system. It can be a Git commit SHA, Git
436439
tag, a Helm index timestamp, a Helm chart version, etc.
437440
type: string
438441
url:
439-
description: URL is the HTTP address of this artifact.
442+
description: URL is the HTTP address of this artifact. It is used
443+
by the consumers of the artifacts to fetch and use the artifacts.
444+
It is expected to be resolvable from within the cluster.
440445
type: string
441446
required:
442447
- path
@@ -530,7 +535,7 @@ spec:
530535
of the Source reference.
531536
type: string
532537
url:
533-
description: URL is the download link for the last chart pulled.
538+
description: URL is the fetch link for the last chart pulled.
534539
type: string
535540
type: object
536541
type: object

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ spec:
326326
type: boolean
327327
timeout:
328328
default: 60s
329-
description: The timeout of index downloading, defaults to 60s.
329+
description: The timeout of index fetching, defaults to 60s.
330330
type: string
331331
url:
332332
description: The Helm repository URL, a valid URL contains at least
@@ -354,15 +354,20 @@ spec:
354354
format: date-time
355355
type: string
356356
path:
357-
description: Path is the relative file path of this artifact.
357+
description: Path is the relative file path of this Artifact.
358+
It can be used to locate the Artifact file in the root of the
359+
Artifact storage on the local file system of the controller
360+
managing the Source.
358361
type: string
359362
revision:
360363
description: Revision is a human readable identifier traceable
361364
in the origin source system. It can be a Git commit SHA, Git
362365
tag, a Helm index timestamp, a Helm chart version, etc.
363366
type: string
364367
url:
365-
description: URL is the HTTP address of this artifact.
368+
description: URL is the HTTP address of this artifact. It is used
369+
by the consumers of the artifacts to fetch and use the artifacts.
370+
It is expected to be resolvable from within the cluster.
366371
type: string
367372
required:
368373
- path
@@ -448,7 +453,7 @@ spec:
448453
format: int64
449454
type: integer
450455
url:
451-
description: URL is the download link for the last index fetched.
456+
description: URL is the fetch link for the last index fetched.
452457
type: string
453458
type: object
454459
type: object

controllers/bucket_controller.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func (r *BucketReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
196196
// error.
197197
func (r *BucketReconciler) reconcile(ctx context.Context, obj *sourcev1.Bucket, reconcilers []bucketReconcilerFunc) (sreconcile.Result, error) {
198198
if obj.Generation != obj.Status.ObservedGeneration {
199-
conditions.MarkReconciling(obj, "NewGeneration", "reconciling new generation %d", obj.Generation)
199+
conditions.MarkReconciling(obj, "NewGeneration", "reconciling new object generation (%d)", obj.Generation)
200200
}
201201

202202
var artifact sourcev1.Artifact
@@ -432,14 +432,14 @@ func (r *BucketReconciler) reconcileMinioSource(ctx context.Context, obj *source
432432
})
433433
if err = group.Wait(); err != nil {
434434
e := &serror.Event{
435-
Err: fmt.Errorf("download from bucket '%s' failed: %w", obj.Spec.BucketName, err),
435+
Err: fmt.Errorf("fetch from bucket '%s' failed: %w", obj.Spec.BucketName, err),
436436
Reason: sourcev1.BucketOperationFailedReason,
437437
}
438438
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, sourcev1.BucketOperationFailedReason, e.Err.Error())
439439
return sreconcile.ResultEmpty, e
440440
}
441-
r.eventLogf(ctx, obj, events.EventTypeTrace, sourcev1.BucketOperationSucceedReason,
442-
"downloaded %d files with revision '%s' from '%s'", len(index), revision, obj.Spec.BucketName)
441+
r.eventLogf(ctx, obj, events.EventTypeTrace, sourcev1.BucketOperationSucceededReason,
442+
"fetched %d files with revision '%s' from '%s'", len(index), revision, obj.Spec.BucketName)
443443
}
444444
conditions.Delete(obj, sourcev1.FetchFailedCondition)
445445

@@ -587,14 +587,14 @@ func (r *BucketReconciler) reconcileGCPSource(ctx context.Context, obj *sourcev1
587587
})
588588
if err = group.Wait(); err != nil {
589589
e := &serror.Event{
590-
Err: fmt.Errorf("download from bucket '%s' failed: %w", obj.Spec.BucketName, err),
590+
Err: fmt.Errorf("fetch from bucket '%s' failed: %w", obj.Spec.BucketName, err),
591591
Reason: sourcev1.BucketOperationFailedReason,
592592
}
593593
conditions.MarkTrue(obj, sourcev1.FetchFailedCondition, sourcev1.BucketOperationFailedReason, e.Err.Error())
594594
return sreconcile.ResultEmpty, e
595595
}
596-
r.eventLogf(ctx, obj, events.EventTypeTrace, sourcev1.BucketOperationSucceedReason,
597-
"downloaded %d files from bucket '%s'", len(index), obj.Spec.BucketName)
596+
r.eventLogf(ctx, obj, events.EventTypeTrace, sourcev1.BucketOperationSucceededReason,
597+
"fetched %d files from bucket '%s'", len(index), obj.Spec.BucketName)
598598
}
599599
conditions.Delete(obj, sourcev1.FetchFailedCondition)
600600

0 commit comments

Comments
 (0)