From f2d7ad205bec43740c82cd51b534458037afc39b Mon Sep 17 00:00:00 2001 From: Dmitri Fedotov <13087245+defo89@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:08:04 +0300 Subject: [PATCH] Always search for lowercase SystemUUID (#22) * nodeInfo.SystemUUID will always be in lowercase but for some vendors server.Spec.UUID is uppercase. --- Dockerfile | 1 + pkg/cloudprovider/metal/instances_v2.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cc3121b..19ca07e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details FROM gcr.io/distroless/static:nonroot +LABEL source_repository="https://github.com/ironcore-dev/cloud-provider-metal" WORKDIR / COPY --from=builder /workspace/manager /metal-cloud-controller-manager USER 65532:65532 diff --git a/pkg/cloudprovider/metal/instances_v2.go b/pkg/cloudprovider/metal/instances_v2.go index cdb8025..1ae029f 100644 --- a/pkg/cloudprovider/metal/instances_v2.go +++ b/pkg/cloudprovider/metal/instances_v2.go @@ -164,7 +164,8 @@ func (o *metalInstancesV2) getServerClaimForNode(ctx context.Context, node *core if err := o.metalClient.Get(ctx, client.ObjectKey{Name: claim.Spec.ServerRef.Name}, server); err != nil { return nil, fmt.Errorf("failed to get server object for node %s: %w", node.Name, err) } - if nodeInfo := node.Status.NodeInfo; nodeInfo.SystemUUID == server.Spec.UUID { + //Avoid case mismatch by converting to lower case + if nodeInfo := node.Status.NodeInfo; nodeInfo.SystemUUID == strings.ToLower(server.Spec.UUID) { return &claim, nil } }