Skip to content

Commit

Permalink
fix labelSelector
Browse files Browse the repository at this point in the history
  • Loading branch information
sauterp committed Mar 18, 2024
1 parent fd9a4f8 commit 34dd0fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
4 changes: 2 additions & 2 deletions internal/integ/cluster/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ func Setup() error {
}
}

testCluster.printDeploymentLogs(ctx, csiControllerName)
testCluster.printDaemonSetLogs(ctx, csiNodeDriverName)
testCluster.printPodsLogs(ctx, "app="+csiControllerName)
testCluster.printPodsLogs(ctx, "app="+csiNodeDriverName)

return nil
}
22 changes: 0 additions & 22 deletions internal/integ/cluster/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,28 +239,6 @@ func retry(trial func() error, nRetries int, retryInterval time.Duration) error
return trial()
}

func (c *Cluster) printDeploymentLogs(ctx context.Context, deploymentName string) {
deployment, err := c.K8s.ClientSet.AppsV1().Deployments(csiNamespace).Get(ctx, deploymentName, metav1.GetOptions{})
if err != nil {
slog.Warn("failed to get", "deployment", deploymentName)

return
}

c.printPodsLogs(ctx, deployment.Spec.Selector.MatchLabels["app"])
}

func (c *Cluster) printDaemonSetLogs(ctx context.Context, name string) {
daemonSet, err := c.K8s.ClientSet.AppsV1().DaemonSets(csiNamespace).Get(ctx, name, metav1.GetOptions{})
if err != nil {
slog.Warn("failed to get", "DaemonSet", name)

return
}

c.printPodsLogs(ctx, daemonSet.Spec.Selector.MatchLabels["app"])
}

func (c *Cluster) printPodsLogs(ctx context.Context, labelSelector string) {
podList, err := c.K8s.ClientSet.CoreV1().Pods(csiNamespace).List(ctx, metav1.ListOptions{LabelSelector: labelSelector})
if err != nil {
Expand Down

0 comments on commit 34dd0fc

Please sign in to comment.