util

package
v0.0.0-...-9d56dfa Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// number of CPUs
	MinCPUs = 2
	// RAM in GiBs
	MinMem = 12
	// Measure of a GiB in terms of bytes
	GB = 1024 * 1024
	// Disk size in GiBs
	MinDisk = 30
	// Disk size in GiBs
	MinAvailDisk = 15
	// Counter variable max value
	MaxLoopValue = 3
	//Attach Status Loop variable
	MaxRetryValue = 18

	CheckPass       = "PASS"
	CheckFail       = "FAIL"
	Invalid         = "Invalid"
	Valid           = "Valid"
	InvalidPassword = "Sorry, try again."

	PmkVersion = "1.20.11"
	Docker     = "docker"
	Calico     = "calico"
)
View Source
const (
	Version         string = "pf9ctl version: v1.27"
	AWSBucketName   string = "pmkft-assets"
	AWSBucketKey    string = "pf9ctl"
	AWSBucketRegion string = "us-west-1"
	BucketPath      string = "https://" + AWSBucketName + ".s3." + AWSBucketRegion + ".amazonaws.com/" + AWSBucketKey + "_setup"
)

These are the constants needed for everything version related

Variables

View Source
var (
	// Constants for check failure messages
	PyCliErr                = "Earlier version of pf9ctl already exists. This must be uninstalled."
	ExisitngInstallationErr = "Platform9 packages already exist. These must be uninstalled."
	SudoErr                 = "User running pf9ctl must have privilege (sudo) mode enabled."
	OSPackagesErr           = "Some OS packages needed for the CLI not found"
	CPUErr                  = "At least 2 CPUs are needed on host."
	DiskErr                 = "At least 30 GB of total disk space and 15 GB of free space is needed on host."
	MemErr                  = "At least 12 GB of memory is needed on host."
)
View Source
var (
	HomeDir, _ = os.UserHomeDir()
	// PyCliPath is the path of virtual env directory of the Python CLI
	PyCliPath = filepath.Join(HomeDir, "pf9/pf9-venv")
	// PyCliLink is the Symlink of the Python CLI
	PyCliLink      = "/usr/bin/pf9ctl"
	Centos         = "centos"
	Redhat         = "red hat"
	Ubuntu         = "ubuntu"
	Rocky          = "rocky"
	CertsExpireErr = "certificate has expired or is not yet valid"

	//Pf9Dir is the base pf9dir
	Pf9Dir = filepath.Join(HomeDir, "pf9")
	//Pf9LogDir is the base path for creating log dir
	Pf9LogDir = filepath.Join(Pf9Dir, "log")
	// Pf9DBDir is the base dir for storing pf9 db config
	Pf9DBDir = filepath.Join(Pf9Dir, "db")
	// Pf9DBLoc represents location of the config file.
	Pf9DBLoc = filepath.Join(Pf9DBDir, "config.json")
	// Pf9Log represents location of the log.
	Pf9Log = filepath.Join(Pf9LogDir, "pf9ctl.log")
	// WaitPeriod is the sleep period for the cli
	// before it starts with the operations.
	WaitPeriod = time.Duration(60)

	OptDir = "/var/opt/pf9"

	//Location of ovf service file
	OVFLoc           = "/etc/systemd/system/ovf.service"
	VarDir           = "/var/log/pf9"
	EtcDir           = "/etc/pf9"
	DefaultPf9LogLoc = "pf9/log"
	Pf9LogLoc        string
	Pf9DirLoc        = filepath.Join(HomeDir, "/")

	//Auth,Dmesg,dpkg/yum files for Debian/Redhat
	DmesgLog = "/var/log/dmesg"
	MsgDeb   = "/var/log/syslog"
	LockDeb  = "/var/log/dpkg.log"
	MsgRed   = "/var/log/messages"
	LockRed  = "/var/log/yum.log"

	Confidential = []string{"--password", "--user-token"}
)
View Source
var AutoScalingPermissions []string
View Source
var AzureContributorID string
View Source
var CheckIfOnboarded bool
View Source
var EBSPermissions []string
View Source
var EC2Permission []string
View Source
var EKSPermissions []string
View Source
var Files []string
View Source
var GoogleCloudPermissions []string
View Source
var HostDown bool
View Source
var IAMPermissions []string
View Source
var InstallerErrors = make(map[int]string)
View Source
var KubeVersion string = ""

KubeVersion allows specifying a role version when running prep-node command

View Source
var LogFileNamePath string
View Source
var Pf9Packages []string
View Source
var PortErr string
View Source
var ProcessesList []string // Kubernetes clusters processes list
View Source
var RequiredPorts []string
View Source
var Route53Permissions []string
View Source
var SkipKube bool

SkipKube skips authorizing kube role during prep-node. Not applicable to bootstrap command

View Source
var SkipPrepNode bool
View Source
var SwapOffDisabled bool // If this is true the swapOff functionality will be disabled.
View Source
var VPCPermission []string

Functions

func AskBool

func AskBool(msg string, args ...interface{}) (bool, error)

AskBool function asks for the user input for a boolean input

func Intersect

func Intersect(a []string, b []string) []string

Intersect returns a list of common items between two lists

func RetryPolicyOn404

func RetryPolicyOn404(ctx context.Context, resp *http.Response, err error) (bool, error)

RetryPolicyOn404 is similar to the defaulRetryPolicy but which an additional check for 404 status.

Types

type ZapWrapper

type ZapWrapper struct {
}

Logger interface allows to use other loggers than standard log.Logger.

func (*ZapWrapper) Debug

func (z *ZapWrapper) Debug(msg string, args ...interface{})

func (*ZapWrapper) Error

func (z *ZapWrapper) Error(msg string, args ...interface{})

Implmenting the LeveledLogger for retry http

type LeveledLogger interface {
	Error(msg string, keysAndValues ...interface{})
	Info(msg string, keysAndValues ...interface{})
	Debug(msg string, keysAndValues ...interface{})
	Warn(msg string, keysAndValues ...interface{})
}

func (*ZapWrapper) Info

func (z *ZapWrapper) Info(msg string, args ...interface{})

func (*ZapWrapper) Warn

func (z *ZapWrapper) Warn(msg string, args ...interface{})

Jump to

Keyboard shortcuts

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