@@ -28,62 +28,62 @@ import (
2828
2929var (
3030 // Do not populate providerOptsContainer here as we need to call InitProivders() first.
31- providerOptsContainer vm.ProviderOptionsContainer
32- pprofOpts roachprod.PprofOpts
33- numNodes int
34- numRacks int
35- username string
36- database string
37- dryrun bool
38- destroyAllMine bool
39- destroyAllLocal bool
40- extendLifetime time.Duration
41- wipePreserveCerts bool
42- grafanaConfig string
43- grafanaArch string
44- grafanaDumpDir string
45- jaegerConfigNodes string
46- listCost bool
47- listDetails bool
48- listJSON bool
49- listMine bool
50- listPattern string
51- isSecure install.ComplexSecureOption // Set based on the values passed to --secure and --insecure
52- secure = true
53- insecure = envutil . EnvOrDefaultBool ( "COCKROACH_ROACHPROD_INSECURE" , false )
54- virtualClusterName string
55- sqlInstance int
56- extraSSHOptions = ""
57- exportSSHConfig string
58- nodeEnv []string
59- tag string
60- external = false
61- pgurlCertsDir string
62- authMode string
63- adminurlPath = ""
64- adminurlIPs = false
65- urlOpen = false
66- useTreeDist = true
67- sig = 9
68- waitFlag = false
69- gracePeriod = 0
70- deploySig = 15
71- deployWaitFlag = true
72- deployGracePeriod = 300
73- pause = time .Duration (0 )
74- createVMOpts = vm .DefaultCreateOpts ()
75- startOpts = roachprod .DefaultStartOpts ()
76- stageOS string
77- stageArch string
78- stageDir string
79- logsDir string
80- logsFilter string
81- logsProgramFilter string
82- logsFrom time.Time
83- logsTo time.Time
84- logsInterval time.Duration
85- volumeCreateOpts vm.VolumeCreateOpts
86- listOpts vm.ListOptions
31+ providerOptsContainer vm.ProviderOptionsContainer
32+ pprofOpts roachprod.PprofOpts
33+ numNodes int
34+ numRacks int
35+ username string
36+ database string
37+ dryrun bool
38+ destroyAllMine bool
39+ destroyAllLocal bool
40+ extendLifetime time.Duration
41+ wipePreserveCerts bool
42+ grafanaConfig string
43+ grafanaArch string
44+ grafanaDumpDir string
45+ jaegerConfigNodes string
46+ listCost bool
47+ listDetails bool
48+ listJSON bool
49+ listMine bool
50+ listPattern string
51+ isSecure install.ComplexSecureOption // Set based on the values passed to --secure and --insecure
52+ secure = true
53+ insecure , insecureEnvSet = getInsecureEnvVar () // Get both value and whether it was explicitly set
54+ virtualClusterName string
55+ sqlInstance int
56+ extraSSHOptions = ""
57+ exportSSHConfig string
58+ nodeEnv []string
59+ tag string
60+ external = false
61+ pgurlCertsDir string
62+ authMode string
63+ adminurlPath = ""
64+ adminurlIPs = false
65+ urlOpen = false
66+ useTreeDist = true
67+ sig = 9
68+ waitFlag = false
69+ gracePeriod = 0
70+ deploySig = 15
71+ deployWaitFlag = true
72+ deployGracePeriod = 300
73+ pause = time .Duration (0 )
74+ createVMOpts = vm .DefaultCreateOpts ()
75+ startOpts = roachprod .DefaultStartOpts ()
76+ stageOS string
77+ stageArch string
78+ stageDir string
79+ logsDir string
80+ logsFilter string
81+ logsProgramFilter string
82+ logsFrom time.Time
83+ logsTo time.Time
84+ logsInterval time.Duration
85+ volumeCreateOpts vm.VolumeCreateOpts
86+ listOpts vm.ListOptions
8787
8888 monitorOpts install.MonitorOpts
8989 cachedHostsCluster string
@@ -109,11 +109,24 @@ var (
109109 fetchLogsTimeout time.Duration
110110)
111111
112+ // getInsecureEnvVar returns the value of COCKROACH_ROACHPROD_INSECURE and
113+ // whether it was explicitly set.
114+ func getInsecureEnvVar () (bool , bool ) {
115+ val , ok := envutil .EnvString ("COCKROACH_ROACHPROD_INSECURE" , 1 )
116+ if ! ok {
117+ return false , false
118+ }
119+ return val == "true" || val == "1" , true
120+ }
121+
112122// Intended to be called once from drtprod main package to update defaults which differ from roachprod.
113123func UpdateFlagDefaults () {
114- // N.B. unlike roachprod, which defaults to "insecure mode", drtprod defaults to "secure mode".
124+ // N.B. Both roachprod and drtprod default to secure mode via the flag defaults.
125+ // However, roachprod has runtime logic in overrideBasedOnClusterSettings() that
126+ // forces insecure mode for clusters in the cockroach-ephemeral GCP project.
127+ // drtprod explicitly sets secure=true here to ensure secure mode is used.
115128 secure = true
116- insecure = envutil . EnvOrDefaultBool ( "COCKROACH_ROACHPROD_INSECURE" , false )
129+ // insecure and insecureEnvSet are already initialized via getInsecureEnvVar( )
117130}
118131
119132func initRootCmdFlags (rootCmd * cobra.Command ) {
0 commit comments