Skip to content

Commit

Permalink
autdiscover: delete deprecated default operator label
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontesi committed Dec 21, 2023
1 parent aa57575 commit 8d0bfd9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
15 changes: 0 additions & 15 deletions pkg/autodiscover/autodiscover.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,6 @@ type labelObject struct {

var data = DiscoveredTestData{}

func warnDeprecation(config *configuration.TestConfiguration) {
if len(config.OperatorsUnderTestLabels) == 0 {
log.Warn("DEPRECATED: deprecated default operator label in use ( %s:%s ) is about to be obsolete. Please use the new \"operatorsUnderTestLabels\" field to specify operators labels instead.",
deprecatedHardcodedOperatorLabelName, deprecatedHardcodedOperatorLabelValue)
}
if len(config.PodsUnderTestLabels) == 0 {
log.Warn("No Pod under test labels configured. Tests on pods and containers will not run. Please use the \"podsUnderTestLabels\" field to specify labels for pods under test")
}
}

const labelRegex = `(\S*)\s*:\s*(\S*)`
const labelRegexMatches = 3

Expand Down Expand Up @@ -148,11 +138,6 @@ func DoAutoDiscover(config *configuration.TestConfiguration) DiscoveredTestData
podsUnderTestLabelsObjects := createLabels(config.PodsUnderTestLabels)
operatorsUnderTestLabelsObjects := createLabels(config.OperatorsUnderTestLabels)

// prints warning about deprecated labels
warnDeprecation(config)
// adds DEPRECATED hardcoded operator label
operatorsUnderTestLabelsObjects = append(operatorsUnderTestLabelsObjects, labelObject{LabelKey: deprecatedHardcodedOperatorLabelName, LabelValue: deprecatedHardcodedOperatorLabelValue})

log.Info("parsed pods under test labels: %+v", podsUnderTestLabelsObjects)
log.Info("parsed operators under test labels: %+v", operatorsUnderTestLabelsObjects)

Expand Down
6 changes: 1 addition & 5 deletions pkg/autodiscover/autodiscover_operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ func findOperatorsByLabel(olmClient clientOlm.Interface, labels []labelObject, n
for _, ns := range namespaces {
log.Debug("Searching CSVs in namespace %s", ns)
for _, aLabelObject := range labels {
label := aLabelObject.LabelKey
// DEPRECATED special processing for deprecated operator label. Value not needed to match.
if aLabelObject.LabelKey != deprecatedHardcodedOperatorLabelName {
label += "=" + aLabelObject.LabelValue
}
label := aLabelObject.LabelKey + "=" + aLabelObject.LabelValue
log.Debug("Searching CSVs with label %s", label)
csvList, err := olmClient.OperatorsV1alpha1().ClusterServiceVersions(ns.Name).List(context.TODO(), metav1.ListOptions{
LabelSelector: label,
Expand Down
6 changes: 2 additions & 4 deletions pkg/autodiscover/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
package autodiscover

const (
deprecatedHardcodedOperatorLabelName = "test-network-function.com/operator"
deprecatedHardcodedOperatorLabelValue = ""
debugHelperPodsLabelName = "test-network-function.com/app"
debugHelperPodsLabelValue = "tnf-debug"
debugHelperPodsLabelName = "test-network-function.com/app"
debugHelperPodsLabelValue = "tnf-debug"
)

0 comments on commit 8d0bfd9

Please sign in to comment.