@@ -11,10 +11,11 @@ import (
1111 "strings"
1212 "time"
1313
14+ releasepayloadinformers "github.com/openshift/release-controller/pkg/client/informers/externalversions"
15+ "github.com/openshift/release-controller/pkg/releasequalifiers"
1416 "golang.org/x/text/cases"
1517 "golang.org/x/text/language"
16-
17- releasepayloadinformers "github.com/openshift/release-controller/pkg/client/informers/externalversions"
18+ "gopkg.in/yaml.v2"
1819
1920 releasepayloadclient "github.com/openshift/release-controller/pkg/client/clientset/versioned"
2021 "github.com/openshift/release-controller/pkg/jira"
@@ -112,6 +113,8 @@ type options struct {
112113
113114 ProcessLegacyResults bool
114115 ManifestListMode bool
116+
117+ ReleaseQualifiersConfigPath string
115118}
116119
117120// Add metrics for jira verifier errors
@@ -221,6 +224,8 @@ func main() {
221224 flagset .BoolVar (& opt .ProcessLegacyResults , "process-legacy-results" , opt .ProcessLegacyResults , "enable the migration of imagestream based results to ReleasePayloads" )
222225 flagset .BoolVar (& opt .ManifestListMode , "manifest-list-mode" , opt .ManifestListMode , "enable manifest list support for oc operations" )
223226
227+ flagset .StringVar (& opt .ReleaseQualifiersConfigPath , "release-qualifiers-config-path" , "" , "Path to release qualifiers config file" )
228+
224229 goFlagSet := flag .NewFlagSet ("prowflags" , flag .ContinueOnError )
225230 opt .github .AddFlags (goFlagSet )
226231 opt .jira .AddFlags (goFlagSet )
@@ -241,7 +246,7 @@ func (o *options) Run() error {
241246 // report liveness on default prow health port 8081
242247 health := pjutil .NewHealthOnPort (flagutil .DefaultHealthPort )
243248 if o .validateConfigs != "" {
244- return validateConfigs (o . validateConfigs )
249+ return validateConfigs (o )
245250 }
246251 tagParts := strings .Split (o .ToolsImageStreamTag , ":" )
247252 if len (tagParts ) != 2 || len (tagParts [1 ]) == 0 {
@@ -391,6 +396,11 @@ func (o *options) Run() error {
391396 klog .Fatal (err )
392397 }
393398
399+ releaseQualifierConfig := releasecontroller.ReleaseQualifiersConfig {}
400+ if len (o .ReleaseQualifiersConfigPath ) > 0 {
401+ go manageReleaseQualifierConfig (o .ReleaseQualifiersConfigPath , & releaseQualifierConfig )
402+ }
403+
394404 c := NewController (
395405 client .CoreV1 (),
396406 imageClient .ImageV1 (),
@@ -409,6 +419,7 @@ func (o *options) Run() error {
409419 o .ARTSuffix ,
410420 releasePayloadClient .ReleaseV1alpha1 (),
411421 o .ManifestListMode ,
422+ & releaseQualifierConfig ,
412423 )
413424
414425 if o .VerifyJira {
@@ -714,3 +725,28 @@ func setupKubeconfigWatches(o *options) error {
714725
715726 return nil
716727}
728+
729+ func manageReleaseQualifierConfig (path string , qualifiers * releasecontroller.ReleaseQualifiersConfig ) {
730+ for {
731+ // To prevent the release-controller from crashlooping due to a bad config change,
732+ // we will only log that the config is broken and set the qualifiers to an empty map.
733+ // To prevent broken configs in the future, a presubmit should be creating for
734+ // openshift/release that verifies this config.
735+ var config releasecontroller.ReleaseQualifiersConfig
736+ rawConfig , err := os .ReadFile (path )
737+ if err != nil {
738+ klog .Errorf ("Failed to load release qualifier config file at %s: %v" , path , err )
739+ } else if err := yaml .Unmarshal (rawConfig , & config ); err != nil {
740+ klog .Errorf ("Failed to unmarshal release qualifier config: %v" , err )
741+ }
742+
743+ qualifiers .Mutex .Lock ()
744+ if config .Qualifiers != nil {
745+ qualifiers .Qualifiers = config .Qualifiers
746+ } else {
747+ qualifiers .Qualifiers = make (map [releasequalifiers.QualifierId ]releasequalifiers.ReleaseQualifier )
748+ }
749+ qualifiers .Mutex .Unlock ()
750+ time .Sleep (2 * time .Minute )
751+ }
752+ }
0 commit comments