Skip to content

Commit

Permalink
Add Label Priorities
Browse files Browse the repository at this point in the history
Makes sense to live here with the labels.
  • Loading branch information
spjmurray committed Feb 29, 2024
1 parent 41ec63f commit c2f465e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,19 @@ const (
// a go.
DefaultYieldTimeout = 10 * time.Second
)

// LabelPriorities assigns a priority to the labels for sorting. Most things
// use the labels to uniquely identify a resource. For example, when we create
// a remote cluster in ArgoCD we use a tuple of project, control plane and optionally
// the cluster. This gives a unique identifier given projects and control planes
// provide a namespace abstraction, and a deterministic one as the order is defined.
// This function is required because labels are given as a map, and thus are
// no-deterministically ordered when iterating in go.
func LabelPriorities() []string {
return []string{
constants.KubernetesClusterLabel,

Check failure on line 132 in pkg/constants/constants.go

View workflow job for this annotation

GitHub Actions / Runtime

undefined: constants

Check failure on line 132 in pkg/constants/constants.go

View workflow job for this annotation

GitHub Actions / Runtime

undefined: constants
constants.ControlPlaneLabel,

Check failure on line 133 in pkg/constants/constants.go

View workflow job for this annotation

GitHub Actions / Runtime

undefined: constants

Check failure on line 133 in pkg/constants/constants.go

View workflow job for this annotation

GitHub Actions / Runtime

undefined: constants
constants.ProjectLabel,

Check failure on line 134 in pkg/constants/constants.go

View workflow job for this annotation

GitHub Actions / Runtime

undefined: constants

Check failure on line 134 in pkg/constants/constants.go

View workflow job for this annotation

GitHub Actions / Runtime

undefined: constants
constants.OrganizationLabel,

Check failure on line 135 in pkg/constants/constants.go

View workflow job for this annotation

GitHub Actions / Runtime

undefined: constants (typecheck)

Check failure on line 135 in pkg/constants/constants.go

View workflow job for this annotation

GitHub Actions / Runtime

undefined: constants) (typecheck)
}
}

0 comments on commit c2f465e

Please sign in to comment.