component

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2022 License: Apache-2.0 Imports: 10 Imported by: 8

README

Build Status

Example pxc component

A pxc component is a plugin for pxc which utilizes the pxc libraries to connect to Portworx or Kubernetes.

Usage

Installation

  1. Type: make clean all
  2. Install pxc-cm either in your path or in $HOME/.pxc/bin

Usage

Now you can use it as a kubectl-pxc plugin as follows:

$ export KUBECONFIG=k8s1.conf:k8s2.conf

$ kubectl pxc cm show --context=k8s2-admin@k8s2
Cluster ID: px-cluster-ad340bb9-be1e-4acc-94e6-c2eff0f7a47f
Cluster UUID: 142d6f2d-0f43-400c-8b23-f14294907bd3
Cluster Status: Ready
Version: 2.3.2.0-c6ebdd7
 build: c6ebdd7ab5801b2d0086179610e5848236e1b95c
SDK Version 0.42.22

$ kubectl pxc cm show
Cluster ID: px-cluster-43e75a0d-39d5-4904-ae11-b6f00c51f261
Cluster UUID: f7076dba-b700-472f-945e-9c6b310de76b
Cluster Status: Ready
Version: 2.2.0.4-c964260
 build: c9642608c55c9a5dc109296822126afc35a0eb9e
SDK Version 0.42.17

$ kubectl pxc cm show -o json

As you can see above, the component cm (cluster manager) uses the pxc libraries to automatically connect to the appropriate Portworx system according to the context in kubeconfig.

Documentation

Overview

Copyright © 2020 Portworx

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

http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Initialization and startup files

main.go: Called from main.go in the root of the source tree. It handles the
  initialization of the program.
root.go: Root cobra object, which is the program itself. All main commands
  in the handler directory register with this object.
gendoc.go: Adds a hidden command to generate markdown files
version.go: Adds a version command to the program

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

http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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

http://www.apache.org/licenses/LICENSE-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 OR CONDITIONS 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 (

	// Component information
	ComponentName    string
	ComponentVersion string
)

Functions

func GenDocAddCommand

func GenDocAddCommand(cmd *cobra.Command)

func RootAddCommand

func RootAddCommand(c *cobra.Command)

RootAddCommand is called by handlers to add the top level options to the program

func VersionAddCommand

func VersionAddCommand(cmd *cobra.Command)

Types

type Component

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

Component is the object managing the component

func NewComponent

func NewComponent(config *ComponentConfig) *Component

NewComponent creates a new component. Once created use Execute() to start the component

func (*Component) Execute

func (c *Component) Execute()

Execute starts the component

type ComponentConfig

type ComponentConfig struct {
	// Name of the component as it appears in the Usage of the help screen
	Name string

	// Version of the component
	Version string

	// Short description of the component
	Short string

	// If any flags need to be added to root of the component add them here
	RootFlags func(*cobra.Command)
}

ComponentConfig provides the information necessary to create a component

Jump to

Keyboard shortcuts

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