hnslib

package module
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 2 Imported by: 0

README

hnslib

This package provides the Golang interface for accessing Windows HCN APIs to manage entities within the Host Network Service (HNS), which serves as the server container networking component in Windows. While it is mainly utilized by the Windows KubeProxy component in Kubernetes, it is also available for use in other projects, such as Azure CNI, Windows CNI, Calico CNI, Flannel CNI, Azure NPM, and more.

Building

This project is imported by KubeProxy, Kubelet etc. for building binaries.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit Microsoft CLA.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

We require that contributors sign their commits to certify they either authored the work themselves or otherwise have permission to use it in this project.

We also require that contributors sign their commits using using git commit --signoff to certify they either authored the work themselves or otherwise have permission to use it in this project. A range of commits can be signed off using git rebase --signoff.

Please see the developer certificate for more info, as well as to make sure that you can attest to the rules listed. Our CI uses the DCO Github app to ensure that all commits in a given PR are signed-off.

Linting

Code must pass a linting stage, which uses golangci-lint. Since ./test is a separate Go module, the linter is run from both the root and the test directories. Additionally, the linter is run with GOOS set to both windows and linux.

The linting settings are stored in .golangci.yaml, and can be run automatically with VSCode by adding the following to your workspace or folder settings:

    "go.lintTool": "golangci-lint",
    "go.lintOnSave": "package",

Additional editor integrations options are also available.

Alternatively, golangci-lint can be installed and run locally:

# use . or specify a path to only lint a package
# to show all lint errors, use flags "--max-issues-per-linter=0 --max-same-issues=0"
> golangci-lint run

To run across the entire repo for both GOOS=windows and linux:

> foreach ( $goos in ('windows', 'linux') ) {
    foreach ( $repo in ('.', 'test') ) {
        pwsh -Command "cd $repo && go env -w GOOS=$goos && golangci-lint.exe run --verbose"
    }
}
Go Generate

The pipeline checks that auto-generated code, via go generate, are up to date. Similar to the linting stage, go generate is run in root Go modules.

This can be done via:

> go generate ./...
> cd test && go generate ./...

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Dependencies

This project requires Golang 1.22 or newer to build.

For system requirements to run this project, see the Microsoft docs on Windows Container requirements.

Reporting Security Issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

For additional details, see Report a Computer Security Vulnerability on Technet


Copyright (c) 2018 Microsoft Corp. All rights reserved.

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorEmptyMacAddressList = errors.New("management mac_address list is empty")
)
View Source
var (
	HNSVersion1803 = hns.HNSVersion1803
)

Functions

This section is empty.

Types

type EndpointNotFoundError

type EndpointNotFoundError = hns.EndpointNotFoundError

type HNSAclFeatures

type HNSAclFeatures = hns.HNSAclFeatures

type HNSEndpoint

type HNSEndpoint = hns.HNSEndpoint

HNSEndpoint represents a network endpoint in HNS

func HNSListEndpointRequest added in v0.0.3

func HNSListEndpointRequest() ([]HNSEndpoint, error)

HNSListEndpointRequest makes a HNS call to query the list of available endpoints

type HNSEndpointStats

type HNSEndpointStats = hns.EndpointStats

HNSEndpointStats represent the stats for an networkendpoint in HNS

func GetHNSEndpointStats

func GetHNSEndpointStats(endpointName string) (*HNSEndpointStats, error)

GetHNSEndpointStats gets the endpoint stats by ID

type HNSGlobals

type HNSGlobals = hns.HNSGlobals

func GetHNSGlobals

func GetHNSGlobals() (*HNSGlobals, error)

type HNSNetwork added in v0.0.3

type HNSNetwork = hns.HNSNetwork

HNSNetwork represents a network in HNS

func HNSListNetworkRequest added in v0.0.3

func HNSListNetworkRequest(method, path, request string) ([]HNSNetwork, error)

HNSListNetworkRequest makes a HNS call to query the list of available networks

type HNSNnvManagementMacAddress

type HNSNnvManagementMacAddress = hns.HNSNnvManagementMacAddress

HNSNnvManagementMacAddress represents management mac address which needs to be excluded from VF reassignment

type HNSNnvManagementMacList

type HNSNnvManagementMacList = hns.HNSNnvManagementMacList

HNSNnvManagementMacList represents a list of management mac addresses for exclusion from VF reassignment

func DeleteNnvManagementMacAddresses

func DeleteNnvManagementMacAddresses() (*HNSNnvManagementMacList, error)

DeleteNnvManagementMacAddresses delete list of management mac addresses in hns which are excluded from VF reassignment.

func GetNnvManagementMacAddresses

func GetNnvManagementMacAddresses() (*HNSNnvManagementMacList, error)

GetNnvManagementMacAddresses retrieves a list of management mac addresses in hns for exclusion from VF reassignment.

func SetNnvManagementMacAddresses

func SetNnvManagementMacAddresses(managementMacAddresses []string) (*HNSNnvManagementMacList, error)

SetNnvManagementMacAddresses sets a list of management mac addresses in hns for exclusion from VF reassignment.

type HNSSupportedFeatures

type HNSSupportedFeatures = hns.HNSSupportedFeatures

func GetHNSSupportedFeatures

func GetHNSSupportedFeatures() HNSSupportedFeatures

type HNSVersion

type HNSVersion = hns.HNSVersion

type MacPool added in v0.0.3

type MacPool = hns.MacPool

MacPool is associated with a network and represents a list of macaddresses available to the network

type Namespace

type Namespace = hns.Namespace

Namespace represents a Compartment.

type NetworkNotFoundError

type NetworkNotFoundError = hns.NetworkNotFoundError

type PolicyList added in v0.0.4

type PolicyList = hns.PolicyList

PolicyList is a structure defining schema for Policy list request

func HNSListPolicyListRequest added in v0.0.4

func HNSListPolicyListRequest() ([]PolicyList, error)

HNSListPolicyListRequest gets all the policy list

type Subnet added in v0.0.3

type Subnet = hns.Subnet

Subnet is associated with a network and represents a list of subnets available to the network

Directories

Path Synopsis
Package hcn is a shim for the Host Compute Networking (HCN) service, which manages networking for Windows Server containers and Hyper-V containers.
Package hcn is a shim for the Host Compute Networking (HCN) service, which manages networking for Windows Server containers and Hyper-V containers.
internal
cni
hns
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL