github.com/codefresh-io/kcfi@v0.0.0-20230301195427-c1578715cc46/pkg/config/config.go (about)

     1  /*
     2  Copyright The Codefresh Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package config
    18  
    19  import (
    20  	"os"
    21  	"strconv"
    22  )
    23  
    24  const (
    25  	// AssetsDir - folder name where we save kubernetes and helm assets
    26  	AssetsDir = "assets"
    27  
    28  	CodefreshReleaseName = "cf"
    29  	OperatorReleaseName  = "cf-onprem-operator"
    30  
    31  	CfRegistryAddress  = "gcr.io"
    32  	CfRegistryUsername = "_json_key"
    33  
    34  	KeyKind       = "metadata.kind"
    35  	KindCodefresh = "codefresh"
    36  	KindK8sAgent  = "k8sAgent"
    37  	KindVenona    = "venona"
    38  
    39  	KeyImagesCodefreshRegistrySa     = "images.codefreshRegistrySa"
    40  	KeyImagesUsePrivateRegistry      = "images.usePrivateRegistry"
    41  	KeyImagesPrivateRegistryAddress  = "images.privateRegistry.address"
    42  	KeyImagesPrivateRegistryUsername = "images.privateRegistry.username"
    43  	KeyImagesPrivateRegistryPassword = "images.privateRegistry.password"
    44  	KeyImagesLists                   = "images.lists"
    45  
    46  	KeyRelease            = "metadata.installer.release"
    47  	KeyInstallerType      = "metadata.installer.type"
    48  	InstallerTypeOperator = "operator"
    49  	InstallerTypeHelm     = "helm"
    50  
    51  	KeyOperatorChartValues = "metadata.installer.operator"
    52  	KeyOperatorSkipCRD     = "metadata.installer.operator.skipCRD"
    53  	KeyDockerRegistry      = "dockerRegistry"
    54  
    55  	OperatorHelmReleaseName = "cf-onprem-operator"
    56  	OperatorHelmChartName   = "codefresh-operator"
    57  
    58  	KeyHelmChart    = "metadata.installer.helm.chart"
    59  	KeyHelmRelease  = "metadata.installer.helm.release"
    60  	KeyHelmRepoURL  = "metadata.installer.helm.repoUrl"
    61  	KeyHelmVersion  = "metadata.installer.helm.version"
    62  	KeyHelmCaFile   = "metadata.installer.helm.caFile"
    63  	KeyHelmCertFile = "metadata.installer.helm.certFile"
    64  	KeyHelmKeyFile  = "metadata.installer.helm.keyFile"
    65  	KeyHelmKeyring  = "metadata.installer.helm.keyring"
    66  	KeyHelmPassword = "metadata.installer.helm.password"
    67  	KeyHelmUsername = "metadata.installer.helm.username"
    68  	KeyHelmVerify   = "metadata.installer.helm.verify"
    69  
    70  	CodefreshHelmReleaseName = "cf"
    71  
    72  	KeyKubeNamespace  = "kubernetes.namespace"
    73  	KeyKubeContext    = "kubernetes.context"
    74  	KeyKubeKubeconfig = "kubernetes.kubeconfig"
    75  
    76  	KeyBaseDir       = "BaseDir"
    77  	KeyTlsSelfSigned = "tls.selfSigned"
    78  	KeyTlsCert       = "tls.cert"
    79  	KeyTlsKey        = "tls.key"
    80  
    81  	KeyGlobalMongoTLS    = "global.mongoTLS"
    82  	KeyGlobalMongoCaCert = "global.mongoCaCert"
    83  	KeyGlobalMongoCaKey  = "global.mongoCaKey"
    84  
    85  	KeyAppUrl = "global.appUrl"
    86  
    87  	KeyDbInfra        = "dbinfra"
    88  	KeyDbInfraEnabled = "dbinfra.enabled"
    89  	KeyDbInfraUpgrade = "dbinfra.upgrade"
    90  
    91  	DbInfraHelmChartName              = "codefresh-db-infra"
    92  	DbInfraMainConfigChangeValuesFile = "values/db-infra.yaml"
    93  	DbInfraConfigFile                 = "addons/db-infra/config.yaml"
    94  
    95  	KeyInclude = "include"
    96  
    97  	EnvPusherDebug = "PUSHER_DEBUG"
    98  
    99  	KeyBkpManagerMongoURI      = "jobConfigs.cfBackupPlan.target.uri"
   100  	KeyGlobalMongoURI          = "global.mongoURI"
   101  	KeyGlobalMongoRootUser     = "global.mongodbRootUser"
   102  	KeyGlobalMongoRootPassword = "global.mongodbRootPassword"
   103  	KeyLocalMongoRootUser      = "mongodb.mongodbRootUser"
   104  	KeyLocalMongoRootPassword  = "mongodb.mongodbRootPassword"
   105  
   106  	KeyGlobalMongoUser     = "global.mongodbUsername"
   107  	KeyGlobalMongoPassword = "global.mongodbPassword"
   108  	KeyLocalMongoEnabled   = "mongo.enabled"
   109  	KeyLocalMongoUser      = "mongodb.mongodbUsername"
   110  	KeyLocalMongoPassword  = "mongodb.mongodbPassword"
   111  	MongoDefaultAppUser    = "cfuser"
   112  
   113  	KeyGlobalPostgresUser     = "global.postgresUser"
   114  	KeyGlobalPostgresPassword = "global.postgresPassword"
   115  
   116  	KeyLocalPostgresEnabled  = "postgresql.enabled"
   117  	KeyLocalPostgresUser     = "postgresql.postgresUser"
   118  	KeyLocalPostgresPassword = "postgresql.postgresPassword"
   119  
   120  	KeyLocalPostgresImage    = "postgresql.image"
   121  	KeyLocalPostgresImageTag = "postgresql.imageTag"
   122  
   123  	KeyGlobalRedisURL      = "global.redisUrl"
   124  	KeyGlobalRedisPassword = "global.redisPassword"
   125  	KeyLocalRedisEnabled   = "redis.enabled"
   126  	KeyLocalRedisPassword  = "redis.redisPassword"
   127  
   128  	KeyGlobalRuntimeRedisHost     = "global.runtimeRedisHost"
   129  	KeyGlobalRuntimeRedisPassword = "global.runtimeRedisPassword"
   130  
   131  	KeyGlobalRabbitUser     = "global.rabbitmqUsername"
   132  	KeyGlobalRabbitPassword = "global.rabbitmqPassword"
   133  	KeyLocalRabbitEnabled   = "rabbitmq.enabled"
   134  	KeyLocalRabbitUser      = "rabbitmq.rabbitmqUsername"
   135  	KeyLocalRabbitPassword  = "rabbitmq.rabbitmqPassword"
   136  )
   137  
   138  // CodefreshValuesFieldsWarnIfNotSet - print warning if these fields are not set on installation
   139  var CodefreshValuesFieldsWarnIfNotSet = map[string]string{
   140  	// "global.mongodbRootPassword": "Installing with default password for mongodb root is not recommended",
   141  	// "global.mongodbPassword":     "Installing with default password for mongodb cfuser is not recommended",
   142  	// "global.postgresPassword":    "Installing with default password for postgres db is not recommended",
   143  	// "global.redisPassword":       "Installing with default password for redis is not recommended",
   144  	// "global.rabbitmqPassword":    "Installing with default password for rabbitmq is not recommended",
   145  }
   146  
   147  // Debug -
   148  var Debug, _ = strconv.ParseBool(os.Getenv("HELM_DEBUG"))