cmd

package
v0.0.0-...-58f6e79 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: Apache-2.0 Imports: 53 Imported by: 14

Documentation

Index

Constants

View Source
const (
	PreferredNamespace = tridentconfig.OrchestratorName

	// CRD names
	ActionMirrorUpdateCRDName    = "tridentactionmirrorupdates.trident.netapp.io"
	ActionSnapshotRestoreCRDName = "tridentactionsnapshotrestores.trident.netapp.io"
	BackendConfigCRDName         = "tridentbackendconfigs.trident.netapp.io"
	BackendCRDName               = "tridentbackends.trident.netapp.io"
	MirrorRelationshipCRDName    = "tridentmirrorrelationships.trident.netapp.io"
	NodeCRDName                  = "tridentnodes.trident.netapp.io"
	SnapshotCRDName              = "tridentsnapshots.trident.netapp.io"
	SnapshotInfoCRDName          = "tridentsnapshotinfos.trident.netapp.io"
	StorageClassCRDName          = "tridentstorageclasses.trident.netapp.io"
	TransactionCRDName           = "tridenttransactions.trident.netapp.io"
	VersionCRDName               = "tridentversions.trident.netapp.io"
	VolumeCRDName                = "tridentvolumes.trident.netapp.io"
	VolumePublicationCRDName     = "tridentvolumepublications.trident.netapp.io"
	VolumeReferenceCRDName       = "tridentvolumereferences.trident.netapp.io"
	ConfiguratorCRDName          = "tridentconfigurators.trident.netapp.io"

	ControllerRoleFilename               = "trident-controller-role.yaml"
	ControllerClusterRoleFilename        = "trident-controller-clusterrole.yaml"
	ControllerRoleBindingFilename        = "trident-controller-rolebinding.yaml"
	ControllerServiceAccountFilename     = "trident-controller-serviceaccount.yaml"
	ControllerClusterRoleBindingFilename = "trident-controller-clusterrolebinding.yaml"
	ControllerSCCFilename                = "trident-controller-scc.yaml"

	NodeLinuxRoleFilename           = "trident-node-linux-role.yaml"
	NodeLinuxRoleBindingFilename    = "trident-node-linux-rolebinding.yaml"
	NodeLinuxServiceAccountFilename = "trident-node-linux-serviceaccount.yaml"
	NodeLinuxSCCFilename            = "trident-node-linux-scc.yaml"

	NodeWindowsRoleFilename           = "trident-node-windows-role.yaml"
	NodeWindowsRoleBindingFilename    = "trident-node-windows-rolebinding.yaml"
	NodeWindowsServiceAccountFilename = "trident-node-windows-serviceaccount.yaml"
	NodeWindowsSCCFilename            = "trident-node-windows-scc.yaml"

	CRDsFilename             = "trident-crds.yaml"
	DaemonSetFilename        = "trident-daemonset.yaml"
	WindowsDaemonSetFilename = "trident-windows-daemonset.yaml"
	DeploymentFilename       = "trident-deployment.yaml"
	NamespaceFilename        = "trident-namespace.yaml"
	ServiceFilename          = "trident-service.yaml"
	ResourceQuotaFilename    = "trident-resourcequota.yaml"

	TridentEncryptionKeys = "trident-encryption-keys"

	TridentCSI           = "trident-csi"
	TridentMainContainer = "trident-main"

	TridentControllerResourceName  = "trident-controller"
	TridentNodeLinuxResourceName   = "trident-node-linux"
	TridentNodeWindowsResourceName = "trident-node-windows"

	CSIDriver = "csi.trident.netapp.io"
)
View Source
const (
	FormatJSON     = "json"
	FormatName     = "name"
	FormatWide     = "wide"
	FormatYAML     = "yaml"
	FormatMarkdown = "markdown"

	ModeDirect  = "direct"
	ModeTunnel  = "tunnel"
	ModeInstall = "install"

	CLIKubernetes = "kubectl"
	CLIOpenshift  = "oc"

	PodServer               = "127.0.0.1:8000"
	PodAutosupportCollector = "127.0.0.1:8003"

	ExitCodeSuccess = 0
	ExitCodeFailure = 1

	TridentCSILabelKey   = "app"
	TridentCSILabelValue = "controller.csi.trident.netapp.io"
	TridentCSILabel      = TridentCSILabelKey + "=" + TridentCSILabelValue

	TridentNodeLabelKey   = "app"
	TridentNodeLabelValue = "node.csi.trident.netapp.io"
	TridentNodeLabel      = TridentNodeLabelKey + "=" + TridentNodeLabelValue

	TridentInstallerLabelKey   = "app"
	TridentInstallerLabelValue = "trident-installer.netapp.io"
	TridentInstallerLabel      = TridentInstallerLabelKey + "=" + TridentInstallerLabelValue

	TridentMigratorLabelKey   = "app"
	TridentMigratorLabelValue = "trident-migrator.netapp.io"
	TridentMigratorLabel      = TridentMigratorLabelKey + "=" + TridentMigratorLabelValue

	TridentPersistentObjectLabelKey   = "object"
	TridentPersistentObjectLabelValue = "persistent.trident.netapp.io"
	TridentPersistentObjectLabel      = TridentPersistentObjectLabelKey + "=" + TridentPersistentObjectLabelValue

	TridentOperatorLabelKey   = "app"
	TridentOperatorLabelValue = "operator.trident.netapp.io"
	TridentOperatorLabel      = TridentOperatorLabelKey + "=" + TridentOperatorLabelValue

	AutosupportCollectorURL = "/autosupport/v1"
)
View Source
const (
	RequestTimeout = 5 * time.Second
)

