Skip to content

Commit

Permalink
Add Label Priorities (#4)
Browse files Browse the repository at this point in the history
Makes sense to live here with the labels.
  • Loading branch information
spjmurray authored Feb 29, 2024
1 parent 41ec63f commit 313cb89
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{
KubernetesClusterLabel,
ControlPlaneLabel,
ProjectLabel,
OrganizationLabel,
}
}

0 comments on commit 313cb89

Please sign in to comment.