helpers

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: UPL-1.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KnownHostNames = make(map[string]bool)

Functions

func AddCapiToScheme added in v1.6.1

func AddCapiToScheme(scheme *runtime.Scheme)

func CaptureGlobalCapiResources added in v1.6.1

func CaptureGlobalCapiResources(dynamicClient dynamic.Interface, captureDir string, vzHelper VZHelper) error

CaptureGlobalCapiResources captures global resources related to ClusterAPI

func CaptureGlobalRancherResources added in v1.6.2

func CaptureGlobalRancherResources(dynamicClient dynamic.Interface, captureDir string, vzHelper VZHelper) error

CaptureGlobalRancherResources captures global resources related to ClusterAPI

func CaptureK8SResources

func CaptureK8SResources(client clipkg.Client, kubeClient kubernetes.Interface, dynamicClient dynamic.Interface, namespace, captureDir string, vzHelper VZHelper) error

CaptureK8SResources collects the Workloads (Deployment and ReplicaSet, StatefulSet, Daemonset), pods, events, ingress services, and cert-manager certificates from the specified namespace, as JSON files

func CaptureMultiClusterOAMResources added in v1.4.4

func CaptureMultiClusterOAMResources(dynamicClient dynamic.Interface, nsList []string, captureDir string, vzHelper VZHelper) error

CaptureMultiClusterOAMResources captures OAM resources in multi-cluster environment

func CaptureOAMResources

func CaptureOAMResources(dynamicClient dynamic.Interface, nsList []string, captureDir string, vzHelper VZHelper) error

CaptureOAMResources captures OAM resources in the given list of namespaces

func CapturePodLog

func CapturePodLog(kubeClient kubernetes.Interface, pod corev1.Pod, namespace, captureDir string, vzHelper VZHelper, duration int64) error

CapturePodLog captures the log from the pod in the captureDir

func CaptureVZResource

func CaptureVZResource(captureDir string, vz *v1beta1.Verrazzano) error

CaptureVZResource captures Verrazzano resources as a JSON file

func CaptureVerrazzanoManagedCluster added in v1.4.4

func CaptureVerrazzanoManagedCluster(dynamicClient dynamic.Interface, captureDir string, vzHelper VZHelper) error

CaptureVerrazzanoManagedCluster captures VerrazzanoManagedCluster in verrazzano-mc namespace, as a JSON file

func CaptureVerrazzanoProjects added in v1.4.4

func CaptureVerrazzanoProjects(dynamicClient dynamic.Interface, captureDir string, vzHelper VZHelper) error

CaptureVerrazzanoProjects captures the Verrazzano projects in the verrazzano-mc namespace, as a JSON file

func CheckAndRemoveBugReportExistsInDir added in v1.6.0

func CheckAndRemoveBugReportExistsInDir(dir string) bool

CheckAndRemoveBugReportExistsInDir checks vz bug report exists in dir or not

func CreateReportArchive

func CreateReportArchive(captureDir string, bugRepFile *os.File) error

CreateReportArchive creates the .tar.gz file specified by bugReportFile, from the files in captureDir

func DoesNamespaceExist

func DoesNamespaceExist(kubeClient kubernetes.Interface, namespace string, vzHelper VZHelper) (bool, error)

DoesNamespaceExist checks whether the namespace exists in the cluster

func FindVerrazzanoResource

func FindVerrazzanoResource(client client.Client) (*v1beta1.Verrazzano, error)

FindVerrazzanoResource - find the single Verrazzano resource

func GetAppConfigScheme

func GetAppConfigScheme() schema.GroupVersionResource

GetAppConfigScheme returns GroupVersionResource for ApplicationConfiguration

func GetComponentConfigScheme

func GetComponentConfigScheme() schema.GroupVersionResource

GetComponentConfigScheme returns GroupVersionResource for Component

func GetIngressTraitConfigScheme

func GetIngressTraitConfigScheme() schema.GroupVersionResource

GetIngressTraitConfigScheme returns GroupVersionResource for IngressTrait

func GetIsLiveCluster

func GetIsLiveCluster() bool

GetIsLiveCluster returns a boolean indicating whether it is live cluster analysis

func GetLatestReleaseVersion

func GetLatestReleaseVersion(client *http.Client) (string, error)

GetLatestReleaseVersion - get the version of the latest release of Verrazzano

func GetMCAppConfigScheme

func GetMCAppConfigScheme() schema.GroupVersionResource

GetMCAppConfigScheme returns GroupVersionResource for MulticlusterApplicationConfiguration

func GetMCComponentScheme

func GetMCComponentScheme() schema.GroupVersionResource

GetMCComponentScheme returns GroupVersionResource for MulticlusterComponent

func GetManagedClusterConfigScheme

func GetManagedClusterConfigScheme() schema.GroupVersionResource

GetManagedClusterConfigScheme returns GroupVersionResource for VerrazzanoManagedCluster

func GetMetricsTraitConfigScheme

func GetMetricsTraitConfigScheme() schema.GroupVersionResource

GetMetricsTraitConfigScheme returns GroupVersionResource for MetricsTrait

func GetMultiWriterErr

func GetMultiWriterErr() io.Writer

GetMultiWriterErr returns the MultiWriter for standard error

func GetMultiWriterOut

func GetMultiWriterOut() io.Writer

GetMultiWriterOut returns the MultiWriter for standard output

