Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ vendor/
# Binaries
out/*
output/*
cns/service/service

# Artifacts
azure-*.json
Expand Down
4 changes: 2 additions & 2 deletions .pipelines/build/dockerfiles/cns.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ ENTRYPOINT ["azure-cns.exe"]
EXPOSE 10090

# mcr.microsoft.com/azurelinux/base/core:3.0
FROM --platform=linux/${ARCH} mcr.microsoft.com/azurelinux/base/core@sha256:9948138108a3d69f1dae62104599ac03132225c3b7a5ac57b85a214629c8567d AS build-helper
FROM --platform=linux/${ARCH} mcr.microsoft.com/azurelinux/base/core@sha256:c09a4e011a092a45b5c46ac5633253eb1e1106df028912b89cbe225d9061ef0b AS build-helper
RUN tdnf install -y iptables

# mcr.microsoft.com/azurelinux/distroless/minimal:3.0
FROM --platform=linux/${ARCH} mcr.microsoft.com/azurelinux/distroless/minimal@sha256:0801b80a0927309572b9adc99bd1813bc680473175f6e8175cd4124d95dbd50c AS linux
FROM --platform=linux/${ARCH} mcr.microsoft.com/azurelinux/distroless/minimal@sha256:c37100f358ee19e62c60673c54fb43b83d43b2c305846e44b23b2e032e9caf30 AS linux
ARG ARTIFACT_DIR .

COPY --from=build-helper /usr/sbin/*tables* /usr/sbin/
Expand Down
4 changes: 2 additions & 2 deletions cni/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ ARG OS_VERSION
ARG OS

# mcr.microsoft.com/oss/go/microsoft/golang:1.23-azurelinux3.0
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:8f60e85f4b2f567c888d0b3a4cd12dc74bee534d94c528655546452912d90c74 AS go
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:2b7adfb3e3384d2ddc5e65c3f37265f575340d7e1c771bef073ca8da651922f1 AS go

# mcr.microsoft.com/azurelinux/base/core:3.0
FROM --platform=linux/${ARCH} mcr.microsoft.com/azurelinux/base/core@sha256:9948138108a3d69f1dae62104599ac03132225c3b7a5ac57b85a214629c8567d AS mariner-core
FROM --platform=linux/${ARCH} mcr.microsoft.com/azurelinux/base/core@sha256:c09a4e011a092a45b5c46ac5633253eb1e1106df028912b89cbe225d9061ef0b AS mariner-core

FROM go AS azure-vnet
ARG OS
Expand Down
6 changes: 3 additions & 3 deletions cns/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ ARG OS_VERSION
ARG OS

# mcr.microsoft.com/oss/go/microsoft/golang:1.23-azurelinux3.0
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:8f60e85f4b2f567c888d0b3a4cd12dc74bee534d94c528655546452912d90c74 AS go
FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:2b7adfb3e3384d2ddc5e65c3f37265f575340d7e1c771bef073ca8da651922f1 AS go

# mcr.microsoft.com/azurelinux/base/core:3.0
FROM mcr.microsoft.com/azurelinux/base/core@sha256:9948138108a3d69f1dae62104599ac03132225c3b7a5ac57b85a214629c8567d AS mariner-core
FROM mcr.microsoft.com/azurelinux/base/core@sha256:c09a4e011a092a45b5c46ac5633253eb1e1106df028912b89cbe225d9061ef0b AS mariner-core

# mcr.microsoft.com/azurelinux/distroless/minimal:3.0
FROM mcr.microsoft.com/azurelinux/distroless/minimal@sha256:0801b80a0927309572b9adc99bd1813bc680473175f6e8175cd4124d95dbd50c AS mariner-distroless
FROM mcr.microsoft.com/azurelinux/distroless/minimal@sha256:c37100f358ee19e62c60673c54fb43b83d43b2c305846e44b23b2e032e9caf30 AS mariner-distroless

FROM --platform=linux/${ARCH} go AS builder
ARG OS
Expand Down
29 changes: 23 additions & 6 deletions cns/hnsclient/hnsclient_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@
// 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")
Expand Down Expand Up @@ -552,7 +557,10 @@

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",

Check failure on line 560 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

SA1019: logger.Printf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)

Check failure on line 560 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

SA1019: logger.Printf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)
endpoint.Id, endpoint.Name, endpoint.HostComputeNetwork)
logger.Printf("[Azure CNS] Endpoint IpConfigurations:%v, Dns:%v, Routes:%v, MacAddress:%s, Flags:%d",

Check failure on line 562 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

SA1019: logger.Printf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)

Check failure on line 562 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

SA1019: logger.Printf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)
endpoint.IpConfigurations, endpoint.Dns, endpoint.Routes, endpoint.MacAddress, endpoint.Flags)

return endpoint, nil
}
Expand Down Expand Up @@ -584,7 +592,8 @@
}

if endpoint != nil {
logger.Debugf("[Azure CNS] Found existing endpoint: %+v", endpoint)
logger.Debugf("[Azure CNS] Found existing endpoint with ID: %s, Name: %s, Network: %s",

Check failure on line 595 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

SA1019: logger.Debugf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)

Check failure on line 595 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

SA1019: logger.Debugf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)
endpoint.Id, endpoint.Name, endpoint.HostComputeNetwork)
return endpoint.Id, nil
}

Expand All @@ -608,14 +617,18 @@
return "", err
}

logger.Printf("[Azure CNS] Creating HostNCApipaEndpoint for host container connectivity: %+v", endpoint)
logger.Printf("[Azure CNS] Creating HostNCApipaEndpoint with ID: %s, Name: %s, Network: %s",

Check failure on line 620 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

SA1019: logger.Printf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)

Check failure on line 620 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

SA1019: logger.Printf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)
endpoint.Id, endpoint.Name, endpoint.HostComputeNetwork)
if endpoint, err = endpoint.Create(); err != nil {
err = fmt.Errorf("Failed to create HostNCApipaEndpoint: %s. Error: %v", endpointName, err)
logger.Errorf("[Azure CNS] %s", err.Error())
return "", err
}

logger.Printf("[Azure CNS] Successfully created HostNCApipaEndpoint: %+v", endpoint)
logger.Printf("[Azure CNS] Successfully created HostNCApipaEndpoint with ID: %s, Name: %s, Network: %s",

Check failure on line 628 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

SA1019: logger.Printf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)

Check failure on line 628 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

SA1019: logger.Printf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)
endpoint.Id, endpoint.Name, endpoint.HostComputeNetwork)
logger.Debugf("[Azure CNS] Endpoint details - IpConfigurations:%v, Dns:%v, Routes:%v, MacAddress:%s, Flags:%d",

Check failure on line 630 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

SA1019: logger.Debugf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)

Check failure on line 630 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

SA1019: logger.Debugf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)
endpoint.IpConfigurations, endpoint.Dns, endpoint.Routes, endpoint.MacAddress, endpoint.Flags)

return endpoint.Id, nil
}
Expand Down Expand Up @@ -689,10 +702,14 @@
}

if err = endpoint.Delete(); err != nil {
return fmt.Errorf("Failed to delete endpoint: %+v. Error: %v", endpoint, err)
return fmt.Errorf("%w: %s (%s): %v",
ErrDeleteEndpoint, endpoint.Name, endpoint.Id, err)

Check failure on line 706 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)

Check failure on line 706 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
}

logger.Errorf("[Azure CNS] Successfully deleted endpoint: %+v", endpoint)
logger.Errorf("[Azure CNS] Successfully deleted endpoint with ID: %s, Name: %s",

Check failure on line 709 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

SA1019: logger.Errorf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)

Check failure on line 709 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

SA1019: logger.Errorf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)
endpoint.Id, endpoint.Name)
logger.Debugf("[Azure CNS] Endpoint details - IpConfigurations:%v, Dns:%v, Routes:%v, MacAddress:%s, Flags:%d",

Check failure on line 711 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.22.x, windows-latest)

SA1019: logger.Debugf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)

Check failure on line 711 in cns/hnsclient/hnsclient_windows.go

View workflow job for this annotation

GitHub Actions / Lint (1.23.x, windows-latest)

SA1019: logger.Debugf is deprecated: The global logger is deprecated. Migrate to zap using the cns/logger/v2 package and pass the logger instead. (staticcheck)
endpoint.IpConfigurations, endpoint.Dns, endpoint.Routes, endpoint.MacAddress, endpoint.Flags)

return nil
}
Expand Down
Loading