cli

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package cli describes the operating environment for the FSM cli and includes convenience functions for the FSM cli.

Copyright The Helm Authors.

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 MIT License 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.

This package is heavily inspired by how the Helm project handles environment variables: https://github.com/helm/helm/blob/master/pkg/cli/environment.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoesTargetRefDstPod

func DoesTargetRefDstPod(spec v1alpha3.TrafficTargetSpec, dstPod *corev1.Pod) bool

DoesTargetRefDstPod checks whether the TrafficTarget spec refers to the destination pod's service account

func DoesTargetRefSrcPod

func DoesTargetRefSrcPod(spec v1alpha3.TrafficTargetSpec, srcPod *corev1.Pod) bool

DoesTargetRefSrcPod checks whether the TrafficTarget spec refers to the source pod's service account

func GetChartSource

func GetChartSource(path string) ([]byte, error)

GetChartSource is a helper to convert a filepath to a chart to a base64-encoded, gzipped tarball.

func GetSidecarProxyConfig

func GetSidecarProxyConfig(clientSet kubernetes.Interface, config *rest.Config, namespace string, podName string, localPort uint16, query string) ([]byte, error)

GetSidecarProxyConfig returns the sidecar proxy config of a pod

Types

type EnvConfig

type EnvConfig struct {
	Install EnvConfigInstall `yaml:"install"`
}

EnvConfig represents the environment configuration of FSM

type EnvConfigInstall

type EnvConfigInstall struct {
	Kind         string `yaml:"kind"`
	Distribution string `yaml:"distribution"`
	Namespace    string `yaml:"namespace"`
}

EnvConfigInstall represents the environment configuration of FSM install

type EnvSettings

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

EnvSettings describes all of the cli environment settings

func New

func New() *EnvSettings

New relevant environment variables set and returns EnvSettings

func (*EnvSettings) AddFlags

func (s *EnvSettings) AddFlags(fs *pflag.FlagSet)

AddFlags binds flags to the given flagset.

func (*EnvSettings) Config

func (s *EnvSettings) Config() EnvConfig

Config returns the environment config

func (*EnvSettings) IsManaged

func (s *EnvSettings) IsManaged() bool

IsManaged returns true in a managed FSM environment (ex. managed by a cloud distributor)

func (*EnvSettings) Namespace

func (s *EnvSettings) Namespace() string

Namespace gets the namespace from the configuration

func (*EnvSettings) RESTClientGetter

func (s *EnvSettings) RESTClientGetter() genericclioptions.RESTClientGetter

RESTClientGetter gets the kubeconfig from EnvSettings

func (*EnvSettings) Verbose

func (s *EnvSettings) Verbose() bool

Verbose gets whether verbose output is enabled from the configuration

type Spinner

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

Spinner indicator to fsm install

func (*Spinner) Init

func (s *Spinner) Init(clientSet kubernetes.Interface, fsmNamespace string, vals map[string]interface{})

Init instance of Spinner with the supplied options

func (*Spinner) Run

func (s *Spinner) Run(job func() error) error

Run starts spinner indicator

Jump to

Keyboard shortcuts

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