@@ -34,26 +34,25 @@ import (
34
34
// DockerLogCollector collect logs from a CAPD workload cluster.
35
35
type DockerLogCollector struct {}
36
36
37
- // generateContainerName return a container name using the same rule used in CAPD.
37
+ // machineContainerName return a container name using the same rule used in CAPD.
38
38
// NOTE: if the cluster name is already included in the machine name, the cluster name is not add thus
39
39
// avoiding \"sethostname: invalid argument\" errors due to container name too long.
40
- func generateContainerName (cluster , machine string ) string {
40
+ func machineContainerName (cluster , machine string ) string {
41
41
if strings .HasPrefix (machine , cluster ) {
42
42
return machine
43
43
}
44
44
return fmt .Sprintf ("%s-%s" , cluster , machine )
45
45
}
46
46
47
47
func (k DockerLogCollector ) CollectMachineLog (ctx context.Context , managementClusterClient client.Client , m * clusterv1.Machine , outputPath string ) error {
48
- containerName := generateContainerName (m .Spec .ClusterName , m .Name )
48
+ containerName := machineContainerName (m .Spec .ClusterName , m .Name )
49
49
return k .collectLogsFromNode (outputPath , containerName )
50
50
}
51
51
52
52
53
53
func (k DockerLogCollector ) CollectMachinePoolLog (ctx context.Context , managementClusterClient client.Client , m * expv1.MachinePool , outputPath string ) error {
54
54
for _ , instance := range m .Status .NodeRefs {
55
- containerName := generateContainerName (m .Spec .ClusterName , instance .Name )
56
- err := k .collectLogsFromNode (filepath .Join (outputPath , instance .Name ), containerName )
55
+ err := k .collectLogsFromNode (filepath .Join (outputPath , instance .Name ), instance .Name )
57
56
if err != nil {
58
57
return err
59
58
}
0 commit comments