portworx

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Copyright © 2019 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.

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.

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.

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.

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

View Source
const (
	PXReplCurrSetMid         = "ReplicaSetCurrMid"
	PXReplSetCreateMid       = "ReplicaSetCreateMid"
	PXReplNewNodeMid         = "ReplNewNodeMid"
	PXReplReAddPools         = "PXReplReAddPools"
	PXReplReAddNodeMid       = "PXReplReAddNodeMid"
	PXReplReAddUsedSize      = "PXReplReAddUsedSize"
	PXReplNodePools          = "ReplNodePools"
	PXReplNewNodePools       = "ReplNewNodePools"
	PXReplRemoveMids         = "ReplRemoveMids"
	PXReplRuntimeState       = "RuntimeState"
	RuntimeStateResync       = "resync"
	RuntimeStateResyncFailed = "resync_failed"
)

Variables

View Source
var RoleGuestDisabled = api.SdkRole{
	Name: "system.guest",
	Rules: []*api.SdkRule{
		{
			Services: []string{"!*"},
			Apis:     []string{"!*"},
		},
	},
}

RoleGuestDisabled indicates that the system.guest is disabled

View Source
var RoleGuestEnabled = api.SdkRole{
	Name: "system.guest",
	Rules: []*api.SdkRule{
		{
			Services: []string{"mountattach", "volume", "cloudbackup", "migrate"},
			Apis:     []string{"*"},
		},
		{
			Services: []string{"identity"},
			Apis:     []string{"version"},
		},
		{
			Services: []string{
				"cluster",
				"node",
			},
			Apis: []string{
				"inspect*",
				"enumerate*",
			},
		},
	},
}

RoleGuestEnabled indicates that the system.guest is enabled

Functions

func BooleanAttributes added in v0.21.3

func BooleanAttributes(v *api.Volume) []string

BoolenaAttributes returns the string representations of all of the boolian attribute flags

func GetResourceTypeString added in v0.22.0

func GetResourceTypeString(resourceType api.ResourceType) string

func GetStorageNodeKernelVersion added in v0.28.0

func GetStorageNodeKernelVersion(n *api.StorageNode) string

GetStorageNodeKernelVersion returns the kernel version of the node

func GetStorageNodeOS added in v0.28.0

func GetStorageNodeOS(n *api.StorageNode) string

GetStorageNodeOS returns the operating system of a node

func GetStorageNodeVersion added in v0.28.0

func GetStorageNodeVersion(n *api.StorageNode) string

GetStorageNodeVersion returns the version of a node

func GetTotalCapacity added in v0.28.0

func GetTotalCapacity(n *api.StorageNode) (used, capacity uint64)

GetTotalCapacity returns the used and total capacity of the storage node

func GetTotalCapacityGi added in v0.28.0

func GetTotalCapacityGi(n *api.StorageNode) (used, capacity uint64)

GetTotalCapacityGi returns the used and total capacity in Gigabytes

func PrettyStatus added in v0.21.3

func PrettyStatus(v *api.Volume) string

PrettyStatus trims out the VOLUME_STATUS_ prefix

func PxAppendCaCertcontext added in v0.21.4

func PxAppendCaCertcontext(clusterInfo *config.Cluster) ([]grpc.DialOption, error)

PxAppendCaCertcontext appends the provided valid CA from the user to the existing systemPool or load the default CA certs used for authentication with the sdk server.

func PxConnectDefault added in v0.21.4

func PxConnectDefault() (context.Context, *grpc.ClientConn, error)

PxConnectDefault returns a Portworx client to the default or named context

func PxGetTokenFromSecret added in v0.23.0

func PxGetTokenFromSecret(secretName, secretNamespace string) (string, error)

func SchedSummary added in v0.21.3

func SchedSummary(v *api.Volume) ([]string, error)

SchedSummary returns the formatted string version of the schedule

func SeverityString added in v0.22.0

func SeverityString(severity api.SeverityType) string

func SharedString added in v0.21.3

func SharedString(v *api.Volume) string

SharedString returns the string representation of the shared flag of a volume

func TrueOrFalse added in v0.21.4

func TrueOrFalse(b bool) string

TrueOrFalse returns the string representation of bool

func TypeToSpec added in v0.22.0

func TypeToSpec() map[AlertType]AlertSpec

TypeToSpec fetches info about an alert. In PX a specific alert is always linked with its corresponding resource type, while, from OSD perspective, an alert type and resource type are two separate entities.

func ValidateVolumeSpec added in v0.21.3

func ValidateVolumeSpec(volspec *api.VolumeSpecUpdate) error

ValidateVolumeSpec checks if a volume spec if valid. Currently due to volume driver limitation, only few combination of fields can be set as paramaters in VolumeSpecUpdate. This function will check for the same.

Types

type AlertResp added in v0.22.0

type AlertResp struct {
	AlertResp     []*api.Alert
	AlertNameToId map[string]int64
	AlertIdToName map[int64]string
}

type AlertSpec added in v0.22.0

