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

     1  // Copyright (c) 2022, 2024, 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  	TarFileFlagName  = "tar-file"
   132  	TarFileFlagValue = ""
   133  	TarFileFlagUsage = "Name of the cluster-dump tar file, which can have extensions of .tar, .tgz, and .tar.gz"
   134  
   135  	ReportFormatFlagName  = "report-format"
   136  	ReportFormatFlagUsage = "The format of the report output. Valid report formats are \"summary\" and \"detailed\"."
   137  
   138  	SummaryReport  = "summary"
   139  	DetailedReport = "detailed"
   140  )
   141  
   142  // Constants for export
   143  const (
   144  	NamespaceFlag        = "namespace"
   145  	NamespaceFlagDefault = "default"
   146  	NamespaceFlagUsage   = "The namespace containing the OAM application to export"
   147  	AppNameFlag          = "name"
   148  	AppNameFlagDefault   = ""
   149  	AppNameFlagUsage     = "The name of the OAM application to export"
   150  )
   151  
   152  // Constants for sanitize
   153  const (
   154  	InputTarFileFlagName  = "input-tar-file"
   155  	InputTarFileFlagValue = ""
   156  	InputTarFileFlagUsage = "Name of the input bug-report tar file, which can have extensions of .tar, .tgz, and .tar.gz"
   157  
   158  	OutputTarGZFileFlagName  = "output-tar.gz-file"
   159  	OutputTarGZFileFlagValue = ""
   160  	OutputTarGZFileFlagUsage = "Name of the .tar.gz file that contains the sanitized output"
   161  
   162  	InputDirectoryFlagName  = "input-directory"
   163  	InputDirectoryFlagValue = ""
   164  	InputDirectoryFlagUsage = "Name of the directory that contains the un-sanitized bug-report"
   165  
   166  	OutputDirectoryFlagName  = "output-directory"
   167  	OutputDirectoryFlagValue = ""
   168  	OutputDirectoryFlagUsage = "Name of the directory that will contain the sanitized bug-report"
   169  )
   170  
   171  // Constants for bug report
   172  const (
   173  	BugReportLogFlagDefault   = false
   174  	BugReportFileFlagName     = "report-file"
   175  	BugReportFileFlagValue    = ""
   176  	BugReportFileFlagShort    = "r"
   177  	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."
   178  	BugReportFileDefaultValue = "vz-bug-report-dt-*.tar.gz"
   179  
   180  	BugReportIncludeNSFlagName  = "include-namespaces"
   181  	BugReportIncludeNSFlagShort = "i"
   182  	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..."
   183  
   184  	// Flag for generating the redacted values mappping file
   185  	RedactedValuesFlagName  = "redacted-values-file"
   186  	RedactedValuesFlagValue = ""
   187  	RedactedValuesFlagUsage = "Creates a CSV file at the file path provided, containing a mapping between values redacted by the VZ analysis tool and their original values. Do not share this file as it contains sensitive data."
   188  
   189  	BugReportDir = "bug-report"
   190  
   191  	SanitizeDirInput = "sanitize-input"
   192  
   193  	SanitizeDirOutput = "sanitize-output"
   194  
   195  	TestDirectory   = "test-directory"
   196  	OutputTarGZFile = "output-tar-file.tar.gz"
   197  
   198  	// File name for the log captured from the pod
   199  	LogFile         = "logs.txt"
   200  	PreviousLogFile = "previous-logs.txt"
   201  
   202  	// File containing list of resources captured by the tool
   203  	BugReportOut = "bug-report.out"
   204  	BugReportErr = "bug-report.err"
   205  
   206  	BugReportError   = "ERROR: The bug report noticed one or more issues while capturing the resources. Please go through error(s) in the standard error."
   207  	BugReportWarning = "WARNING: Please examine the contents of the bug report for any sensitive data"
   208  
   209  	// File containing a map from redacted values to their original values
   210  	RedactionPrefix     = "REDACTED-"
   211  	RedactionFileSuffix = "-sensitive-do-not-share-redaction-map.csv"
   212  
   213  	// File names for the various resources
   214  	VzResource        = "verrazzano-resources.json"
   215  	DeploymentsJSON   = "deployments.json"
   216  	EventsJSON        = "events.json"
   217  	PodsJSON          = "pods.json"
   218  	CertificatesJSON  = "certificates.json"
   219  	ServicesJSON      = "services.json"
   220  	ReplicaSetsJSON   = "replicasets.json"
   221  	DaemonSetsJSON    = "daemonsets.json"
   222  	IngressJSON       = "ingress.json"
   223  	StatefulSetsJSON  = "statefulsets.json"
   224  	AppConfigJSON     = "application-configurations.json"
   225  	ComponentJSON     = "components.json"
   226  	IngressTraitJSON  = "ingress-traits.json"
   227  	MetricsTraitJSON  = "metrics-traits.json"
   228  	McAppConfigJSON   = "multicluster-application-configurations.json"
   229  	McComponentJSON   = "multicluster-components.json"
   230  	VzProjectsJSON    = "verrazzano-projects.json"
   231  	VmcJSON           = "verrazzano-managed-clusters.json"
   232  	NamespaceJSON     = "namespace.json"
   233  	MetadataJSON      = "metadata.json"
   234  	InnoDBClusterJSON = "inno-db-cluster.json"
   235  
   236  	// Indentation when the resource is marshalled as Json
   237  	JSONIndent = "  "
   238  
   239  	// The prefix used for the json.MarshalIndent
   240  	JSONPrefix = ""
   241  
   242  	// Top level directory for the bug report, keeping cluster-snapshot for now to support the analyze the command
   243  	BugReportRoot = "cluster-snapshot"
   244  
   245  	// Label for application
   246  	AppLabel               = "app"
   247  	K8SAppLabel            = "k8s-app"
   248  	K8sAppLabelExternalDNS = "app.kubernetes.io/name"
   249  	// Message prefix for bug-report and live cluster analysis
   250  	BugReportMsgPrefix = "Capturing "
   251  	AnalysisMsgPrefix  = "Analyzing "
   252  
   253  	// Flag for capture pods logs( both additional and system namespaces)
   254  	BugReportLogFlagName         = "include-logs"
   255  	BugReportLogFlagNameShort    = "l"
   256  	BugReportLogFlagNameUsage    = "Include logs from the pods in one or more namespaces; this is specified along with the --include-namespaces flag."
   257  	BugReportTimeFlagName        = "duration"
   258  	BugReportTimeFlagNameShort   = "d"
   259  	BugReportTimeFlagDefaultTime = 0
   260  	BugReportTimeFlagNameUsage   = "The time period during which the logs are collected in seconds, minutes, and hours."
   261  )
   262  const (
   263  	ProgressFlag        = "progress"
   264  	ProgressFlagHelp    = "Displaying progress bar with components and their status"
   265  	ProgressFlagDefault = false
   266  )
   267  const ProgressShorthand = "p"
   268  const RefreshRate = time.Second * 10
   269  const TotalWidth = 50
   270  
   271  // Common error strings
   272  const (
   273  	FlagErrorMessage          = "an error occurred while reading value for the flag --%s: %s"
   274  	RedactionMapCreationError = "an error occurred while creating the redacted values map at %s: %s"
   275  )