Documentation ¶
Overview ¶
Copyright © 2020 The k3d Author(s)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2020 The k3d Author(s)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2020 The k3d Author(s)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2020 The k3d Author(s)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2020 The k3d Author(s)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2020 The k3d Author(s)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- func GetDefaultObjectLabelsFilter(clusterName string) filters.Args
- func GetGatewayIP(ctx context.Context, network string) (net.IP, error)
- func GetNetwork(ctx context.Context, ID string) (types.NetworkResource, error)
- func TranslateContainerDetailsToNode(containerDetails types.ContainerJSON) (*k3d.Node, error)
- func TranslateContainerToNode(cont *types.Container) (*k3d.Node, error)
- type Docker
- func (d Docker) ConnectNodeToNetwork(ctx context.Context, node *k3d.Node, networkName string) error
- func (d Docker) CopyToNode(ctx context.Context, src string, dest string, node *k3d.Node) error
- func (d Docker) CreateNetworkIfNotPresent(ctx context.Context, name string) (string, bool, error)
- func (d Docker) CreateNode(ctx context.Context, node *k3d.Node) error
- func (d Docker) CreateVolume(ctx context.Context, name string, labels map[string]string) error
- func (d Docker) DeleteNetwork(ctx context.Context, ID string) error
- func (d Docker) DeleteNode(ctx context.Context, nodeSpec *k3d.Node) error
- func (d Docker) DeleteVolume(ctx context.Context, name string) error
- func (d Docker) DisconnectNodeFromNetwork(ctx context.Context, node *k3d.Node, networkName string) error
- func (d Docker) ExecInNode(ctx context.Context, node *k3d.Node, cmd []string) error
- func (d Docker) ExecInNodeGetLogs(ctx context.Context, node *k3d.Node, cmd []string) (*bufio.Reader, error)
- func (d Docker) GetDockerMachineIP() (string, error)
- func (d Docker) GetHostIP(ctx context.Context, network string) (net.IP, error)
- func (d Docker) GetImages(ctx context.Context) ([]string, error)
- func (d Docker) GetKubeconfig(ctx context.Context, node *k3d.Node) (io.ReadCloser, error)
- func (d Docker) GetNode(ctx context.Context, node *k3d.Node) (*k3d.Node, error)
- func (d Docker) GetNodeLogs(ctx context.Context, node *k3d.Node, since time.Time) (io.ReadCloser, error)
- func (d Docker) GetNodeStatus(ctx context.Context, node *k3d.Node) (bool, string, error)
- func (d Docker) GetNodesByLabel(ctx context.Context, labels map[string]string) ([]*k3d.Node, error)
- func (d Docker) GetNodesInNetwork(ctx context.Context, network string) ([]*k3d.Node, error)
- func (d Docker) GetRuntimePath() string
- func (d Docker) GetVolume(name string) (string, error)
- func (d Docker) NodeIsRunning(ctx context.Context, node *k3d.Node) (bool, error)
- func (d Docker) StartNode(ctx context.Context, node *k3d.Node) error
- func (d Docker) StopNode(ctx context.Context, node *k3d.Node) error
- func (d Docker) WriteToNode(ctx context.Context, content []byte, dest string, node *k3d.Node) error
- type NodeInDocker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultObjectLabelsFilter ¶
GetDefaultObjectLabelsFilter returns docker type filters created from k3d labels
func GetGatewayIP ¶
GetGatewayIP returns the IP of the network gateway
func GetNetwork ¶
GetNetwork gets information about a network by its ID
func TranslateContainerDetailsToNode ¶
func TranslateContainerDetailsToNode(containerDetails types.ContainerJSON) (*k3d.Node, error)
TranslateContainerDetailsToNode translates a docker containerJSON object into a k3d node representation
Types ¶
type Docker ¶
type Docker struct{}
func (Docker) ConnectNodeToNetwork ¶
ConnectNodeToNetwork connects a node to a network
func (Docker) CopyToNode ¶
CopyToNode copies a file from the local FS to the selected node
func (Docker) CreateNetworkIfNotPresent ¶
CreateNetworkIfNotPresent creates a new docker network @return: network name, exists, error
func (Docker) CreateNode ¶
CreateNode creates a new container
func (Docker) CreateVolume ¶
CreateVolume creates a new named volume
func (Docker) DeleteNetwork ¶
DeleteNetwork deletes a network
func (Docker) DeleteNode ¶
DeleteNode deletes a node
func (Docker) DeleteVolume ¶
DeleteVolume creates a new named volume
func (Docker) DisconnectNodeFromNetwork ¶
func (d Docker) DisconnectNodeFromNetwork(ctx context.Context, node *k3d.Node, networkName string) error
DisconnectNodeFromNetwork disconnects a node from a network (u don't say :O)
func (Docker) ExecInNode ¶
ExecInNode execs a command inside a node
func (Docker) ExecInNodeGetLogs ¶
func (d Docker) ExecInNodeGetLogs(ctx context.Context, node *k3d.Node, cmd []string) (*bufio.Reader, error)
ExecInNodeGetLogs executes a command inside a node and returns the logs to the caller, e.g. to parse them
func (Docker) GetDockerMachineIP ¶
func (Docker) GetHostIP ¶
GetHostIP returns the IP of the docker host (routable from inside the containers)
func (Docker) GetKubeconfig ¶
GetKubeconfig grabs the kubeconfig from inside a k3d node
func (Docker) GetNodeLogs ¶
func (d Docker) GetNodeLogs(ctx context.Context, node *k3d.Node, since time.Time) (io.ReadCloser, error)
GetNodeLogs returns the logs from a given node
func (Docker) GetNodeStatus ¶
GetNodeStatus returns the status of a node (Running, Started, etc.)
func (Docker) GetNodesByLabel ¶
GetNodesByLabel returns a list of existing nodes
func (Docker) GetNodesInNetwork ¶
GetNodesInNetwork returns all the nodes connected to a given network
func (Docker) GetRuntimePath ¶
GetRuntimePath returns the path of the docker socket
func (Docker) NodeIsRunning ¶
NodeIsRunning tells the caller if a given node is in "running" state
type NodeInDocker ¶
type NodeInDocker struct { ContainerConfig container.Config // TODO: do we need this as pointers? HostConfig container.HostConfig NetworkingConfig network.NetworkingConfig }
NodeInDocker represents everything that we need to represent a k3d node in docker
func TranslateNodeToContainer ¶
func TranslateNodeToContainer(node *k3d.Node) (*NodeInDocker, error)
TranslateNodeToContainer translates a k3d node specification to a docker container representation