func GetNamespacesForAllComponents

func GetNamespacesForAllComponents(vz *v1beta1.Verrazzano) []string

GetNamespacesForAllComponents returns the list of unique namespaces of all the components included in the Verrazzano resource

func GetOperatorYaml

func GetOperatorYaml(version string) (string, error)

GetOperatorYaml returns Kubernetes manifests to deploy the Verrazzano platform operator The return value is operator.yaml for releases earlier than 1.4.0 and verrazzano-platform-operator.yaml from release 1.4.0 onwards

func GetPodList

func GetPodList(client clipkg.Client, appLabel, appName, namespace string) ([]corev1.Pod, error)

GetPodList returns list of pods matching the label in the given namespace

func GetPodListAll added in v1.4.4

func GetPodListAll(client clipkg.Client, namespace string) ([]corev1.Pod, error)

GetPodListAll returns list of pods in the given namespace Will be used to fetch all pods in additional namespace

func GetScheme added in v1.6.1

func GetScheme() *runtime.Scheme

func GetVZManagedNamespaces

func GetVZManagedNamespaces(kubeClient kubernetes.Interface) []string

GetVZManagedNamespaces returns the namespaces with label verrazzano-managed=true

func GetVerrazzanoResource

func GetVerrazzanoResource(client client.Client, namespacedName types.NamespacedName) (*v1beta1.Verrazzano, error)

GetVerrazzanoResource - get a Verrazzano resource

func GetVersionOut added in v1.6.0

func GetVersionOut() string

GetVersionOut returns the customised k8s and vz version string

func GetVzProjectsConfigScheme

func GetVzProjectsConfigScheme() schema.GroupVersionResource

GetVzProjectsConfigScheme returns GroupVersionResource for VerrazzanoProject

func InitRegexToReplacementMap

func InitRegexToReplacementMap()

InitRegexToReplacementMap Initialize the regex string to replacement string map Append to this map for any future additions

func IsErrorReported

func IsErrorReported() bool

IsErrorReported returns true when the command logs at least one error to the standard error

func LogError

func LogError(msg string)

LogError logs a message to the standard error

func LogMessage

func LogMessage(msg string)

LogMessage logs a message to the standard output

func NewScheme

func NewScheme() *runtime.Scheme

func NewVerrazzanoForGroupVersion

func NewVerrazzanoForGroupVersion(groupVersion schema.GroupVersion) func() interface{}

func NewVerrazzanoForVZVersion

func NewVerrazzanoForVZVersion(version string) (schema.GroupVersion, client.Object, error)

func RemoveDuplicate

func RemoveDuplicate(origSlice []string) []string

RemoveDuplicate removes duplicates from origSlice

func SanitizeString

func SanitizeString(l string) string

SanitizeString sanitizes each line in a given file, Sanitizes based on the regex map initialized above, which is currently filtering for IPv4 addresses and hostnames

func SetIsLiveCluster

func SetIsLiveCluster()

SetIsLiveCluster sets true to isLiveCluster, indicating the live cluster analysis usage

func SetK8sVer added in v1.6.0

func SetK8sVer() error

SetK8sVer returns cluster Kubernetes version

func SetMultiWriterErr

func SetMultiWriterErr(errStream io.Writer, errFile *os.File)

SetMultiWriterErr sets MultiWriter for standard error

func SetMultiWriterOut

func SetMultiWriterOut(outStream io.Writer, outFile *os.File)

SetMultiWriterOut sets MultiWriter for standard output

func SetVerboseOutput

func SetVerboseOutput(enableVerbose bool)

SetVerboseOutput sets the verbose output for the commands bug-report and analyze

func SetVzVer added in v1.6.0

func SetVzVer(client *client.Client) error

SetVzVer set verrazzano version

func UpdateVerrazzanoResource

func UpdateVerrazzanoResource(client client.Client, vz *v1beta1.Verrazzano) error

func VerifyVzInstallNamespaceExists added in v1.6.0

func VerifyVzInstallNamespaceExists(kubeClient kubernetes.Interface) bool

VerifyVzInstallNamespaceExists returns existence of verrazzano-install namespace

Types

type CaCrtInfo added in v1.7.0

type CaCrtInfo struct {
	Name    string `json:"name"`
	Expired bool   `json:"expired"`
}

type ClusterSnapshotCtx added in v1.6.0

type ClusterSnapshotCtx struct {
	BugReportDir         string
	MoreNS               []string
	PrintReportToConsole bool
}

type ReportCtx added in v1.6.0

type ReportCtx struct {
	ReportFile           string
	ReportFormat         string
	IncludeSupportData   bool
	IncludeInfo          bool
	IncludeActions       bool
	MinConfidence        int
	MinImpact            int
	PrintReportToConsole bool
}

type VZHelper

type VZHelper interface {
	GetOutputStream() io.Writer
	GetErrorStream() io.Writer
	GetInputStream() io.Reader
	GetClient(cmd *cobra.Command) (client.Client, error)
	GetKubeClient(cmd *cobra.Command) (kubernetes.Interface, error)
	GetHTTPClient() *http.Client
	GetDynamicClient(cmd *cobra.Command) (dynamic.Interface, error)
	GetDiscoveryClient(cmd *cobra.Command) (discovery.DiscoveryInterface, error)
	VerifyCLIArgsNil(cmd *cobra.Command) error
}

Jump to

Keyboard shortcuts

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