Open
Description
When the argocd commit status controller creates commit statuses it should set a URL the links to a filtered view of apps within argcd for that apps that are in said environment.
One option is to modify the spec to specifiy environments with a label selector to use for the filter.
Today we have:
spec:
applicationSelector:
matchLabels:
app: demo
promotionStrategyRef:
name: argocon-demo
We could maybe do something like:
spec:
applicationSelectors:
- matchLabels:
app: demo
environment: development
- matchLabels:
app: demo
environment: staging
- matchLabels:
app: demo
environment: production
promotionStrategyRef:
name: argocon-demo
When they are constructed this way we can also generate a link for each set with the same labels. One thing to think about is we might need an argocd base url per env as well for situation where there are multiple argocd instances for dev,stg, prod. The above spec does not account for that.
However, we could do something like this to account for BaseUrl
type ArgoCDCommitStatusSpec struct {
// +kubebuilder:validation:Required
PromotionStrategyRef ObjectReference `json:"promotionStrategyRef,omitempty"`
// +kubebuilder:validation:Optional
ApplicationSelector *metav1.LabelSelector `json:"applicationSelector,omitempty"`
// +kubebuilder:validation:Optional
ApplicationSelectors []ApplicationSelector `json:"applicationSelectors,omitempty"`
}
type ApplicationSelector struct {
MatchLabels map[string]string `json:"matchLabels,omitempty"`
MatchExpressions []metav1.LabelSelectorRequirement `json:"matchExpressions,omitempty"`
// BaseUrl is the base URL for the ArgoCD server, used to construct links to applications if empty defaults to the current
// argo cd url in the browser.
BaseUrl string `json:"baseUrl,omitempty"` // Base URL for the ArgoCD server
// Name is the name of the environment
Name string `json:"name,omitempty"` //Name of environment
}
I might like this better:
type ArgoCDCommitStatusSpec struct {
// +kubebuilder:validation:Required
PromotionStrategyRef ObjectReference `json:"promotionStrategyRef,omitempty"`
// +kubebuilder:validation:Optional
ApplicationSelector *metav1.LabelSelector `json:"applicationSelector,omitempty"`
// +kubebuilder:validation:Optional
ApplicationSelectors []ApplicationSelectors `json:"applicationSelectors,omitempty"`
}
type ApplicationSelectors struct {
Selector *metav1.LabelSelector `json:"selector,omitempty"`
// BaseUrl is the base URL for the ArgoCD server, used to construct links to applications if empty defaults to the current
// argo cd url in the browser.
BaseUrl string `json:"baseUrl,omitempty"` // Base URL for the ArgoCD server
// Name is the name of the environment
Name string `json:"name,omitempty"` //Name of environment
}
Metadata
Metadata
Assignees
Labels
No labels