Documentation
¶
Index ¶
- Variables
- func Container(name string) string
- func JournalReader(namespace, name, container string, logOpts nodeapi.ContainerLogOpts) (*sdjournal.JournalReader, error)
- func Name(name string) string
- func Namespace(name string) string
- func Pod(name string) string
- func SetDefaultOpts(opts *Opts) error
- type Opts
- type Provider
- type Volume
Constants ¶
This section is empty.
Variables ¶
var ( DefaultOperatingSystem = "Linux" // systemd is only supported on Linux DefaultInformerResyncPeriod = 1 * time.Minute DefaultMetricsAddr = ":10255" DefaultListenAddr = ":10250" DefaultPodSyncWorkers = 10 DefaultKubeClusterDomain = "cluster.local" DefaultTaintKey = "virtual-kubelet.io/provider" DefaultTaintValue = "systemk" DefaultStreamIdleTimeout = 30 * time.Second DefaultStreamCreationTimeout = 30 * time.Second )
Defaults for the provider.
Functions ¶
func JournalReader ¶
func JournalReader(namespace, name, container string, logOpts nodeapi.ContainerLogOpts) (*sdjournal.JournalReader, error)
JournalReader returns the actual journal reader. This is useful when an io.ReadCloser is not enough, eg we need Follow().
func Name ¶
Name returns <namespace>.<podname> from a well formed name. Units are named as 'systemk.<namespace>.<podname>.<container>'.
func SetDefaultOpts ¶
SetDefaultOpts sets default options for unset values of the passed in option struct. Fields that are already set will not be modified.
Types ¶
type Opts ¶
type Opts struct { // ServerCertPath is the path to the certificate to secure the kubelet API. ServerCertPath string // ServerKeyPath is the path to the private key to sign the kubelet API. ServerKeyPath string // NodeInternalIP is the desired Node internal IP. NodeInternalIP net.IP // NodeExternalIP is the desired Node external IP. NodeExternalIP net.IP // NodeInternalIface is interface's name whose address to use for Node internal IP. NodeInternalIface string // NodeExternalIface is the interface's name whose address to use for Node external IP. NodeExternalIface string // KubeConfigPath is the path to the Kubernetes client configuration. KubeConfigPath string // KubeClusterDomain is the suffix to append to search domains for the Pods. KubeClusterDomain string // KubernetesURL is the value to set for the KUBERNETES_SERVICE_* Pod env vars. KubernetesURL string // ListenAddress is the address to bind for serving requests from the Kubernetes API server. ListenAddress string // NodeName identifies the Node in the cluster. NodeName string // DisableTaint disables systemk default taint. DisableTaint bool // MetricsAddr is the address to bind for serving metrics. MetricsAddr string // PodSyncWorkers is the number of workers that handle Pod events. PodSyncWorkers int // InformerResyncPeriod is the interval between relisting of Kubernetes resources. // This is important as it serves as a recovery mechanism in case systemk lost any // events related to the resources it's watching, eg due to network partition. InformerResyncPeriod time.Duration // StartupTimeout is how long to wait for systemk to start. StartupTimeout time.Duration // StreamIdleTimeout is the maximum time a streaming connection // can be idle before the connection is automatically closed. StreamIdleTimeout time.Duration // StreamCreationTimeout is the maximum time for streaming connection. StreamCreationTimeout time.Duration // OverrideRootUID maps the root user to this UID (defaults to 0). OverrideRootUID int // Version carries the systemk version. Version string }
Opts stores all the configuration options. It is used for setting flag values.
You can set the default options by creating a new `Opts` struct and passing it into `SetDefaultOpts`
type Provider ¶
type Provider interface { node.PodLifecycleHandler kubernetes.ResourceUpdater // GetContainerLogsHandler handles a Pod's container log retrieval. GetContainerLogsHandler(w http.ResponseWriter, r *http.Request) // RunInContainer executes a command in a container in the pod, copying data // between in/out/err and the container's stdin/stdout/stderr. RunInContainer(ctx context.Context, namespace, podName, containerName string, cmd []string, attach api.AttachIO) error // ConfigureNode enables a provider to configure the Node object that // will be used for Kubernetes. ConfigureNode(context.Context, *Opts) (*corev1.Node, error) }
Provider contains the methods required to implement a virtual-kubelet provider.
Errors produced by these methods should implement an interface from github.com/virtual-kubelet/virtual-kubelet/errdefs package in order for the core logic to be able to understand the type of failure.
func New ¶
func New(ctx context.Context, config *Opts, podWatcher kubernetes.PodResourceManager) (Provider, error)
New returns a new systemd provider. informerFactory is the basis for ConfigMap and Secret retrieval and event handling.