Skip to content

Commit

Permalink
Merge pull request #236 from k8stopologyawareschedwg/kubeconfig-arg
Browse files Browse the repository at this point in the history
k8s:  add option to set kubeconfig
  • Loading branch information
ffromani authored Nov 6, 2023
2 parents fa7c878 + eb38123 commit e155d3f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/resource-topology-exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ func main() {
os.Exit(0)
}

k8scli, err := k8shelpers.GetK8sClient("")
k8scli, err := k8shelpers.GetK8sClient(parsedArgs.KubeConfig)
if err != nil {
klog.Fatalf("failed to get k8s client: %w", err)
klog.Fatalf("failed to get k8s client: %v", err)
}

cli, cleanup, err := podres.WaitForReady(podres.GetClient(parsedArgs.RTE.PodResourcesSocketPath))
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type ProgArgs struct {
RTE resourcetopologyexporter.Args
Version bool
DumpConfig string
KubeConfig string
}

func (pa *ProgArgs) ToJson() ([]byte, error) {
Expand Down Expand Up @@ -133,6 +134,7 @@ Special targets:
. ".andexit" stdout and exit right after.
. ".log" to dump in the log".`,
)
flags.StringVar(&pArgs.KubeConfig, "kubeconfig", "", "path to kubeconfig file.")

err := flags.Parse(args)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion test/data/TestDefaults.expected.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"NRTupdater":{"NoPublish":false,"Oneshot":false,"Hostname":"TEST_NODE"},"Resourcemonitor":{"Namespace":"","SysfsRoot":"/sys","ResourceExclude":null,"RefreshNodeResources":false,"PodSetFingerprint":true,"PodSetFingerprintMethod":"with-exclusive-resources","ExposeTiming":false,"PodSetFingerprintStatusFile":"","PodExclude":null,"ExcludeTerminalPods":false},"RTE":{"Debug":false,"ReferenceContainer":{"Namespace":"TEST_NS","PodName":"TEST_POD","ContainerName":"TEST_CONT"},"TopologyManagerPolicy":"","TopologyManagerScope":"","KubeletConfigFile":"/podresources/config.yaml","PodResourcesSocketPath":"unix:///podresources/kubelet.sock","SleepInterval":60000000000,"PodReadinessEnable":true,"NotifyFilePath":"","MaxEventsPerTimeUnit":1,"TimeUnitToLimitEvents":1000000000,"AddNRTOwnerEnable":true,"PrometheusMode":"disabled"},"Version":false,"DumpConfig":""}
{"NRTupdater":{"NoPublish":false,"Oneshot":false,"Hostname":"TEST_NODE"},"Resourcemonitor":{"Namespace":"","SysfsRoot":"/sys","ResourceExclude":null,"RefreshNodeResources":false,"PodSetFingerprint":true,"PodSetFingerprintMethod":"with-exclusive-resources","ExposeTiming":false,"PodSetFingerprintStatusFile":"","PodExclude":null,"ExcludeTerminalPods":false},"RTE":{"Debug":false,"ReferenceContainer":{"Namespace":"TEST_NS","PodName":"TEST_POD","ContainerName":"TEST_CONT"},"TopologyManagerPolicy":"","TopologyManagerScope":"","KubeletConfigFile":"/podresources/config.yaml","PodResourcesSocketPath":"unix:///podresources/kubelet.sock","SleepInterval":60000000000,"PodReadinessEnable":true,"NotifyFilePath":"","MaxEventsPerTimeUnit":1,"TimeUnitToLimitEvents":1000000000,"AddNRTOwnerEnable":true,"PrometheusMode":"disabled"},"Version":false,"DumpConfig":"","KubeConfig":""}

0 comments on commit e155d3f

Please sign in to comment.