type AlertSpec struct {
	Severity     api.SeverityType
	ResourceType api.ResourceType
	Description  string
	Name         string
	Uniq         bool
}

type AlertType added in v0.22.0

type AlertType int64
const (
	DriveOperationFailure         AlertType = 0
	DriveOperationSuccess         AlertType = 1
	DriveStateChange              AlertType = 2
	VolumeOperationFailureAlarm   AlertType = 3
	VolumeOperationSuccess        AlertType = 4
	VolumeStateChange             AlertType = 5
	VolGroupOperationFailure      AlertType = 6
	VolGroupOperationSuccess      AlertType = 7
	VolGroupStateChange           AlertType = 8
	NodeStartFailure              AlertType = 9
	NodeStartSuccess              AlertType = 10
	NodeStateChange               AlertType = 11
	NodeJournalHighUsage          AlertType = 12
	IOOperation                   AlertType = 13
	ContainerOperationFailure     AlertType = 14
	ContainerOperationSuccess     AlertType = 15
	ContainerStateChange          AlertType = 16
	PXInitFailure                 AlertType = 17
	PXInitSuccess                 AlertType = 18
	PXStateChange                 AlertType = 19
	VolumeOperationFailureWarn    AlertType = 20
	StorageVolumeMountDegraded    AlertType = 21
	ClusterManagerFailure         AlertType = 22
	KernelDriverFailure           AlertType = 23
	NodeDecommissionSuccess       AlertType = 24
	NodeDecommissionFailure       AlertType = 25
	NodeDecommissionPending       AlertType = 26
	NodeInitFailure               AlertType = 27
	PXAlertMax                    AlertType = 28
	NodeScanCompletion            AlertType = 29
	VolumeSpaceLow                AlertType = 30
	ReplAddVersionMismatch        AlertType = 31
	CloudsnapScheduleFailure      AlertType = 32
	CloudsnapOperationUpdate      AlertType = 33
	CloudsnapOperationFailure     AlertType = 34
	CloudsnapOperationSuccess     AlertType = 35
	NodeMarkedDown                AlertType = 36
	VolumeCreateSuccess           AlertType = 37
	VolumeCreateFailure           AlertType = 38
	VolumeDeleteSuccess           AlertType = 39
	VolumeDeleteFailure           AlertType = 40
	VolumeMountSuccess            AlertType = 41
	VolumeMountFailure            AlertType = 42
	VolumeUnmountSuccess          AlertType = 43
	VolumeUnmountFailure          AlertType = 44
	VolumeHAUpdateSuccess         AlertType = 45
	VolumeHAUpdateFailure         AlertType = 46
	SnapshotCreateSuccess         AlertType = 47
	SnapshotCreateFailure         AlertType = 48
	SnapshotRestoreSuccess        AlertType = 49
	SnapshotRestoreFailure        AlertType = 50
	SnapshotIntervalUpdateFailure AlertType = 51
	SnapshotIntervalUpdateSuccess AlertType = 52
	PXReady                       AlertType = 53
	StorageFailure                AlertType = 54
	ObjectstoreFailure            AlertType = 55
	ObjectstoreSuccess            AlertType = 56
	ObjectstoreStateChange        AlertType = 57
	LicenseExpiring               AlertType = 58
	VolumeExtentDiffSlow          AlertType = 59
	VolumeExtentDiffOk            AlertType = 60
	SharedV4SetupFailure          AlertType = 61
	SnapshotDeleteSuccess         AlertType = 62
	SnapshotDeleteFailure         AlertType = 63
	DriveStateChangeClear         AlertType = 64
	VolumeSpaceLowCleared         AlertType = 65
	ClusterPairSuccess            AlertType = 66
	ClusterPairFailure            AlertType = 67
	CloudMigrationUpdate          AlertType = 68
	CloudMigrationSuccess         AlertType = 69
	CloudMigrationFailure         AlertType = 70
	ClusterDomainAdded            AlertType = 71
	ClusterDomainRemoved          AlertType = 72
	ClusterDomainActivated        AlertType = 73
	ClusterDomainDeactivated      AlertType = 74
	MeteringAgentWarning          AlertType = 75
	MeteringAgentCritical         AlertType = 76
	// **********************************
	// Add new alerts before the MaxAlert
	// **********************************
	PXMaxAlertNum AlertType = 77 // --- ADD NEW ALERT ABOVE THIS LINE --
)

type AuthOps added in v0.31.1

type AuthOps interface {
	UpdateRole(r *api.SdkRole) error
	GetRole(name string) (*api.SdkRole, error)
}

AuthOps represents all auth related commands

func NewAuthOps added in v0.31.1

func NewAuthOps() AuthOps

NewAuthOps creates a new auth ops

type CliAlertInputs added in v0.22.0

type CliAlertInputs struct {
	util.BaseFormatOutput
	Wide       bool
	AlertType  string
	AlertId    string
	StartTime  string
	EndTime    string
	Severity   string
	ResourceId string
}

type CliAuthInputs added in v0.31.1

type CliAuthInputs struct {
	util.BaseFormatOutput
	Wide bool
}

