diff --git a/.gitignore b/.gitignore index 2558114dbc..f9c56d8d2c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ vendor/ # Binaries out/* output/* +cns/service/service # Artifacts azure-*.json diff --git a/cni/Dockerfile b/cni/Dockerfile index 61f9f52e69..6c25a6062f 100644 --- a/cni/Dockerfile +++ b/cni/Dockerfile @@ -6,10 +6,10 @@ ARG OS_VERSION ARG OS # mcr.microsoft.com/oss/go/microsoft/golang:1.23-cbl-mariner2.0 -FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:f1cb092e89f5f3448b6db87729039c61541cb85747c690f760b3017218d449bb AS go +FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:b06999cae63b9b6f43bcb16bd16bcbedae847684515317e15607a601ed108030 AS go # mcr.microsoft.com/cbl-mariner/base/core:2.0 -FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core@sha256:12480ee9f027c304fabc17d70afc7d5da6c49ad46f0401947478e7218ea0ff6c AS mariner-core +FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core@sha256:961bfedbbbdc0da51bc664f51d959da292eced1ad46c3bf674aba43b9be8c703 AS mariner-core FROM go AS azure-vnet ARG OS diff --git a/cns/Dockerfile b/cns/Dockerfile index dbd9078810..d4ad81699b 100644 --- a/cns/Dockerfile +++ b/cns/Dockerfile @@ -5,13 +5,13 @@ ARG OS_VERSION ARG OS # mcr.microsoft.com/oss/go/microsoft/golang:1.23-cbl-mariner2.0 -FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:f1cb092e89f5f3448b6db87729039c61541cb85747c690f760b3017218d449bb AS go +FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:b06999cae63b9b6f43bcb16bd16bcbedae847684515317e15607a601ed108030 AS go # mcr.microsoft.com/cbl-mariner/base/core:2.0 -FROM mcr.microsoft.com/cbl-mariner/base/core@sha256:12480ee9f027c304fabc17d70afc7d5da6c49ad46f0401947478e7218ea0ff6c AS mariner-core +FROM mcr.microsoft.com/cbl-mariner/base/core@sha256:961bfedbbbdc0da51bc664f51d959da292eced1ad46c3bf674aba43b9be8c703 AS mariner-core # mcr.microsoft.com/cbl-mariner/distroless/minimal:2.0 -FROM mcr.microsoft.com/cbl-mariner/distroless/minimal@sha256:a2529d152e75b29502a8de264a4f3dfb8fd126d870c9bf4456d03b7a7dab7268 AS mariner-distroless +FROM mcr.microsoft.com/cbl-mariner/distroless/minimal@sha256:7778a86d86947d5f64c1280a7ee0cf36c6c6d76b5749dd782fbcc14f113961bf AS mariner-distroless FROM --platform=linux/${ARCH} go AS builder ARG OS diff --git a/cns/hnsclient/hnsclient_windows.go b/cns/hnsclient/hnsclient_windows.go index b97781a17a..b0ae77c2d1 100644 --- a/cns/hnsclient/hnsclient_windows.go +++ b/cns/hnsclient/hnsclient_windows.go @@ -90,6 +90,11 @@ const ( // Named Lock for network and endpoint creation/deletion var namedLock = common.InitNamedLock() +// Error definitions +var ( + ErrDeleteEndpoint = errors.New("failed to delete endpoint") +) + // CreateHnsNetwork creates the HNS network with the provided configuration func CreateHnsNetwork(nwConfig cns.CreateHnsNetworkRequest) error { logger.Printf("[Azure CNS] CreateHnsNetwork") @@ -552,7 +557,10 @@ func configureHostNCApipaEndpoint( endpoint.IpConfigurations = append(endpoint.IpConfigurations, ipConfiguration) - logger.Printf("[Azure CNS] Configured HostNCApipaEndpoint: %+v", endpoint) + logger.Printf("[Azure CNS] Configured HostNCApipaEndpoint with ID: %s, Name: %s, Network: %s", + endpoint.Id, endpoint.Name, endpoint.HostComputeNetwork) + logger.Printf("[Azure CNS] Endpoint IpConfigurations:%v, Dns:%v, Routes:%v, MacAddress:%s, Flags:%d", + endpoint.IpConfigurations, endpoint.Dns, endpoint.Routes, endpoint.MacAddress, endpoint.Flags) return endpoint, nil } @@ -689,10 +697,14 @@ func deleteEndpointByNameHnsV2( } if err = endpoint.Delete(); err != nil { - return fmt.Errorf("Failed to delete endpoint: %+v. Error: %v", endpoint, err) + return fmt.Errorf("%w: %s (%s): %w", + ErrDeleteEndpoint, endpoint.Name, endpoint.Id, err) } - logger.Errorf("[Azure CNS] Successfully deleted endpoint: %+v", endpoint) + logger.Errorf("[Azure CNS] Successfully deleted endpoint with ID: %s, Name: %s", + endpoint.Id, endpoint.Name) + logger.Debugf("[Azure CNS] Endpoint details - IpConfigurations:%v, Dns:%v, Routes:%v, MacAddress:%s, Flags:%d", + endpoint.IpConfigurations, endpoint.Dns, endpoint.Routes, endpoint.MacAddress, endpoint.Flags) return nil }