Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not consider channel in operator certification #221

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/certdb/certdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

type CertificationStatusValidator interface {
IsContainerCertified(registry, repository, tag, digest string) bool
IsOperatorCertified(csvName, ocpVersion, channel string) bool
IsOperatorCertified(csvName, ocpVersion string) bool
IsHelmChartCertified(helm *release.Release, ourKubeVersion string) bool
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/certdb/offlinecheck/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ func loadOperatorsCatalog(pathToRoot string) error {
// isOperatorCertified check the presence of operator name in certified operators db
// the operator name is the csv
// ocpVersion is Major.Minor OCP version
func (validator OfflineValidator) IsOperatorCertified(csvName, ocpVersion, channel string) bool {
func (validator OfflineValidator) IsOperatorCertified(csvName, ocpVersion string) bool {
name, operatorVersion := ExtractNameVersionFromName(csvName)
if v, ok := operatordb[name]; ok {
for _, version := range v {
if version.operatorVersion == operatorVersion && version.channel == channel {
if version.operatorVersion == operatorVersion {
if ocpVersion == "" || version.ocpVersion == ocpVersion {
log.Trace("operator ", name, " found in db")
return true
Expand Down
5 changes: 2 additions & 3 deletions pkg/certdb/offlinecheck/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ func TestIsOperatorCertified(t *testing.T) {

name := "ibm-spectrum-scale-csi-operator.v2.0.0"
ocpversion := "4.6"
channel := "stable"

assert.True(t, validator.IsOperatorCertified(name, ocpversion, channel))
assert.True(t, validator.IsOperatorCertified(name, ocpversion))

name = "falcon-alpha"
assert.False(t, validator.IsOperatorCertified(name, ocpversion, channel))
assert.False(t, validator.IsOperatorCertified(name, ocpversion))
}
6 changes: 3 additions & 3 deletions pkg/certdb/onlinecheck/onlinecheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ func (validator OnlineValidator) IsContainerCertified(registry, repository, tag,

// IsOperatorCertified get operator bundle by csv name from the certified-operators org
// If present then returns `true` if channel and ocp version match.
func (validator OnlineValidator) IsOperatorCertified(csvName, ocpVersion, channel string) bool {
log.Tracef("Searching csv %s (channel %s) for ocp %q", csvName, channel, ocpVersion)
func (validator OnlineValidator) IsOperatorCertified(csvName, ocpVersion string) bool {
log.Tracef("Searching csv %s for ocp %q", csvName, ocpVersion)
_, operatorVersion := offlinecheck.ExtractNameVersionFromName(csvName)
var responseData []byte
var err error
Expand All @@ -232,7 +232,7 @@ func (validator OnlineValidator) IsOperatorCertified(csvName, ocpVersion, channe
}
for _, operator := range operatorEntries.Data {
_, opVersion := offlinecheck.ExtractNameVersionFromName(operator.CsvName)
if (opVersion == operatorVersion) && (operator.OcpVersion == ocpVersion || ocpVersion == "") && operator.Channel == channel {
if (opVersion == operatorVersion) && (operator.OcpVersion == ocpVersion || ocpVersion == "") {
return true
}
}
Expand Down
Loading