Documentation ¶
Overview ¶
Copyright 2018-2019 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.
Copyright 2018-2019 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.
Copyright 2018 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.
Package workloads abstracts individual workload types
Index ¶
- Constants
- func EnableEventListener() (eventsCh chan<- *EventMessage, err error)
- func EndpointCorrelationSleepTime(try int) time.Duration
- func GetDefaultEPOptsStringWithPrefix(prefix string) string
- func GetRuntimeDefaultOpt(crt WorkloadRuntimeType, opt string) string
- func GetRuntimeOptions() string
- func IgnoreRunningWorkloads()
- func Init(o WorkloadOwner)
- func IsRunning(ep *endpoint.Endpoint) bool
- func Setup(a allocatorInterface, workloadRuntimes []string, ...) error
- func Status() *models.Status
- type EventMessage
- type WorkloadOwner
- type WorkloadRuntime
- type WorkloadRuntimeType
Constants ¶
const ( // EpOpt is the option name for path to endpoint EpOpt = "endpoint" // DatapathModeOpt is the option name for datapath mode DatapathModeOpt = "datapath-mode" )
const ( // EventTypeStart represents when a workload was started EventTypeStart eventType = "start" // EventTypeDelete represents when a workload was deleted EventTypeDelete eventType = "delete" )
const ( // EndpointCorrelationMaxRetries is the number of retries to correlate // a workload start event with an existing endpoint before giving up. EndpointCorrelationMaxRetries = 20 )
Variables ¶
This section is empty.
Functions ¶
func EnableEventListener ¶
func EnableEventListener() (eventsCh chan<- *EventMessage, err error)
EnableEventListener watches for docker events. Performs the plumbing for the containers started or dead.
func EndpointCorrelationSleepTime ¶
EndpointCorrelationSleepTime returns the sleep time between correlation attempts
func GetDefaultEPOptsStringWithPrefix ¶
GetDefaultEPOptsStringWithPrefix returns the defaults options for each runtime with the given prefix.
func GetRuntimeDefaultOpt ¶
func GetRuntimeDefaultOpt(crt WorkloadRuntimeType, opt string) string
GetRuntimeDefaultOpt returns the default options for the given container runtime.
func GetRuntimeOptions ¶
func GetRuntimeOptions() string
GetRuntimeOptions returns a string representation of the container runtimes stored and the list of options for each container runtime.
func IgnoreRunningWorkloads ¶
func IgnoreRunningWorkloads()
IgnoreRunningWorkloads checks for already running containers and checks their IP address, then adds the containers to the list of ignored containers and allocates the IPs they are using to prevent future collisions.
func IsRunning ¶
IsRunning returns false if the provided endpoint cannot be associated with a running workload. The runtime must be reachable to make this decision.
Types ¶
type EventMessage ¶
type EventMessage struct { WorkloadID string EventType eventType }
EventMessage is the structure use for the different workload events.
type WorkloadOwner ¶
type WorkloadOwner interface { regeneration.Owner // DeleteEndpoint is called when the underlying workload has died DeleteEndpoint(id string) (int, error) }
WorkloadOwner is the interface that the owner of workloads must implement.
type WorkloadRuntime ¶
type WorkloadRuntime interface { // EnableEventListener enables the event listener of the workload runtime // If the workload runtime does not support events, it will return a // events channel where the caller will be in charge of sending the // create and stop events. EnableEventListener() (eventsCh chan<- *EventMessage, err error) // Status returns the status of the workload runtime. Status() *models.Status // IsRunning returns true if the endpoint is available and in a running // state in the respective workload runtime. IsRunning(ep *endpoint.Endpoint) bool // IgnoreRunningWorkloads sets the runtime to ignore all running workloads. IgnoreRunningWorkloads() // GetAllInfraContainersPID returns a list of workload IDs running in the // workload that represent a infra container. GetAllInfraContainersPID() (map[string]int, error) // contains filtered or unexported methods }
WorkloadRuntime are the individual workload runtime operations that each workload must implement.
type WorkloadRuntimeType ¶
type WorkloadRuntimeType string
WorkloadRuntimeType is the type of a container runtime
const ( None WorkloadRuntimeType = "none" Auto WorkloadRuntimeType = "auto" )
const (
CRIO WorkloadRuntimeType = "crio"
)
const (
ContainerD WorkloadRuntimeType = "containerd"
)
const (
Docker WorkloadRuntimeType = "docker"
)