Skip to content

refactor: move DependencyReference to apis/meta#1129

Open
Iam-Karan-Suresh wants to merge 1 commit intofluxcd:mainfrom
Iam-Karan-Suresh:refactor/extract-dependencyreference-meta
Open

refactor: move DependencyReference to apis/meta#1129
Iam-Karan-Suresh wants to merge 1 commit intofluxcd:mainfrom
Iam-Karan-Suresh:refactor/extract-dependencyreference-meta

Conversation

@Iam-Karan-Suresh
Copy link
Copy Markdown
Contributor

Extract DependencyReference to apis/meta (Fix #1034)

Summary

This PR moves the duplicated DependencyReference type from controller-specific APIs into apis/meta to provide a single shared implementation across Flux components.

Changes

  • Added DependencyReference to apis/meta
  • Updated ObjectWithDependencies to use []DependencyReference
  • Added MakeDependsOn helper with CEL (@expr) support
  • Updated dependency sorting logic and tests accordingly
  • Added deepcopy implementations for the new type

Motivation

DependencyReference was duplicated across KC and HC APIs. Centralizing it in apis/meta removes duplication and enables consistent dependency handling, including CEL-based readiness expressions used by the Flux CLI.

Notes

  • Backward behavior preserved.
  • Follow-up update will be required in fluxcd/flux2 to use the shared type in utils.MakeDependsOn.

@Iam-Karan-Suresh Iam-Karan-Suresh force-pushed the refactor/extract-dependencyreference-meta branch 3 times, most recently from 5ea7c0d to 897b9d5 Compare February 22, 2026 06:11
Copy link
Copy Markdown
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this change is released, we need to replace the types in kustomize-controller and helm-controller in a non-breaking way:

type DependencyReference = meta.DependencyReference

Comment thread apis/meta/reference_types.go
Comment thread runtime/dependency/sort.go
Comment thread apis/meta/dependencies.go
// GetDependsOn returns a NamespacedObjectReference list the object depends on.
GetDependsOn() []NamespacedObjectReference
// GetDependsOn returns a DependencyReference list the object depends on.
GetDependsOn() []DependencyReference
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change, and apis/meta is GA (v1.x). I'm ok with it, though, so I'll defer to other maintainers

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefanprodan This is the only item left open IMO

Comment thread apis/meta/dependencies.go
@Iam-Karan-Suresh Iam-Karan-Suresh force-pushed the refactor/extract-dependencyreference-meta branch from 897b9d5 to f90a31f Compare April 15, 2026 10:16
@Iam-Karan-Suresh Iam-Karan-Suresh requested a review from a team as a code owner April 15, 2026 10:16
@Iam-Karan-Suresh Iam-Karan-Suresh force-pushed the refactor/extract-dependencyreference-meta branch 2 times, most recently from 2db907a to 98b8f46 Compare April 15, 2026 10:45
Comment thread runtime/go.mod
Comment thread apis/meta/go.mod
Comment thread apis/meta/dependencies.go
@Iam-Karan-Suresh Iam-Karan-Suresh force-pushed the refactor/extract-dependencyreference-meta branch 2 times, most recently from bbccaa6 to 3f56026 Compare April 15, 2026 11:12
@Iam-Karan-Suresh
Copy link
Copy Markdown
Contributor Author

@matheuscscp i added the links on the command. happy to iterate based on suggestions

Comment thread apis/meta/dependencies.go Outdated
Signed-off-by: Iam-karan-suresh <karansuresh.info@gmail.com>
Signed-off-by: iam-karan-suresh <karansuresh.info@gmail.com>
@Iam-Karan-Suresh Iam-Karan-Suresh force-pushed the refactor/extract-dependencyreference-meta branch from 3f56026 to 317525d Compare April 15, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract DependencyReference to apis/meta

2 participants