CliAuthInputs represents input for auth commands

type NodeSpec added in v0.22.0

type NodeSpec struct {
	NodeNames []string
}

func GetNodeSpec added in v0.22.0

func GetNodeSpec(
	vols []*api.Volume,
) *NodeSpec

This basically looks at the current runtime state of the volume and picks out all of the nodes referenced

type Nodes added in v0.22.0

type Nodes interface {
	Objs
	// Gets the nodes details for the named nodes
	GetNodes() ([]*api.StorageNode, error)
	// Gets a specific node
	GetNode(id string) (*api.StorageNode, error)
	// Get the node that volume is attached on
	GetAttachedOn(v *api.Volume) (*api.StorageNode, error)
	// Gets the state of the volume the node is attached on
	GetAttachedState(v *api.Volume) (string, error)
	// GetReplicationInfo returns the details of the replicas of the specified volume
	GetReplicationInfo(v *api.Volume) (*ReplicationInfo, error)
}

func NewNodes added in v0.22.0

func NewNodes(pxops PxOps, nodeSpec *NodeSpec) Nodes

func NewNodesForPxPvcs added in v0.22.0

func NewNodesForPxPvcs(pxops PxOps, pxpvcs []*kubernetes.PxPvc) (Nodes, error)

func NewNodesForVolumes added in v0.22.0

func NewNodesForVolumes(pxops PxOps, vols []*api.Volume) (Nodes, error)

type Objs added in v0.22.0

type Objs interface {
	Reset()
}

type PodSpec added in v0.22.0

type PodSpec struct {
	Namespace string
	Labels    map[string]string
}

type Pods added in v0.22.0

type Pods interface {
	Objs
	// Get all pods for the namespace and labels specified
	GetPods() ([]v1.Pod, error)
	// PodsUsingVolume returns the list of pods using the given volume
	// The search is done on the array of pods given
	PodsUsingVolume(v *api.Volume) ([]v1.Pod, error)
	// GetContainerInfoForVolume will return the container info for pods using the volume
	GetContainerInfoForVolume(v *api.Volume) ([]kubernetes.ContainerInfo, error)
}

func NewPods added in v0.22.0

func NewPods(cops kubernetes.COps, podSpec *PodSpec) Pods

type PvcSpec added in v0.22.0

type PvcSpec struct {
	Namespace string
	Labels    map[string]string
}

type Pvcs added in v0.22.0

type Pvcs interface {
	Objs
	// GetPvcs returns the Pvcs as per the spec provided
	GetPvcs() ([]v1.PersistentVolumeClaim, error)
	// GetPxPvcs returns the list of PxPvcs
	GetPxPvcs() ([]*kubernetes.PxPvc, error)
}

func NewPvcs added in v0.22.0

func NewPvcs(pxops PxOps, cops kubernetes.COps, pvcSpec *PvcSpec) Pvcs

type PxAlertOps added in v0.22.0

type PxAlertOps interface {
	GetPxAlerts(cliAlertInputs CliAlertInputs) (AlertResp, error)
	DeletePxAlerts(alert string) error
}

func NewPxAlertOps added in v0.22.0

func NewPxAlertOps() PxAlertOps

type PxOps added in v0.22.0

type PxOps interface {
	// Close the connection to Portworx
	Close()
	// GetVolumesByLabel returns volumes filtered by specified labels
	GetVolumesBySpec(vs *VolumeSpec) ([]*api.SdkVolumeInspectResponse, error)
	// Gets details of the specified volume
	GetVolumeById(id string) (*api.SdkVolumeInspectResponse, error)
	// GetStats returns the stats for the specified volume
	GetStats(v *api.Volume, notCumulative bool) (*api.Stats, error)
	// EnumerateNodes returns list of nodes  ids
	EnumerateNodes() ([]string, error)
	// GetNode returns details of given node
	GetNode(id string) (*api.StorageNode, error)
	// GetCtx returns the context
	GetCtx() context.Context
	// GetConn returns the grpc client connection
	GetConn() *grpc.ClientConn
}

func NewPxOps added in v0.22.0

func NewPxOps() (PxOps, error)

type ReplicationInfo added in v0.21.3

type ReplicationInfo struct {
	Rsi    []*ReplicationSetInfo
	Status string
}

type ReplicationSetInfo added in v0.21.3

type ReplicationSetInfo struct {
	Id         int
	NodeInfo   []string
	HaIncrease string
	ReAddOn    []string
}

type VolumeSpec added in v0.22.0

type VolumeSpec struct {
	VolNames []string
	Labels   map[string]string
}

type Volumes added in v0.22.0

type Volumes interface {
	Objs
	// GetVolumes returns the array of volume objects
	// filtered by the list of volume names specified
	GetVolumes() ([]*api.Volume, error)
	// GetStats returns the stats for the specified volume
	GetStats(v *api.Volume, notCumulative bool) (*api.Stats, error)
}

func NewVolumes added in v0.22.0

func NewVolumes(pxops PxOps, volSpec *VolumeSpec) Volumes

Jump to

Keyboard shortcuts

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