nodeexec

package
v0.0.0-...-6b231d8 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 16 Imported by: 0

Documentation

Overview

* Tencent is pleased to support the open source community by making TKEStack * available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * 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 * * https://opensource.org/licenses/Apache-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 OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.

* Tencent is pleased to support the open source community by making TKEStack * available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * 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 * * https://opensource.org/licenses/Apache-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 OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.

* Tencent is pleased to support the open source community by making TKEStack * available. * * Copyright (C) 2012-2019 Tencent. All Rights Reserved. * * 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 * * https://opensource.org/licenses/Apache-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 OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	// UnKnowTypeErr will be returned if target node executor is not found
	UnKnowTypeErr = fmt.Errorf("unknow node executor type")
	// NoneExecutor will be returned if node executor type is "none"
	NoneExecutor = fmt.Errorf("none executor")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// Type is the node executor type
	Type string
	// Namespace is the namespace to install node agent if node executor type is "agent"
	Namespace string
	// DaemonSet is the DaemonSet name if node executor type is "agent"
	DaemonSet string
	// Image is the image that will be use to create node agent DaemonSet
	Image string
	// AutoCreate indicate whether to create node agent DaemonSet if it is not exist
	// if AutoCreate is true, agent will be deleted once cluster diagnostic done
	AutoCreate bool
}

Config is the config of node executor

func NewConfig

func NewConfig() *Config

NewConfig return a Config with default value

func (*Config) Complete

func (c *Config) Complete()

Complete check and complete config fields

func (*Config) Executor

func (c *Config) Executor(logger logger.Logger,
	cli kubernetes.Interface, config *restclient.Config) (Executor, error)

Executor return the appropriate node executor according to config value

type DaemonSetProxy

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

DaemonSetProxy will create a DaemonSet to do cmd on node

func NewDaemonSetProxy

func NewDaemonSetProxy(logger logger.Logger, cli kubernetes.Interface,
	config *restclient.Config, namespace string,
	ds string, image string, autoCreate bool) (*DaemonSetProxy, error)

NewDaemonSetProxy create and init a new DaemonSetProxy

func (*DaemonSetProxy) DoCmd

func (d *DaemonSetProxy) DoCmd(nodeName string,
	cmd []string) (stdout string, stderr string, err error)

DoCmd executes command on target node

func (*DaemonSetProxy) Finish

func (d *DaemonSetProxy) Finish() error

Finish do clean for ComponentExecutor

type Executor

type Executor interface {
	// DoCmd do cmd on node and return output
	DoCmd(nodeName string, cmd []string) (string, string, error)
	// Finish will be called once this Executor work done
	Finish() error
}

Executor get machine information

Jump to

Keyboard shortcuts

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