Skip to content

Commit 5e83eca

Browse files
authored
Merge pull request #926 from fluxcd/status-observed-source-config
Add explicit observed artifact content configurations in status
2 parents 70d9f12 + a6d7948 commit 5e83eca

16 files changed

+1020
-174
lines changed

api/v1beta2/bucket_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ type BucketStatus struct {
128128
// +optional
129129
Artifact *Artifact `json:"artifact,omitempty"`
130130

131+
// ObservedIgnore is the observed exclusion patterns used for constructing
132+
// the source artifact.
133+
// +optional
134+
ObservedIgnore *string `json:"observedIgnore,omitempty"`
135+
131136
meta.ReconcileRequestStatus `json:",inline"`
132137
}
133138

api/v1beta2/gitrepository_types.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,27 @@ type GitRepositoryStatus struct {
224224
// be used to determine if the content of the included repository has
225225
// changed.
226226
// It has the format of `<algo>:<checksum>`, for example: `sha256:<checksum>`.
227+
//
228+
// Deprecated: Replaced with explicit fields for observed artifact content
229+
// config in the status.
227230
// +optional
228231
ContentConfigChecksum string `json:"contentConfigChecksum,omitempty"`
229232

233+
// ObservedIgnore is the observed exclusion patterns used for constructing
234+
// the source artifact.
235+
// +optional
236+
ObservedIgnore *string `json:"observedIgnore,omitempty"`
237+
238+
// ObservedRecurseSubmodules is the observed resource submodules
239+
// configuration used to produce the current Artifact.
240+
// +optional
241+
ObservedRecurseSubmodules bool `json:"observedRecurseSubmodules,omitempty"`
242+
243+
// ObservedInclude is the observed list of GitRepository resources used to
244+
// to produce the current Artifact.
245+
// +optional
246+
ObservedInclude []GitRepositoryInclude `json:"observedInclude,omitempty"`
247+
230248
meta.ReconcileRequestStatus `json:",inline"`
231249
}
232250

