-
Notifications
You must be signed in to change notification settings - Fork 23
conditional use of ObservedGeneration #2732
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
682ace0
173152b
72aa290
8802e54
cffa82f
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 |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| "nrtcrdanns", | ||
| "netpols", | ||
| "mgselinuxcollect", | ||
| "tlscompliance" | ||
| "tlscompliance", | ||
| "operobsgen" | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,6 +18,7 @@ package config | |||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| import ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "context" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "encoding/json" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "fmt" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "os" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "sync" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -32,11 +33,14 @@ import ( | |||||||||||||||||||||||||||||||||||||||||||||||||
| nrtv1alpha2 "github.com/k8stopologyawareschedwg/noderesourcetopology-api/pkg/apis/topology/v1alpha2" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| nropv1 "github.com/openshift-kni/numaresources-operator/api/v1" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "github.com/openshift-kni/numaresources-operator/internal/api/features" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "github.com/openshift-kni/numaresources-operator/internal/nodegroups" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "github.com/openshift-kni/numaresources-operator/internal/remoteexec" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "github.com/openshift-kni/numaresources-operator/internal/wait" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "github.com/openshift-kni/numaresources-operator/pkg/objectnames" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| numacellapi "github.com/openshift-kni/numaresources-operator/test/deviceplugin/pkg/numacell/api" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| numacellmanifests "github.com/openshift-kni/numaresources-operator/test/deviceplugin/pkg/numacell/manifests" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "github.com/openshift-kni/numaresources-operator/test/internal/deploy" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| e2efixture "github.com/openshift-kni/numaresources-operator/test/internal/fixture" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "github.com/openshift-kni/numaresources-operator/test/internal/images" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -211,3 +215,38 @@ func unlabelNodeByName(cli client.Client, nodeName string) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| g.Expect(err).ToNot(HaveOccurred()) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }).WithTimeout(3*time.Minute).WithPolling(30*time.Second).Should(Succeed(), "failed to unlabel node %q: %v", nodeName, err) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| func FetchClusterTopics(ctx context.Context, fxt *e2efixture.Fixture, nropObj *nropv1.NUMAResourcesOperator) (features.TopicInfo, error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| pod, err := deploy.FindNUMAResourcesOperatorPod(ctx, fxt.Client, nropObj) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return features.NewTopicInfo(), err | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| cmdline := []string{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "/bin/numaresources-operator", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "--inspect-features", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| stdout, stderr, err := remoteexec.CommandOnPod(ctx, fxt.K8sClient, pod, cmdline...) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // older version may miss introspection support that's fine | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return features.NewTopicInfo(), nil | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+231
to
+233
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. Don’t swallow all introspection execution failures. This currently treats every Suggested fix import (
"context"
"encoding/json"
"fmt"
"os"
+ "strings"
"sync"
"time"
@@
stdout, stderr, err := remoteexec.CommandOnPod(ctx, fxt.K8sClient, pod, cmdline...)
- // older version may miss introspection support that's fine
if err != nil {
- return features.NewTopicInfo(), nil
+ serr := strings.ToLower(stderr)
+ // older versions may miss introspection support; only ignore that class of errors
+ if strings.Contains(serr, "inspect-features") && (strings.Contains(serr, "unknown") || strings.Contains(serr, "not found")) {
+ return features.NewTopicInfo(), nil
+ }
+ return features.NewTopicInfo(), fmt.Errorf("cannot inspect cluster features: %w (stderr=%q)", err, stderr)
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if len(stderr) > 0 { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| klog.InfoS("while fetching cluster topics", "stderr", stderr) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| var tp features.TopicInfo | ||||||||||||||||||||||||||||||||||||||||||||||||||
| err = json.Unmarshal(stdout, &tp) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return features.NewTopicInfo(), err | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| klog.InfoS("active features from the deployed operator", "features", string(stdout)) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| tp.Metadata.Version = features.Version | ||||||||||||||||||||||||||||||||||||||||||||||||||
| err = tp.Validate() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return features.NewTopicInfo(), err | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return tp, nil | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Will be really hard to track, or i'll have to be more blunt we'll simply forget to update this value.
Without an automated check it won't fly IMVHO, which I'm sure will also add more complexity.
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.
likely correct, but using the version as before is pointless. We can just remove the version at that point. Either it's dependable signal or should be ignored.