start get kubeconfig
This commit is contained in:
parent
6b148ae755
commit
acebc511ef
BIN
k3d → k3d-v3.0.0-dev-20191016-0-1-g6b148ae.tar
Executable file → Normal file
BIN
k3d → k3d-v3.0.0-dev-20191016-0-1-g6b148ae.tar
Executable file → Normal file
Binary file not shown.
41
pkg/cluster/kubeconfig.go
Normal file
41
pkg/cluster/kubeconfig.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
Copyright © 2019 Thorsten Klein <iwilltry42@gmail.com>
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
package cluster
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/rancher/k3d/pkg/runtimes"
|
||||||
|
k3d "github.com/rancher/k3d/pkg/types"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetKubeconfig(runtime runtimes.Runtime, cluster *k3d.Cluster) error {
|
||||||
|
masterNodes, err := runtime.GetNodesByLabel(map[string]string{"k3d.cluster": cluster.Name, "k3d.role": string(k3d.MasterRole)})
|
||||||
|
if err != nil {
|
||||||
|
log.Errorln("Failed to get masternodes")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := runtime.GetKubeconfig(masterNodes[0]); err != nil {
|
||||||
|
log.Errorf("Failed to get kubeconfig from node '%s'", masterNodes[0].Name)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
32
pkg/runtimes/containerd/kubeconfig.go
Normal file
32
pkg/runtimes/containerd/kubeconfig.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
Copyright © 2019 Thorsten Klein <iwilltry42@gmail.com>
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package containerd
|
||||||
|
|
||||||
|
import (
|
||||||
|
k3d "github.com/rancher/k3d/pkg/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetKubeconfig grabs the kubeconfig from inside a k3d node
|
||||||
|
func (d Containerd) GetKubeconfig(node *k3d.Node) error {
|
||||||
|
return nil
|
||||||
|
}
|
32
pkg/runtimes/docker/kubeconfig.go
Normal file
32
pkg/runtimes/docker/kubeconfig.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
Copyright © 2019 Thorsten Klein <iwilltry42@gmail.com>
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package docker
|
||||||
|
|
||||||
|
import (
|
||||||
|
k3d "github.com/rancher/k3d/pkg/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetKubeconfig grabs the kubeconfig from inside a k3d node
|
||||||
|
func (d Docker) GetKubeconfig(node *k3d.Node) error {
|
||||||
|
return nil
|
||||||
|
}
|
@ -41,6 +41,7 @@ type Runtime interface {
|
|||||||
DeleteNode(*k3d.Node) error
|
DeleteNode(*k3d.Node) error
|
||||||
GetNodesByLabel(map[string]string) ([]*k3d.Node, error)
|
GetNodesByLabel(map[string]string) ([]*k3d.Node, error)
|
||||||
CreateNetworkIfNotPresent(name string) (string, error)
|
CreateNetworkIfNotPresent(name string) (string, error)
|
||||||
|
GetKubeconfig(*k3d.Node) error
|
||||||
// StartContainer() error
|
// StartContainer() error
|
||||||
// ExecContainer() error
|
// ExecContainer() error
|
||||||
// StopContainer() error
|
// StopContainer() error
|
||||||
|
Loading…
Reference in New Issue
Block a user