network

package
v0.0.0-...-02c76fb Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// StatePresent indicates the network should be present
	StatePresent State = "present"

	// StateAbsent indicates the network should be absent
	StateAbsent State = "absent"

	// DefaultDriver is the default network driver
	DefaultDriver = "bridge"

	// DefaultIPAMDriver is the default IPAM driver
	DefaultIPAMDriver = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IPAMConfigs

type IPAMConfigs []dc.IPAMConfig

IPAMConfigs is a slice of dc.IPAMConfig

func (IPAMConfigs) Len

func (ic IPAMConfigs) Len() int

Len implements the sort interface for IPAMConfigs

func (IPAMConfigs) Less

func (ic IPAMConfigs) Less(i, j int) bool

Less implements the sort interface for IPAMConfigs

func (IPAMConfigs) String

func (ic IPAMConfigs) String() string

IPAMConfigString returns a string representation of the IPAMConfigs slice

func (IPAMConfigs) Swap

func (ic IPAMConfigs) Swap(i, j int)

Swap implements the sort interface for IPAMConfigs

type Network

type Network struct {

	// name of the network
	Name string `export:"name"`

	// network drive configured in the hcl
	Driver string `export:"driver"`

	// labels set on the network
	Labels map[string]string `export:"labels"`

	// driver-specific options that have been configured
	Options map[string]interface{} `export:"options"`

	// docker client IPAM options
	IPAM dc.IPAMOptions `export:"ipam"`

	// restricted to internal networking
	Internal bool `export:"internal"`

	// uses ipv6
	IPv6 bool `export:"ipv6"`

	// the configured state
	State State `export:"state"`

	// true if 'force' was specified in the hcl
	Force bool `export:"force"`
	// contains filtered or unexported fields
}

Network is responsible for managing docker networks

func (*Network) Apply

Apply ensures the network matches the desired state

func (*Network) Check

Check system for docker network

func (*Network) SetClient

func (n *Network) SetClient(client docker.NetworkClient)

SetClient injects a docker api client

type Preparer

type Preparer struct {
	// name of the network
	Name string `hcl:"name" required:"true" nonempty:"true"`

	// network driver. default: bridge
	Driver string `hcl:"driver"`

	// labels to set on the network
	Labels map[string]string `hcl:"labels"`

	// driver specific options
	Options map[string]interface{} `hcl:"options"`

	// ip address management driver. default: default
	IPAMDriver string `hcl:"ipam_driver"`

	// optional custom IPAM configuration. multiple IPAM configurations are
	// permitted. Each IPAM configuration block should contain one or more of the
	// following items:
	//
	//   * subnet:      subnet in CIDR format
	//   * gateway:     ipv4 or ipv6 gateway for the corresponding subnet
	//   * ip_range:    container ips are allocated from this sub-ranges (CIDR format)
	//   * aux_address: auxiliary ipv4 or ipv6 addresses used by the network driver.
	//                  Aux addresses are specified as a map with a name key and an IP
	//                  address value
	IPAMConfig []ipamConfigMap `hcl:"ipam_config"`

	// restricts external access to the network
	Internal bool `hcl:"internal"`

	// enable ipv6 networking
	IPv6 bool `hcl:"ipv6"`

	// indicates whether the network should exist. default: present
	State State `hcl:"state" valid_values:"present,absent"`

	// indicates whether or not the network will be recreated if the state is not
	// what is expected. By default, the module will only check to see if the
	// network exists. Specified as a boolean value
	Force bool `hcl:"force"`
}

Preparer for docker networks

Network is responsible for managing Docker networks. It assumes that there is already a Docker daemon running on the system. *Note: docker resources are not currently supported on Solaris.*

func (*Preparer) Prepare

func (p *Preparer) Prepare(ctx context.Context, render resource.Renderer) (resource.Task, error)

Prepare a docker network

type State

type State string

State type for Network

Jump to

Keyboard shortcuts

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