@@ -29,6 +29,7 @@ import (
29
29
"golang.org/x/crypto/ssh"
30
30
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
31
31
expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1"
32
+ "sigs.k8s.io/cluster-api/test/framework"
32
33
"sigs.k8s.io/controller-runtime/pkg/client"
33
34
kinderrors "sigs.k8s.io/kind/pkg/errors"
34
35
)
@@ -154,3 +155,41 @@ func readPrivateKey() ([]byte, error) {
154
155
155
156
return os .ReadFile (filepath .Clean (privateKeyFilePath ))
156
157
}
158
+
159
+ func watchVSphereComponentLogsFunc (ctx context.Context , artifactFolder string ) func (managementClusterProxy framework.ClusterProxy , workloadClusterNamespace , workloadClusterName string ) {
160
+ return func (managementClusterProxy framework.ClusterProxy , workloadClusterNamespace , workloadClusterName string ) {
161
+ workloadClusterProxy := managementClusterProxy .GetWorkloadCluster (ctx , workloadClusterNamespace , workloadClusterName )
162
+ // CPI
163
+ framework .WatchDaemonSetLogsByLabelSelector (ctx , framework.WatchDaemonSetLogsByLabelSelectorInput {
164
+ GetLister : workloadClusterProxy .GetClient (),
165
+ Cache : workloadClusterProxy .GetCache (ctx ),
166
+ ClientSet : workloadClusterProxy .GetClientSet (),
167
+ Labels : map [string ]string {
168
+ "component" : "cloud-controller-manager" ,
169
+ },
170
+ LogPath : filepath .Join (artifactFolder , "clusters" , workloadClusterName , "logs" ),
171
+ })
172
+
173
+ // CSI Deployment
174
+ framework .WatchDeploymentLogsByLabelSelector (ctx , framework.WatchDeploymentLogsByLabelSelectorInput {
175
+ GetLister : workloadClusterProxy .GetClient (),
176
+ Cache : workloadClusterProxy .GetCache (ctx ),
177
+ ClientSet : workloadClusterProxy .GetClientSet (),
178
+ Labels : map [string ]string {
179
+ "component" : "cloud-controller-manager" ,
180
+ },
181
+ LogPath : filepath .Join (artifactFolder , "clusters" , workloadClusterName , "logs" ),
182
+ })
183
+
184
+ // CSI Daemonset
185
+ framework .WatchDaemonSetLogsByLabelSelector (ctx , framework.WatchDaemonSetLogsByLabelSelectorInput {
186
+ GetLister : workloadClusterProxy .GetClient (),
187
+ Cache : workloadClusterProxy .GetCache (ctx ),
188
+ ClientSet : workloadClusterProxy .GetClientSet (),
189
+ Labels : map [string ]string {
190
+ "component" : "cloud-controller-manager" ,
191
+ },
192
+ LogPath : filepath .Join (artifactFolder , "clusters" , workloadClusterName , "logs" ),
193
+ })
194
+ }
195
+ }
0 commit comments