-
Notifications
You must be signed in to change notification settings - Fork 322
check-cluster-profiles-config: Workround to handle Cluster Profile Sets #5282
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,7 @@ import ( | |||||||||||||||
| "github.com/sirupsen/logrus" | ||||||||||||||||
|
|
||||||||||||||||
| coreapi "k8s.io/api/core/v1" | ||||||||||||||||
| utilerrors "k8s.io/apimachinery/pkg/util/errors" | ||||||||||||||||
| "k8s.io/apimachinery/pkg/util/sets" | ||||||||||||||||
| ctrlruntimeclient "sigs.k8s.io/controller-runtime/pkg/client" | ||||||||||||||||
| fakectrlruntimeclient "sigs.k8s.io/controller-runtime/pkg/client/fake" | ||||||||||||||||
|
|
@@ -174,18 +175,30 @@ func (validator *profileValidator) Validate(profiles api.ClusterProfilesList) er | |||||||||||||||
|
|
||||||||||||||||
| // checkCISecrets verifies that the secret for each cluster profile exists in the ci namespace | ||||||||||||||||
| func (validator *profileValidator) checkCISecrets() error { | ||||||||||||||||
| // FIXME: temporary workaround, we should read this information from a config file. | ||||||||||||||||
| clusterProfileSets := sets.New("openshift-org-aws", "openshift-org-azure", "openshift-org-gcp") | ||||||||||||||||
| errs := make([]error, 0) | ||||||||||||||||
|
|
||||||||||||||||
| for p := range validator.profiles { | ||||||||||||||||
| profileDetails, err := server.NewResolverClient(configResolverAddress).ClusterProfile(p.Name()) | ||||||||||||||||
| profileName := p.Name() | ||||||||||||||||
| if clusterProfileSets.Has(profileName) { | ||||||||||||||||
| continue | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| profileDetails, err := server.NewResolverClient(configResolverAddress).ClusterProfile(profileName) | ||||||||||||||||
|
|
||||||||||||||||
| if err != nil { | ||||||||||||||||
| return fmt.Errorf("failed to retrieve details from config resolver for '%s' cluster profile", p.Name()) | ||||||||||||||||
| errs = append(errs, fmt.Errorf("failed to retrieve details from config resolver for '%s' cluster profile", profileName)) | ||||||||||||||||
| continue | ||||||||||||||||
|
Comment on lines
190
to
+192
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win Preserve the resolver failure cause. This branch drops Suggested fix- errs = append(errs, fmt.Errorf("failed to retrieve details from config resolver for '%s' cluster profile", profileName))
+ errs = append(errs, fmt.Errorf("failed to retrieve details from config resolver for %q cluster profile: %w", profileName, err))As per path instructions, 📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSources: Coding guidelines, Path instructions |
||||||||||||||||
| } | ||||||||||||||||
| ciSecret := &coreapi.Secret{} | ||||||||||||||||
| err = validator.kubeClient.Get(context.Background(), ctrlruntimeclient.ObjectKey{Namespace: "ci", Name: profileDetails.Secret}, ciSecret) | ||||||||||||||||
| if err != nil { | ||||||||||||||||
| return fmt.Errorf("failed to get secret '%s' for cluster profile '%s': %w", profileDetails.Secret, p.Name(), err) | ||||||||||||||||
| errs = append(errs, fmt.Errorf("failed to get secret '%s' for cluster profile '%s': %w", profileDetails.Secret, profileName, err)) | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| return nil | ||||||||||||||||
|
|
||||||||||||||||
| return utilerrors.NewAggregate(errs) | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| func normalize(profiles api.ClusterProfilesList) { | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Don't hardcode the profile-set bypass.
This validator gates
openshift/release, and cluster profile sets are already a first-class concept in adjacent config/jobs. A fixed name list here will drift and start rejecting valid new sets until this binary is patched again. Please drive the skip from the source-of-truth profile-set metadata (or the resolved profile details) instead of profile names.🤖 Prompt for AI Agents
Source: Linked repositories