-
Notifications
You must be signed in to change notification settings - Fork 27
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
POWERMON-251: ensure redfish config change restart kepler #378
POWERMON-251: ensure redfish config change restart kepler #378
Conversation
71b2b7b
to
33798eb
Compare
33798eb
to
4e28a83
Compare
@@ -182,7 +182,9 @@ func TestDaemonSet(t *testing.T) { | |||
}, | |||
}, | |||
annotation: map[string]string{ | |||
"kepler.system.sustainable.computing.io/redfish-secret-ref": "123", | |||
|
|||
RedfishSecretAnnotation: "123", |
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.
It is better to use string values than consts in test code. This makes sure tests break when const is changed, else the tests pass silently.
pkg/components/exporter/exporter.go
Outdated
@@ -154,6 +155,7 @@ func MountRedfishSecretToDaemonSet(ds *appsv1.DaemonSet, secret *corev1.Secret) | |||
// forces pods to be reployed if the secret chanage | |||
ds.Spec.Template.Annotations = map[string]string{ | |||
RedfishSecretAnnotation: secret.ResourceVersion, | |||
RedfishConfigHash: fmt.Sprint(hash), |
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.
Sprint
will use reflection. Ignore, if no other way.
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.
+1 .. using strconv now.
4e28a83
to
9155cf3
Compare
pkg/reconciler/kepler.go
Outdated
if rf.ProbeInterval != zero { | ||
r.Cfm.Data["REDFISH_PROBE_INTERVAL_IN_SECONDS"] = fmt.Sprintf("%f", rf.ProbeInterval.Duration.Seconds()) | ||
} | ||
r.Cfm.Data["REDFISH_PROBE_INTERVAL_IN_SECONDS"] = fmt.Sprint(int64(rf.ProbeInterval.Duration.Seconds())) |
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.
here also using fmt.Sprint
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.
BenchmarkStrconv-8 18622068 112.7 ns/op
BenchmarkFmt-8 23205686 107.4 ns/op
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.
The reason for the change from the original implementation was fmt.Sprintf"%f", 60.0)
resulted in 60.0000000
in the configmap. instead of 60
This commit modifies kepler reconciler to add the hash of redfish spec to pod annotations so that any change to the redfish spec will redeploy the pod. This commit also fixes POWERMON-250 by removing the default redfish config added to kepler configmap. Signed-off-by: Sunil Thaha <[email protected]>
9155cf3
to
214c9b5
Compare
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.
/lgtm
This commit modifies kepler reconciler to add the hash of redfish spec to pod annotations so that any change to the redfish spec will redeploy the pod.
This commit also fixes POWERMON-250 by removing the default redfish config added to kepler configmap.