api/v1beta2/ocirepository_types.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,22 @@ type OCIRepositoryStatus struct {
211211
// be used to determine if the content configuration has changed and the
212212
// artifact needs to be rebuilt.
213213
// It has the format of `<algo>:<checksum>`, for example: `sha256:<checksum>`.
214+
//
215+
// Deprecated: Replaced with explicit fields for observed artifact content
216+
// config in the status.
214217
// +optional
215218
ContentConfigChecksum string `json:"contentConfigChecksum,omitempty"`
216219

220+
// ObservedIgnore is the observed exclusion patterns used for constructing
221+
// the source artifact.
222+
// +optional
223+
ObservedIgnore *string `json:"observedIgnore,omitempty"`
224+
225+
// ObservedLayerSelector is the observed layer selector used for constructing
226+
// the source artifact.
227+
// +optional
228+
ObservedLayerSelector *OCILayerSelector `json:"observedLayerSelector,omitempty"`
229+
217230
meta.ReconcileRequestStatus `json:",inline"`
218231
}
219232

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,10 @@ spec:
492492
the Bucket object.
493493
format: int64
494494
type: integer
495+
observedIgnore:
496+
description: ObservedIgnore is the observed exclusion patterns used
497+
for constructing the source artifact.
498+
type: string
495499
url:
496500
description: URL is the dynamic fetch link for the latest Artifact.
497501
It is provided on a "best effort" basis, and using the precise BucketStatus.Artifact

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

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,13 +658,14 @@ spec:
658658
type: object
659659
type: array
660660
contentConfigChecksum:
661-
description: 'ContentConfigChecksum is a checksum of all the configurations
661+
description: "ContentConfigChecksum is a checksum of all the configurations
662662
related to the content of the source artifact: - .spec.ignore -
663663
.spec.recurseSubmodules - .spec.included and the checksum of the
664664
included artifacts observed in .status.observedGeneration version
665665
of the object. This can be used to determine if the content of the
666666
included repository has changed. It has the format of `<algo>:<checksum>`,
667-
for example: `sha256:<checksum>`.'
667+
for example: `sha256:<checksum>`. \n Deprecated: Replaced with explicit
668+
fields for observed artifact content config in the status."
668669
type: string
669670
includedArtifacts:
670671
description: IncludedArtifacts contains a list of the last successfully
@@ -723,6 +724,44 @@ spec:
723724
the GitRepository object.
724725
format: int64
725726
type: integer
727+
observedIgnore:
728+
description: ObservedIgnore is the observed exclusion patterns used
729+
for constructing the source artifact.
730+
type: string
731+
observedInclude:
732+
description: ObservedInclude is the observed list of GitRepository
733+
resources used to to produce the current Artifact.
734+
items:
735+
description: GitRepositoryInclude specifies a local reference to
736+
a GitRepository which Artifact (sub-)contents must be included,
737+
and where they should be placed.
738+
properties:
739+
fromPath:
740+
description: FromPath specifies the path to copy contents from,
741+
defaults to the root of the Artifact.
742+
type: string
743+
repository:
744+
description: GitRepositoryRef specifies the GitRepository which
745+
Artifact contents must be included.
746+
properties:
747+
name:
748+
description: Name of the referent.
749+
type: string
750+
required:
751+
- name
752+
type: object
753+
toPath:
754+
description: ToPath specifies the path to copy contents to,
755+
defaults to the name of the GitRepositoryRef.
756+
type: string
757+
required:
758+
- repository
759+
type: object
760+
type: array
761+
observedRecurseSubmodules:
762+
description: ObservedRecurseSubmodules is the observed resource submodules
763+
configuration used to produce the current Artifact.
764+
type: boolean
726765
url:
727766
description: URL is the dynamic fetch link for the latest Artifact.
728767
It is provided on a "best effort" basis, and using the precise GitRepositoryStatus.Artifact

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

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,14 @@ spec:
301301
type: object
302302
type: array
303303
contentConfigChecksum:
304-
description: 'ContentConfigChecksum is a checksum of all the configurations
304+
description: "ContentConfigChecksum is a checksum of all the configurations
305305
related to the content of the source artifact: - .spec.ignore -
306306
.spec.layerSelector observed in .status.observedGeneration version
307307
of the object. This can be used to determine if the content configuration
308308
has changed and the artifact needs to be rebuilt. It has the format
309-
of `<algo>:<checksum>`, for example: `sha256:<checksum>`.'
309+
of `<algo>:<checksum>`, for example: `sha256:<checksum>`. \n Deprecated:
310+
Replaced with explicit fields for observed artifact content config
311+
in the status."
310312
type: string
311313
lastHandledReconcileAt:
312314
description: LastHandledReconcileAt holds the value of the most recent
@@ -317,6 +319,29 @@ spec:
317319
description: ObservedGeneration is the last observed generation.
318320
format: int64
319321
type: integer
322+
observedIgnore:
323+
description: ObservedIgnore is the observed exclusion patterns used
324+
for constructing the source artifact.
325+
type: string
326+
observedLayerSelector:
327+
description: ObservedLayerSelector is the observed layer selector
328+
used for constructing the source artifact.
329+
properties:
330+
mediaType:
331+
description: MediaType specifies the OCI media type of the layer
332+
which should be extracted from the OCI Artifact. The first layer
333+
matching this type is selected.
334+
type: string
335+
operation:
336+
description: Operation specifies how the selected layer should
337+
be processed. By default, the layer compressed content is extracted
338+
to storage. When the operation is set to 'copy', the layer compressed
339+
content is persisted to storage as it is.
340+
enum:
341+
- extract
342+
- copy
343+
type: string
344+
type: object
320345
url:
321346
description: URL is the download link for the artifact output of the
322347
last OCI Repository sync.

controllers/bucket_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ func (r *BucketReconciler) reconcileArtifact(ctx context.Context, obj *sourcev1.
628628

629629
// Record it on the object
630630
obj.Status.Artifact = artifact.DeepCopy()
631+
obj.Status.ObservedIgnore = obj.Spec.Ignore
631632

632633
// Update symlink on a "best effort" basis
633634
url, err := r.Storage.Symlink(artifact, "latest.tar.gz")

0 commit comments

Comments
 (0)