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

POWERMON-251: ensure redfish config change restart kepler #378

Merged

Conversation

sthaha
Copy link
Collaborator

@sthaha sthaha commented Mar 13, 2024

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.

@sthaha sthaha force-pushed the fix-reconcile-on-cm-change branch 2 times, most recently from 71b2b7b to 33798eb Compare March 13, 2024 04:07
@sthaha sthaha force-pushed the fix-reconcile-on-cm-change branch from 33798eb to 4e28a83 Compare March 13, 2024 05:20
vprashar2929
vprashar2929 previously approved these changes Mar 13, 2024
@sthaha sthaha requested a review from vimalk78 March 13, 2024 06:17
vimalk78
vimalk78 previously approved these changes Mar 13, 2024
@@ -182,7 +182,9 @@ func TestDaemonSet(t *testing.T) {
},
},
annotation: map[string]string{
"kepler.system.sustainable.computing.io/redfish-secret-ref": "123",

RedfishSecretAnnotation: "123",
Copy link
Collaborator

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.

@@ -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),
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 .. using strconv now.

@sthaha sthaha dismissed stale reviews from vimalk78 and vprashar2929 via 9155cf3 March 13, 2024 10:32
@sthaha sthaha force-pushed the fix-reconcile-on-cm-change branch from 4e28a83 to 9155cf3 Compare March 13, 2024 10:32
vimalk78
vimalk78 previously approved these changes Mar 13, 2024
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()))
Copy link
Collaborator

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

Copy link
Collaborator Author

@sthaha sthaha Mar 13, 2024

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

Copy link
Collaborator Author

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]>
Copy link
Collaborator

@vimalk78 vimalk78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@vimalk78 vimalk78 merged commit 2cd68dc into sustainable-computing-io:v1alpha1 Mar 14, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants