daemon

package
v0.0.0-...-8216aeb Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2016 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Overview

Copyright 2016 Authors of Cilium

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	GcInterval int = 10
)
View Source
const (
	OptionPolicyTracing = "PolicyTracing"
)

Variables

Functions

This section is empty.

Types

type Config

type Config struct {
	LibDir               string                  // Cilium library directory
	RunDir               string                  // Cilium runtime directory
	LXCMap               *lxcmap.LXCMap          // LXCMap where all LXCs are stored
	NodeAddress          *addressing.NodeAddress // Node IPv6 Address
	NAT46Prefix          *net.IPNet              // NAT46 IPv6 Prefix
	Device               string                  // Receive device
	ConsulConfig         *consulAPI.Config       // Consul configuration
	DockerEndpoint       string                  // Docker endpoint
	IPv4Enabled          bool                    // Gives IPv4 addresses to containers
	K8sEndpoint          string                  // Kubernetes endpoint
	ValidLabelPrefixes   *types.LabelPrefixCfg   // Label prefixes used to filter from all labels
	ValidLabelPrefixesMU sync.RWMutex
	UIServerAddr         string // TCP address for UI server
	UIEnabled            bool
	LBMode               bool   // Set to true on load balancer node
	Tunnel               string // Tunnel mode

	DryMode      bool // Do not create BPF maps, devices, ..
	RestoreState bool // RestoreState restores the state from previous running daemons.

	// Options changeable at runtime
	Opts   *types.BoolOptions
	OptsMU sync.RWMutex
}

Config is the configuration used by Daemon.

func NewConfig

func NewConfig() *Config

func (*Config) IsUIEnabled

func (c *Config) IsUIEnabled() bool

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

type Daemon

type Daemon struct {
	// contains filtered or unexported fields
}

Daemon is the cilium daemon that is in charge of perform all necessary plumbing, monitoring when a LXC starts.

func NewDaemon

func NewDaemon(c *Config) (*Daemon, error)

NewDaemon creates and returns a new Daemon with the parameters set in c.

func (*Daemon) AddOrUpdateUINode

func (d *Daemon) AddOrUpdateUINode(id uint32, lbls []types.Label, refCount int)

func (*Daemon) AllocateIP

func (d *Daemon) AllocateIP(ipamType ipam.IPAMType, options ipam.IPAMReq) (*ipam.IPAMRep, error)

AllocateIP allocates and returns a free IPv6 address with plugin configurations specific set up.

func (*Daemon) DeleteLabelsBySHA256

func (d *Daemon) DeleteLabelsBySHA256(sha256Sum string, contID string) error

DeleteLabelsBySHA256 deletes the SecCtxLabels that belong to the labels' sha256Sum.

func (*Daemon) DeleteLabelsByUUID

func (d *Daemon) DeleteLabelsByUUID(id uint32, contID string) error

DeleteLabelsByUUID deletes the SecCtxLabels belonging to the given id.

func (*Daemon) DeleteUINode

func (d *Daemon) DeleteUINode(id uint32)

func (*Daemon) EnableConntrackGC

func (d *Daemon) EnableConntrackGC()

func (*Daemon) EnableConsulWatcher

func (d *Daemon) EnableConsulWatcher(maxSeconds time.Duration)

EnableConsulWatcher watches for consul changes in the common.LastFreeIDKeyPath key. Triggers policy updates every time the value of that key is changed.

func (*Daemon) EnableDockerEventListener

func (d *Daemon) EnableDockerEventListener() error

EnableDockerEventListener watches for docker events. Performs the plumbing for the containers started or dead.

func (*Daemon) EnableDockerSync

func (d *Daemon) EnableDockerSync(once bool)

func (*Daemon) EnableK8sWatcher

func (d *Daemon) EnableK8sWatcher(maxSeconds time.Duration) error

func (*Daemon) EnableLearningTraffic

func (d *Daemon) EnableLearningTraffic()

func (*Daemon) EnableLogstash

func (d *Daemon) EnableLogstash(LogstashAddr string, refreshTime int)

func (*Daemon) EndpointGet

func (d *Daemon) EndpointGet(endpointID uint16) (*types.Endpoint, error)

EndpointGet returns a copy of the endpoint for the given endpointID, or nil if the endpoint was not found.

func (*Daemon) EndpointGetByDockerEPID

func (d *Daemon) EndpointGetByDockerEPID(dockerEPID string) (*types.Endpoint, error)

EndpointGetByDockerEPID returns a copy of the endpoint for the given dockerEPID, or nil if the endpoint was not found.

func (*Daemon) EndpointGetByDockerID

func (d *Daemon) EndpointGetByDockerID(dockerID string) (*types.Endpoint, error)

EndpointGetByDockerID returns a copy of the endpoint for the given dockerEPID, or nil if the endpoint was not found.

func (*Daemon) EndpointJoin

func (d *Daemon) EndpointJoin(ep types.Endpoint) error

EndpointJoin sets up the endpoint working directory.

func (*Daemon) EndpointLabelsGet

func (d *Daemon) EndpointLabelsGet(epID uint16) (*types.OpLabels, error)

func (*Daemon) EndpointLabelsUpdate

func (d *Daemon) EndpointLabelsUpdate(epID uint16, labelOps types.LabelOp) error

func (*Daemon) EndpointLeave

func (d *Daemon) EndpointLeave(epID uint16) error

EndpointLeave cleans the directory used by the endpoint epID and all relevant details with the epID.

func (*Daemon) EndpointLeaveByDockerEPID

func (d *Daemon) EndpointLeaveByDockerEPID(dockerEPID string) error

EndpointLeaveByDockerEPID cleans the directory used by the endpoint dockerEPID and all relevant details with the epID.

func (*Daemon) EndpointSave

func (d *Daemon) EndpointSave(ep types.Endpoint) error

EndpointSave saves the endpoint in the daemon internal endpoint map.

func (*Daemon) EndpointUpdate

func (d *Daemon) EndpointUpdate(epID uint16, opts types.OptionMap) error

EndpointUpdate updates the given endpoint and recompiles the bpf map.

func (*Daemon) EndpointsGet

func (d *Daemon) EndpointsGet() ([]types.Endpoint, error)

EndpointsGet returns a copy of all the endpoints or nil if there are no endpoints.

func (*Daemon) GetCachedLabelList

func (d *Daemon) GetCachedLabelList(ID uint32) ([]types.Label, error)

func (*Daemon) GetIPAMConf

func (d *Daemon) GetIPAMConf(ipamType ipam.IPAMType, options ipam.IPAMReq) (*ipam.IPAMConfigRep, error)

GetIPAMConf returns the IPAM configuration details of the given IPAM type.

func (*Daemon) GetLabels

func (d *Daemon) GetLabels(id uint32) (*types.SecCtxLabel, error)

GetLabels returns the SecCtxLabels that belongs to the given id.

func (*Daemon) GetLabelsBySHA256

func (d *Daemon) GetLabelsBySHA256(sha256sum string) (*types.SecCtxLabel, error)

GetLabelsBySHA256 returns the SecCtxLabels that have the given SHA256SUM.

func (*Daemon) GetMaxID

func (d *Daemon) GetMaxID() (uint32, error)

GetMaxID returns the maximum possible free UUID stored in consul.

func (*Daemon) GetUIIP

func (d *Daemon) GetUIIP() (*net.TCPAddr, error)

func (*Daemon) GetUIPath

func (d *Daemon) GetUIPath() (string, error)

func (*Daemon) InsertEndpoint

func (d *Daemon) InsertEndpoint(ep *types.Endpoint)

Public API to insert an endpoint without connecting it to a container

func (*Daemon) ListenBuildUIEvents

func (d *Daemon) ListenBuildUIEvents()

func (*Daemon) Ping

func (d *Daemon) Ping() (*types.PingResponse, error)

func (*Daemon) PolicyAdd

func (d *Daemon) PolicyAdd(path string, node *types.PolicyNode) error

func (*Daemon) PolicyCanConsume

func (d *Daemon) PolicyCanConsume(ctx *types.SearchContext) (*types.SearchContextReply, error)

PolicyCanConsume calculates if the ctx allows the consumer to be consumed. This public function returns a SearchContextReply with the consumable decision and the tracing log if ctx.Trace was set.

func (*Daemon) PolicyDelete

func (d *Daemon) PolicyDelete(path string) error

PolicyDelete deletes the policy set in path from the policy tree.

func (*Daemon) PolicyGet

func (d *Daemon) PolicyGet(path string) (*types.PolicyNode, error)

PolicyGet returns the policy of the given path.

func (*Daemon) PolicyInit

func (d *Daemon) PolicyInit() error

func (*Daemon) PutLabels

func (d *Daemon) PutLabels(labels types.Labels, contID string) (*types.SecCtxLabel, bool, error)

PutLabels stores to given labels in consul and returns the SecCtxLabels created for the given labels.

func (*Daemon) RegisterUIListener

func (d *Daemon) RegisterUIListener(conn *websocket.Conn) (chan types.UIUpdateMsg, error)

func (*Daemon) ReleaseIP

func (d *Daemon) ReleaseIP(ipamType ipam.IPAMType, options ipam.IPAMReq) error

ReleaseIP releases an IP address in use by the specific IPAM type.

func (*Daemon) SyncState

func (d *Daemon) SyncState(dir string, clean bool) error

SyncState syncs cilium state against the containers running in the host. dir is the cilium's running directory. If clean is set, the endpoints that don't have its container in running state are deleted.

func (*Daemon) Update

func (d *Daemon) Update(opts types.OptionMap) error

type LogstashStat

type LogstashStat struct {
	FromID  uint32
	From    string
	ToID    string
	Bytes   uint64
	Packets uint64
	Action  string
}

Jump to

Keyboard shortcuts

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