Variables

View Source
var (
	OperatingMode       string
	KubernetesCLI       string
	TridentPodName      string
	TridentPodNamespace string
	KubeConfigPath      string
	ExitCode            int

	Debug bool

	LogLevel             string
	Server               string
	AutosupportCollector string
	OutputFormat         string
)
View Source
var (
	K8sVersion string
)
View Source
var RootCmd = &cobra.Command{
	SilenceUsage: true,
	Use:          "tridentctl",
	Short:        "A CLI tool for NetApp Trident",
	Long:         `A CLI tool for managing the NetApp Trident external storage provisioner for Kubernetes`,
}

Functions

func BaseAutosupportURL

func BaseAutosupportURL() string

func BaseURL

func BaseURL() string

func CreateOpenShiftTridentSCC

func CreateOpenShiftTridentSCC(user, appLabelVal string) error

CreateOpenShiftTridentSCC creates an SCC solely for use with the trident user. This only works for OpenShift.

func DeleteOpenShiftTridentSCC

func DeleteOpenShiftTridentSCC(user, labelVal string) error

DeleteOpenShiftTridentSCC deletes the trident-only SCC that the trident user uses. This only works for OpenShift.

func GenPatchedBashCompletionScript

func GenPatchedBashCompletionScript(cmd *cobra.Command, cobraPoweredPlugins []string, originalScript string) string

func GenPatchedZshCompletionScript

func GenPatchedZshCompletionScript(cmd *cobra.Command, cobraPoweredPlugins []string, originalScript string) string

func GetBackend

func GetBackend(backendName string) (storage.BackendExternal, error)

func GetBackendByBackendUUID

func GetBackendByBackendUUID(backendUUID string) (storage.BackendExternal, error)

func GetBackends

func GetBackends() ([]string, error)

func GetCobraPoweredPlugins

func GetCobraPoweredPlugins() []string

GetCobraPoweredPlugins collect cobra-powered plugins to check if the plugin is a cobra plugin we run the plugin with argument "__complete -- @@@@" and compare the output with the cobraOutputSuffix string

func GetErrorFromHTTPResponse

func GetErrorFromHTTPResponse(response *http.Response, responseBody []byte) error

func GetExitCodeFromError

func GetExitCodeFromError(err error) int

func GetNode

func GetNode(nodeName string) (*models.NodeExternal, error)

func GetNodes

func GetNodes() ([]string, error)

func GetSnapshot

func GetSnapshot(snapshotID string) (storage.SnapshotExternal, error)

func GetSnapshots

func GetSnapshots(volume string) ([]string, error)

func GetStorageClass

func GetStorageClass(storageClassName string) (api.StorageClass, error)

func GetStorageClasses

func GetStorageClasses() ([]string, error)

func GetVolume

func GetVolume(volumeName string) (storage.VolumeExternal, error)

func GetVolumePublication

func GetVolumePublication(volumeName, nodeName string) (*models.VolumePublicationExternal, error)

func GetVolumes

func GetVolumes() ([]string, error)

func ObliviateCRDs

func ObliviateCRDs(
	kubeClientVal k8sclient.KubernetesClient, crdClientsetVal crdclient.Interface, timeout time.Duration,
) error

func SetExitCodeFromError

func SetExitCodeFromError(err error)

func TunnelCommand

func TunnelCommand(commandArgs []string) ([]byte, error)

func TunnelCommandRaw

func TunnelCommandRaw(commandArgs []string) ([]byte, []byte, error)

func WriteBackends

func WriteBackends(backends []storage.BackendExternal)

func WriteJSON

func WriteJSON(out interface{})

func WriteNodes

func WriteNodes(nodes []models.NodeExternal)

func WriteSnapshots

func WriteSnapshots(snapshots []storage.SnapshotExternal)

func WriteStorageClasses

func WriteStorageClasses(storageClasses []api.StorageClass)

func WriteVolumePublications

func WriteVolumePublications(pubs []models.VolumePublicationExternal)

func WriteVolumes

func WriteVolumes(volumes []storage.VolumeExternal)

func WriteYAML

func WriteYAML(out interface{})

Types

type ImageList

type ImageList struct {
	ImageSets []ImageSet `json:"imageSets"`
}

type ImageSet

type ImageSet struct {
	Images     []string `json:"images"`
	K8sVersion string   `json:"k8sVersion"`
}

Jump to

Keyboard shortcuts

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