github.com/verrazzano/verrazzano@v1.7.0/tools/vz/pkg/constants/constants.go (about)

     1  // Copyright (c) 2022, 2023, Oracle and/or its affiliates.
     2  // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  package constants
     5  
     6  import "time"
     7  
     8  // GlobalFlagKubeConfig - global flag for specifying the location of the kube config
     9  const GlobalFlagKubeConfig = "kubeconfig"
    10  const GlobalFlagKubeConfigHelp = "Path to the kubeconfig file to use"
    11  
    12  // GlobalFlagContext - global flag for specifying which kube config context to use
    13  const GlobalFlagContext = "context"
    14  const GlobalFlagContextHelp = "The name of the kubeconfig context to use" // Flags that are common to more than one command
    15  const (
    16  	// GlobalFlagHelp - global help flag
    17  	GlobalFlagHelp               = "help"
    18  	WaitFlag                     = "wait"
    19  	WaitFlagHelp                 = "Wait for the command to complete and stream the logs to the console. The wait period is controlled by --timeout."
    20  	WaitFlagDefault              = true
    21  	TimeoutFlag                  = "timeout"
    22  	TimeoutFlagHelp              = "Limits the amount of time a command will wait to complete"
    23  	VPOTimeoutFlag               = "platform-operator-timeout"
    24  	VPOTimeoutFlagHelp           = "Limits the amount of time a command will wait for the Verrazzano Platform Operator to be ready"
    25  	VersionFlag                  = "version"
    26  	VersionFlagDefault           = "latest"
    27  	VersionFlagInstallHelp       = "The version of Verrazzano to install"
    28  	VersionFlagUpgradeHelp       = "The version of Verrazzano to upgrade to"
    29  	DryRunFlag                   = "dry-run"
    30  	SetFlag                      = "set"
    31  	SetFlagShorthand             = "s"
    32  	SetFlagHelp                  = "Override a Verrazzano resource value (e.g. --set profile=dev).  This flag can be specified multiple times."
    33  	OperatorFileFlag             = "operator-file" // an alias for the manifests flag
    34  	OperatorFileDeprecateMsg     = "Use --manifests instead"
    35  	ManifestsFlag                = "manifests"
    36  	ManifestsShorthand           = "m"
    37  	ManifestsFlagHelp            = "The location of the manifests used to install or upgrade Verrazzano. This can be a URL or the path to a local file. The default is the verrazzano-platform-operator.yaml file of the specified (or most recent) version of Verrazzano."
    38  	ImageRegistryFlag            = "image-registry"
    39  	ImageRegistryFlagHelp        = "The private registry where Verrazzano image repositories are located. If unspecified, the public Verrazzano image registry will be used."
    40  	ImageRegistryFlagDefault     = ""
    41  	ImagePrefixFlag              = "image-prefix"
    42  	ImagePrefixFlagHelp          = "The prefix to use for all Verrazzano image names within the private image-registry. If unspecified, the default image prefixes in the Verrazzano image registry will be used."
    43  	ImagePrefixFlagDefault       = ""
    44  	LogFormatFlag                = "log-format"
    45  	LogFormatHelp                = "The format of the log output. Valid output formats are \"simple\" and \"json\"."
    46  	FilenameFlag                 = "filename"
    47  	FilenameFlagShorthand        = "f"
    48  	FilenameFlagHelp             = "Path to file containing Verrazzano custom resource.  This flag can be specified multiple times to overlay multiple files.  Specifying \"-\" as the filename accepts input from stdin."
    49  	SkipConfirmationFlagHelp     = "Non-interactive mode - assumes the answers to all interactive questions to be 'Y'."
    50  	SkipConfirmationFlag         = "skip-confirmation"
    51  	SkipConfirmationShort        = "y"
    52  	SkipPlatformOperatorFlag     = "skip-platform-operator"
    53  	SkipPlatformOperatorFlagHelp = "Installing the platform operator is skipped, but continues on to install Verrazzano."
    54  	VerboseFlag                  = "verbose"
    55  	VerboseFlagShorthand         = "v"
    56  	VerboseFlagDefault           = false
    57  	VerboseFlagUsage             = "Enable verbose output."
    58  	ReadOnly                     = "read-only file system"
    59  	AutoBugReportFlag            = "auto-bug-report"
    60  	AutoBugReportFlagDefault     = true
    61  	AutoBugReportFlagHelp        = "Automatically call vz bug-report if command fails"
    62  	VzAnalysisReportTmpFile      = "details-*.out"
    63  	// DatetimeFormat - suffix to vz bug report file in yyyymmddhhmmss format
    64  	DatetimeFormat = "20060102150405"
    65  )
    66  
    67  // VerrazzanoReleaseList - API for getting the list of Verrazzano releases
    68  const VerrazzanoReleaseList = "https://api.github.com/repos/verrazzano/verrazzano/releases"
    69  
    70  // VerrazzanoOperatorURL - URL for downloading Verrazzano operator.yaml
    71  const VerrazzanoOperatorURL = "https://github.com/verrazzano/verrazzano/releases/download/%s/operator.yaml"
    72  
    73  // VerrazzanoPlatformOperatorURL - URL for downloading verrazzano-platform-operator.yaml
    74  const VerrazzanoPlatformOperatorURL = "https://github.com/verrazzano/verrazzano/releases/download/%s/verrazzano-platform-operator.yaml"
    75  
    76  const VerrazzanoPlatformOperator = "verrazzano-platform-operator"
    77  
    78  const VerrazzanoPlatformOperatorWebhook = "verrazzano-platform-operator-webhook"
    79  
    80  const VerrazzanoMysqlInstallValuesWebhook = "verrazzano-platform-mysqlinstalloverrides"
    81  
    82  const VerrazzanoRequirementsValidatorWebhook = "verrazzano-platform-requirements-validator"
    83  
    84  const VerrazzanoApplicationOperator = "verrazzano-application-operator"
    85  
    86  const VerrazzanoClusterOperator = "verrazzano-cluster-operator"
    87  
    88  const VerrazzanoMonitoringOperator = "verrazzano-monitoring-operator"
    89  
    90  const VerrazzanoUninstall = "verrazzano-uninstall"
    91  
    92  const VerrazzanoInstall = "verrazzano-install"
    93  
    94  const VerrazzanoManagedCluster = "verrazzano-managed-cluster"
    95  
    96  const VerrazzanoPlatformOperatorWait = 1
    97  
    98  const OAMAppConfigurations = "applicationconfigurations"
    99  
   100  const OAMMCAppConfigurations = "multiclusterapplicationconfigurations"
   101  
   102  const OAMMCCompConfigurations = "multiclustercomponents"
   103  
   104  const OAMComponents = "components"
   105  
   106  const OAMMetricsTraits = "metricstraits"
   107  
   108  const OAMIngressTraits = "ingresstraits"
   109  
   110  const OAMProjects = "verrazzanoprojects"
   111  
   112  const OAMManagedClusters = "verrazzanomanagedclusters"
   113  
   114  const VerrazzanoManagedLabel = "verrazzano-managed=true"
   115  
   116  const LineSeparator = "-"
   117  
   118  // MysqlBackupMutatingWebhookName specifies the name of mysql webhook.
   119  const MysqlBackupMutatingWebhookName = "verrazzano-mysql-backup"
   120  
   121  // Analysis tool flags
   122  const (
   123  	DirectoryFlagName  = "capture-dir"
   124  	DirectoryFlagValue = ""
   125  	DirectoryFlagUsage = "Directory holding the captured data."
   126  
   127  	ReportFileFlagName  = "report-file"
   128  	ReportFileFlagValue = ""
   129  	ReportFileFlagUsage = "Name of the report output file. (default stdout)"
   130  
   131  	ReportFormatFlagName  = "report-format"
   132  	ReportFormatFlagUsage = "The format of the report output. Valid report formats are \"summary\" and \"detailed\"."
   133  
   134  	SummaryReport  = "summary"
   135  	DetailedReport = "detailed"
   136  )
   137  
   138  // Constants for bug report
   139  const (
   140  	BugReportLogFlagDefault   = false
   141  	BugReportFileFlagName     = "report-file"
   142  	BugReportFileFlagValue    = ""
   143  	BugReportFileFlagShort    = "r"
   144  	BugReportFileFlagUsage    = "The report file created by the vz bug-report command, as a *.tar.gz file. Defaults to vz-bug-report-datetime-xxxx.tar.gz in the current directory."
   145  	BugReportFileDefaultValue = "vz-bug-report-dt-*.tar.gz"
   146  
   147  	BugReportIncludeNSFlagName  = "include-namespaces"
   148  	BugReportIncludeNSFlagShort = "i"
   149  	BugReportIncludeNSFlagUsage = "A comma-separated list of namespaces, in addition to the ones collected by default (system namespaces), for collecting cluster information. This flag can be specified multiple times, such as --include-namespaces ns1 --include-namespaces ns..."
   150  
   151  	BugReportDir = "bug-report"
   152  
   153  	// File name for the log captured from the pod
   154  	LogFile = "logs.txt"
   155  
   156  	// File containing list of resources captured by the tool
   157  	BugReportOut = "bug-report.out"
   158  	BugReportErr = "bug-report.err"
   159  
   160  	BugReportError   = "ERROR: The bug report noticed one or more issues while capturing the resources. Please go through error(s) in the standard error."
   161  	BugReportWarning = "WARNING: Please examine the contents of the bug report for any sensitive data"
   162  
   163  	// File names for the various resources
   164  	VzResource       = "verrazzano-resources.json"
   165  	DeploymentsJSON  = "deployments.json"
   166  	EventsJSON       = "events.json"
   167  	PodsJSON         = "pods.json"
   168  	CertificatesJSON = "certificates.json"
   169  	ServicesJSON     = "services.json"
   170  	ReplicaSetsJSON  = "replicasets.json"
   171  	DaemonSetsJSON   = "daemonsets.json"
   172  	IngressJSON      = "ingress.json"
   173  	StatefulSetsJSON = "statefulsets.json"
   174  	AppConfigJSON    = "application-configurations.json"
   175  	ComponentJSON    = "components.json"
   176  	IngressTraitJSON = "ingress-traits.json"
   177  	MetricsTraitJSON = "metrics-traits.json"
   178  	McAppConfigJSON  = "multicluster-application-configurations.json"
   179  	McComponentJSON  = "multicluster-components.json"
   180  	VzProjectsJSON   = "verrazzano-projects.json"
   181  	VmcJSON          = "verrazzano-managed-clusters.json"
   182  
   183  	// Indentation when the resource is marshalled as Json
   184  	JSONIndent = "  "
   185  
   186  	// The prefix used for the json.MarshalIndent
   187  	JSONPrefix = ""
   188  
   189  	// Top level directory for the bug report, keeping cluster-snapshot for now to support the analyze the command
   190  	BugReportRoot = "cluster-snapshot"
   191  
   192  	// Label for application
   193  	AppLabel               = "app"
   194  	K8SAppLabel            = "k8s-app"
   195  	K8sAppLabelExternalDNS = "app.kubernetes.io/name"
   196  	// Message prefix for bug-report and live cluster analysis
   197  	BugReportMsgPrefix = "Capturing "
   198  	AnalysisMsgPrefix  = "Analyzing "
   199  
   200  	// Flag for capture pods logs( both additional and system namespaces)
   201  	BugReportLogFlagName         = "include-logs"
   202  	BugReportLogFlagNameShort    = "l"
   203  	BugReportLogFlagNameUsage    = "Include logs from the pods in one or more namespaces; this is specified along with the --include-namespaces flag."
   204  	BugReportTimeFlagName        = "duration"
   205  	BugReportTimeFlagNameShort   = "d"
   206  	BugReportTimeFlagDefaultTime = 0
   207  	BugReportTimeFlagNameUsage   = "The time period during which the logs are collected in seconds, minutes, and hours."
   208  )
   209  const (
   210  	ProgressFlag        = "progress"
   211  	ProgressFlagHelp    = "Displaying progress bar with components and their status"
   212  	ProgressFlagDefault = false
   213  )
   214  const ProgressShorthand = "p"
   215  const RefreshRate = time.Second * 10
   216  const TotalWidth = 50