Skip to content

Commit

Permalink
Merge pull request #201 from gianlucam76/selector
Browse files Browse the repository at this point in the history
Return an error if clusterSelector is not parsable
  • Loading branch information
gianlucam76 authored Jan 11, 2024
2 parents 8f3a6f2 + 989133d commit 87da7d7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GO_INSTALL := ./scripts/go_install.sh
REGISTRY ?= projectsveltos
IMAGE_NAME ?= sveltosctl
export SVELTOSCTL_IMG ?= $(REGISTRY)/$(IMAGE_NAME)
TAG ?= main
TAG ?= dev
ARCH ?= amd64

# Directories.
Expand Down
5 changes: 4 additions & 1 deletion internal/commands/techsupport_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,10 @@ func getMatchingClusters(ctx context.Context, techsupport *utilsv1alpha1.Techsup

matching := make([]corev1.ObjectReference, 0)

parsedSelector, _ := labels.Parse(string(techsupport.Spec.ClusterSelector))
parsedSelector, err := labels.Parse(string(techsupport.Spec.ClusterSelector))
if err != nil {
return nil, err
}

tmpMatching, err := getMatchingCAPIClusters(ctx, parsedSelector)
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion internal/commands/techsupport_reconciler_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,11 @@ func requeueTechsupportForCluster(
// matching the Cluster
for k := range techsupports {
techsupportSelector := techsupports[k]
parsedSelector, _ := labels.Parse(string(techsupportSelector))
parsedSelector, err := labels.Parse(string(techsupportSelector))
if err != nil {
// When clusterSelector is fixed, Techsupport will be reconciled
return requests
}
if parsedSelector.Matches(labels.Set(cluster.GetLabels())) {
requests = append(requests, ctrl.Request{
NamespacedName: client.ObjectKey{
Expand Down
2 changes: 1 addition & 1 deletion manifest/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
serviceAccountName: sveltosctl
containers:
- name: sveltosctl
image: projectsveltos/sveltosctl-amd64:main
image: projectsveltos/sveltosctl-amd64:dev
imagePullPolicy: IfNotPresent
command:
- /sveltosctl
Expand Down

0 comments on commit 87da7d7

Please sign in to comment.