compexplorer

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: 14 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.

* 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

View Source
const (
	// TypeStaticPod is the type of StaticPod explore
	TypeStaticPod = "StaticPod"
	// TypeLabel is the type of Label explore
	TypeLabel = "Label"
	// TypeBare is the type of Bare explore
	TypeBare = "Bare"
	// TypeAuto is the type of Auto explore
	TypeAuto = "Auto"
)

Variables

This section is empty.

Functions

func ExplorePods

func ExplorePods(logger logger.Logger, name string,
	pods []v1.Pod, exec nodeexec.Executor) []cluster.Component

ExplorePod explore a component from k8s pods if exec is not nil, a bare explore will be used for fetching component command line arguments if bare explore failed, command line argument find in pod will be used

func GetPodArgs

func GetPodArgs(name string, pod *v1.Pod) map[string]string

GetPodArgs try get args from pod

Types

type Auto

type Auto struct {

	// Type indicate the type that Auto explore use
	// if Type=Auto, multiple methods will be used for exploring component one by one
	// otherwise, explore that type=Type will be used
	Type string
	// Name is the name of target component
	// when use StaticPod explore, target pod name will be Name-NodeName
	// when use Label explore, default target label will be k8s-app=Name
	// when use Bare explore, Name is the target process name
	Name string
	// Namespace is the target namespace if Type is "StaticPod" or "Label"
	Namespace string
	// Nodes are target nodes for exploring components
	Nodes []string
	// MasterNodes indicate that whether only master nodes ares target nodes
	// if Nodes is empty and MasterNodes is false, all nodes are target nodes
	MasterNodes bool
	// Labels will be used when use label explore
	Labels map[string]string
	// contains filtered or unexported fields
}

Auto is a component explorer that can try to explore component information by multiple methods

func NewAuto

func NewAuto(defName string, masterNodes bool) *Auto

NewAuto create a ComponentConfig with default value

func (*Auto) Complete

func (a *Auto) Complete()

Complete check and complete config

func (*Auto) Component

func (a *Auto) Component() ([]cluster.Component, error)

Component return target component info

func (*Auto) Finish

func (a *Auto) Finish() error

Finish will be called once every thing done

func (*Auto) Init

func (a *Auto) Init(logger logger.Logger,
	cli kubernetes.Interface,
	nodeExecutor nodeexec.Executor) error

Init create explores according to config

type Bare

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

Bare get component information by executing cmd on node

func NewBare

func NewBare(logger logger.Logger,
	cmdName string, nodes []string,
	executor nodeexec.Executor) *Bare

NewBare create and int a StaticPods ComponentExecutor

func (*Bare) Component

func (b *Bare) Component() ([]cluster.Component, error)

Component get cluster components

func (*Bare) Finish

func (b *Bare) Finish() error

Finish will be called once every thing done

type Explorer

type Explorer interface {
	// Component get cluster components
	Component() ([]cluster.Component, error)
	// Finish will be called once every thing done
	Finish() error
}

Explorer get component information

type LabelExp

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

LabelExp get select pod with labels and try get component from

func NewLabelExp

func NewLabelExp(logger logger.Logger, cli kubernetes.Interface,
	namespace string, cmpName string,
	labels map[string]string, exec nodeexec.Executor) *LabelExp

NewLabelExp create and init a LabelExp Component

func (*LabelExp) Component

func (l *LabelExp) Component() ([]cluster.Component, error)

Component get cluster components

func (*LabelExp) Finish

func (l *LabelExp) Finish() error

Finish will be called once every thing done

type StaticPods

type StaticPods struct {
	ExplorePods func(logger logger.Logger, name string,
		pods []v12.Pod, exec nodeexec.Executor) []cluster.Component
	// contains filtered or unexported fields
}

StaticPods get component information from static pod

func NewStaticPods

func NewStaticPods(logger logger.Logger, cli kubernetes.Interface, namespace string,
	podPrefix string, nodes []string, exe nodeexec.Executor) *StaticPods

NewStaticPods create and int a StaticPods ComponentExecutor

func (*StaticPods) Component

func (s *StaticPods) Component() ([]cluster.Component, error)

Component get cluster components

func (*StaticPods) Finish

func (s *StaticPods) Finish() error

Finish will be called once every thing done

Jump to

Keyboard shortcuts

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