Skip to content

Commit 7c41249

Browse files
authored
Merge pull request #599 from fluxcd/spec-docs-v1beta2
2 parents ccadce6 + 971caf9 commit 7c41249

26 files changed

+3941
-802
lines changed

api/v1beta2/artifact_types.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,31 @@ 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 reconciliation.
2727
type Artifact struct {
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.
28+
// Path is the relative file path of the Artifact. It can be used to locate
29+
// the file in the root of the Artifact storage on the local file system of
30+
// the controller managing the Source.
3131
// +required
3232
Path string `json:"path"`
3333

34-
// 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.
34+
// URL is the HTTP address of the Artifact as exposed by the controller
35+
// managing the Source. It can be used to retrieve the Artifact for
36+
// consumption, e.g. by another controller applying the Artifact contents.
3737
// +required
3838
URL string `json:"url"`
3939

40-
// Revision is a human readable identifier traceable in the origin source
41-
// system. It can be a Git commit SHA, Git tag, a Helm index timestamp, a Helm
42-
// chart version, etc.
40+
// Revision is a human-readable identifier traceable in the origin source
41+
// system. It can be a Git commit SHA, Git tag, a Helm chart version, etc.
4342
// +optional
4443
Revision string `json:"revision"`
4544

46-
// Checksum is the SHA256 checksum of the artifact.
45+
// Checksum is the SHA256 checksum of the Artifact file.
4746
// +optional
4847
Checksum string `json:"checksum"`
4948

50-
// LastUpdateTime is the timestamp corresponding to the last update of this
51-
// artifact.
49+
// LastUpdateTime is the timestamp corresponding to the last update of the
50+
// Artifact.
5251
// +required
5352
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
5453

@@ -67,14 +66,14 @@ func (in *Artifact) HasRevision(revision string) bool {
6766
}
6867

6968
// ArtifactDir returns the artifact dir path in the form of
70-
// <source-kind>/<source-namespace>/<source-name>.
69+
// '<kind>/<namespace>/<name>'.
7170
func ArtifactDir(kind, namespace, name string) string {
7271
kind = strings.ToLower(kind)
7372
return path.Join(kind, namespace, name)
7473
}
7574

7675
// ArtifactPath returns the artifact path in the form of
77-
// <source-kind>/<source-namespace>/<source-name>/<artifact-filename>.
76+
// '<kind>/<namespace>/name>/<filename>'.
7877
func ArtifactPath(kind, namespace, name, filename string) string {
7978
return path.Join(ArtifactDir(kind, namespace, name), filename)
8079
}

api/v1beta2/bucket_types.go

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,57 @@ const (
3131
)
3232

3333
const (
34+
// GenericBucketProvider for any S3 API compatible storage Bucket.
3435
GenericBucketProvider string = "generic"
35-
AmazonBucketProvider string = "aws"
36-
GoogleBucketProvider string = "gcp"
37-
AzureBucketProvider string = "azure"
36+
// AmazonBucketProvider for an AWS S3 object storage Bucket.
37+
// Provides support for retrieving credentials from the AWS EC2 service.
38+
AmazonBucketProvider string = "aws"
39+
// GoogleBucketProvider for a Google Cloud Storage Bucket.
40+
// Provides support for authentication using a workload identity.
41+
GoogleBucketProvider string = "gcp"
42+
// AzureBucketProvider for an Azure Blob Storage Bucket.
43+
// Provides support for authentication using a Service Principal,
44+
// Managed Identity or Shared Key.
45+
AzureBucketProvider string = "azure"
3846
)
3947

40-
// BucketSpec defines the desired state of an S3 compatible bucket
48+
// BucketSpec specifies the required configuration to produce an Artifact for
49+
// an object storage bucket.
4150
type BucketSpec struct {
42-
// The S3 compatible storage provider name, default ('generic').
51+
// Provider of the object storage bucket.
52+
// Defaults to 'generic', which expects an S3 (API) compatible object
53+
// storage.
4354
// +kubebuilder:validation:Enum=generic;aws;gcp;azure
4455
// +kubebuilder:default:=generic
4556
// +optional
4657
Provider string `json:"provider,omitempty"`
4758

48-
// The bucket name.
59+
// BucketName is the name of the object storage bucket.
4960
// +required
5061
BucketName string `json:"bucketName"`
5162

52-
// The bucket endpoint address.
63+
// Endpoint is the object storage address the BucketName is located at.
5364
// +required
5465
Endpoint string `json:"endpoint"`
5566

56-
// Insecure allows connecting to a non-TLS S3 HTTP endpoint.
67+
// Insecure allows connecting to a non-TLS HTTP Endpoint.
5768
// +optional
5869
Insecure bool `json:"insecure,omitempty"`
5970

60-
// The bucket region.
71+
// Region of the Endpoint where the BucketName is located in.
6172
// +optional
6273
Region string `json:"region,omitempty"`
6374

64-
// The name of the secret containing authentication credentials
75+
// SecretRef specifies the Secret containing authentication credentials
6576
// for the Bucket.
6677
// +optional
6778
SecretRef *meta.LocalObjectReference `json:"secretRef,omitempty"`
6879

69-
// The interval at which to check for bucket updates.
80+
// Interval at which to check the Endpoint for updates.
7081
// +required
7182
Interval metav1.Duration `json:"interval"`
7283

73-
// The timeout for fetch operations, defaults to 60s.
84+
// Timeout for fetch operations, defaults to 60s.
7485
// +kubebuilder:default="60s"
7586
// +optional
7687
Timeout *metav1.Duration `json:"timeout,omitempty"`
@@ -81,43 +92,48 @@ type BucketSpec struct {
8192
// +optional
8293
Ignore *string `json:"ignore,omitempty"`
8394

84-
// This flag tells the controller to suspend the reconciliation of this source.
95+
// Suspend tells the controller to suspend the reconciliation of this
96+
// Bucket.
8597
// +optional
8698
Suspend bool `json:"suspend,omitempty"`
8799

88-
// AccessFrom defines an Access Control List for allowing cross-namespace references to this object.
100+
// AccessFrom specifies an Access Control List for allowing cross-namespace
101+
// references to this object.
102+
// NOTE: Not implemented, provisional as of https://github.com/fluxcd/flux2/pull/2092
89103
// +optional
90104
AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`
91105
}
92106

93-
// BucketStatus defines the observed state of a bucket
107+
// BucketStatus records the observed state of a Bucket.
94108
type BucketStatus struct {
95-
// ObservedGeneration is the last observed generation.
109+
// ObservedGeneration is the last observed generation of the Bucket object.
96110
// +optional
97111
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
98112

99113
// Conditions holds the conditions for the Bucket.
100114
// +optional
101115
Conditions []metav1.Condition `json:"conditions,omitempty"`
102116

103-
// URL is the fetch link for the artifact output of the last Bucket sync.
117+
// URL is the dynamic fetch link for the latest Artifact.
118+
// It is provided on a "best effort" basis, and using the precise
119+
// BucketStatus.Artifact data is recommended.
104120
// +optional
105121
URL string `json:"url,omitempty"`
106122

107-
// Artifact represents the output of the last successful Bucket sync.
123+
// Artifact represents the last successful Bucket reconciliation.
108124
// +optional
109125
Artifact *Artifact `json:"artifact,omitempty"`
110126

111127
meta.ReconcileRequestStatus `json:",inline"`
112128
}
113129

114130
const (
115-
// BucketOperationSucceededReason represents the fact that the bucket listing and
116-
// fetch operations succeeded.
131+
// BucketOperationSucceededReason signals that the Bucket listing and fetch
132+
// operations succeeded.
117133
BucketOperationSucceededReason string = "BucketOperationSucceeded"
118134

119-
// BucketOperationFailedReason represents the fact that the bucket listing or
120-
// fetch operations failed.
135+
// BucketOperationFailedReason signals that the Bucket listing or fetch
136+
// operations failed.
121137
BucketOperationFailedReason string = "BucketOperationFailed"
122138
)
123139

@@ -136,23 +152,11 @@ func (in Bucket) GetRequeueAfter() time.Duration {
136152
return in.Spec.Interval.Duration
137153
}
138154

139-
// GetInterval returns the interval at which the source is reconciled.
140-
// Deprecated: use GetRequeueAfter instead.
141-
func (in Bucket) GetInterval() metav1.Duration {
142-
return in.Spec.Interval
143-
}
144-
145155
// GetArtifact returns the latest artifact from the source if present in the status sub-resource.
146156
func (in *Bucket) GetArtifact() *Artifact {
147157
return in.Status.Artifact
148158
}
149159

150-
// GetStatusConditions returns a pointer to the Status.Conditions slice.
151-
// Deprecated: use GetConditions instead.
152-
func (in *Bucket) GetStatusConditions() *[]metav1.Condition {
153-
return &in.Status.Conditions
154-
}
155-
156160
// +genclient
157161
// +genclient:Namespaced
158162
// +kubebuilder:storageversion
@@ -163,7 +167,7 @@ func (in *Bucket) GetStatusConditions() *[]metav1.Condition {
163167
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description=""
164168
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description=""
165169

166-
// Bucket is the Schema for the buckets API
170+
// Bucket is the Schema for the buckets API.
167171
type Bucket struct {
168172
metav1.TypeMeta `json:",inline"`
169173
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -173,9 +177,8 @@ type Bucket struct {
173177
Status BucketStatus `json:"status,omitempty"`
174178
}
175179

180+
// BucketList contains a list of Bucket objects.
176181
// +kubebuilder:object:root=true
177-
178-
// BucketList contains a list of Bucket
179182
type BucketList struct {
180183
metav1.TypeMeta `json:",inline"`
181184
metav1.ListMeta `json:"metadata,omitempty"`

api/v1beta2/condition_types.go

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,41 @@ package v1beta2
1919
const SourceFinalizer = "finalizers.fluxcd.io"
2020

2121
const (
22-
// ArtifactOutdatedCondition indicates the current Artifact of the Source is outdated.
23-
// This is a "negative polarity" or "abnormal-true" type, and is only present on the resource if it is True.
22+
// ArtifactOutdatedCondition indicates the current Artifact of the Source
23+
// is outdated.
24+
// This is a "negative polarity" or "abnormal-true" type, and is only
25+
// present on the resource if it is True.
2426
ArtifactOutdatedCondition string = "ArtifactOutdated"
2527

26-
// SourceVerifiedCondition indicates the integrity of the Source has been verified. If True, the integrity check
27-
// succeeded. If False, it failed. The Condition is only present on the resource if the integrity has been verified.
28+
// SourceVerifiedCondition indicates the integrity of the Source has been
29+
// verified. If True, the integrity check succeeded. If False, it failed.
30+
// The Condition is only present on the resource if the integrity has been
31+
// verified.
2832
SourceVerifiedCondition string = "SourceVerified"
2933

30-
// FetchFailedCondition indicates a transient or persistent fetch failure of an upstream Source.
31-
// If True, observations on the upstream Source revision may be impossible, and the Artifact available for the
32-
// Source may be outdated.
33-
// This is a "negative polarity" or "abnormal-true" type, and is only present on the resource if it is True.
34+
// FetchFailedCondition indicates a transient or persistent fetch failure
35+
// of an upstream Source.
36+
// If True, observations on the upstream Source revision may be impossible,
37+
// and the Artifact available for the Source may be outdated.
38+
// This is a "negative polarity" or "abnormal-true" type, and is only
39+
// present on the resource if it is True.
3440
FetchFailedCondition string = "FetchFailed"
3541

36-
// BuildFailedCondition indicates a transient or persistent build failure of a Source's Artifact.
37-
// If True, the Source can be in an ArtifactOutdatedCondition
42+
// BuildFailedCondition indicates a transient or persistent build failure
43+
// of a Source's Artifact.
44+
// If True, the Source can be in an ArtifactOutdatedCondition.
3845
BuildFailedCondition string = "BuildFailed"
3946
)
4047

4148
const (
42-
// URLInvalidReason represents the fact that a given source has an invalid URL.
49+
// URLInvalidReason signals that a given Source has an invalid URL.
4350
URLInvalidReason string = "URLInvalid"
4451

45-
// StorageOperationFailedReason signals a failure caused by a storage operation.
52+
// StorageOperationFailedReason signals a failure caused by a storage
53+
// operation.
4654
StorageOperationFailedReason string = "StorageOperationFailed"
4755

48-
// AuthenticationFailedReason represents the fact that a given secret does not
49-
// have the required fields or the provided credentials do not match.
56+
// AuthenticationFailedReason signals that a Secret does not have the
57+
// required fields, or the provided credentials do not match.
5058
AuthenticationFailedReason string = "AuthenticationFailed"
5159
)

0 commit comments

Comments
 (0)