Skip to content

Commit

Permalink
Merge following kepler ds changes into the operator:
Browse files Browse the repository at this point in the history
  • Loading branch information
husky-parul committed Jun 29, 2023
1 parent 0d76d4d commit 2e79565
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion controllers/kepler_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ func (r *collectorReconciler) ensureConfigMap(l klog.Logger) (bool, error) {
data_map["CGROUP_METRICS"] = "*"
data_map["MODEL_CONFIG"] = "| CONTAINER_COMPONENTS_ESTIMATOR=false CONTAINER_COMPONENTS_INIT_URL=https://raw.githubusercontent.com/sustainable-computing-io/kepler-model-server/main/tests/test_models/DynComponentModelWeight/CgroupOnly/ScikitMixed/ScikitMixed.json"

data_map["EXPOSE_HW_COUNTER_METRICS"] = "true"
data_map["EXPOSE_CGROUP_METRICS"] = "true"
r.configMap.Data = data_map

return nil
Expand Down Expand Up @@ -380,7 +382,7 @@ func (r *collectorReconciler) ensureDaemonSet(l klog.Logger) (bool, error) {
Privileged: &scc_value,
},
Image: image,
Command: []string{"/usr/bin/kepler", "-address", bindAddress, "-enable-gpu=true", "enable-cgroup-id=true", "v=5"},
Command: []string{"/usr/bin/kepler", "-address", bindAddress, "-enable-gpu=true", "enable-cgroup-id=true", "v=5", "-kernel-source-dir=/usr/share/kepler/kernel_sources"},
Ports: []corev1.ContainerPort{{
ContainerPort: collectorPort,
Name: "http",
Expand Down Expand Up @@ -415,6 +417,15 @@ func (r *collectorReconciler) ensureDaemonSet(l klog.Logger) (bool, error) {
{Name: "NODE_IP", ValueFrom: &envFromSource},
}

envFromSource = corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "spec.nodeName",
},
}
r.daemonSet.Spec.Template.Spec.Containers[0].Env = []corev1.EnvVar{
{Name: "NODE_NAME", ValueFrom: &envFromSource},
}

r.daemonSet.Spec.Template.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{
{Name: "lib-modules", MountPath: "/lib/modules"},
{Name: "tracing", MountPath: "/sys"},
Expand Down
2 changes: 1 addition & 1 deletion controllers/sahandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (d *keplerSADescription) createOrUpdateClusterRole(l klog.Logger) (*rbacv1.
Rules: []rbacv1.PolicyRule{
{
APIGroups: []string{""},
Resources: []string{"nodes/metrics", "nodes/proxy", "nodes/stats"},
Resources: []string{"nodes/metrics", "nodes/proxy", "nodes/stats", "pods"},
Verbs: []string{"get", "watch", "list"},
},
},
Expand Down

0 comments on commit 2e79565

Please sign in to comment.