Skip to content

Commit 33bde20

Browse files
committed
roachprod: fix NewPromClient creating IAP token source when disabled
Previously, after the IAP authentication refactor in commit ba62711, NewPromClient() would always attempt to create an IAP token source, even when Prometheus integration was disabled via ROACHPROD_PROM_HOST_URL="". This caused roachprod start to fail when running outside of Google Cloud environments with: failed to create IAP token source: failed to get default credentials: glcoud not on path The issue was that the condition in NewPromClient() only checked if c.httpClient == nil but didn't verify whether the client was disabled. When ROACHPROD_PROM_HOST_URL="" is set, promRegistrationUrl becomes "" which sets disabled: true, but the IAP token source creation was still being attempted. This change modifies the condition to also check !c.disabled, ensuring that when Prometheus integration is disabled, no IAP authentication is attempted. Epic: None Release Notes: None
1 parent 0d0fca4 commit 33bde20

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/roachprod/promhelperclient/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ func NewPromClient(options ...Option) (*PromClient, error) {
113113
option.apply(c)
114114
}
115115

116-
// If the client is not set, create a new client
117-
if c.httpClient == nil {
116+
// If the client is not set and not disabled, create a new client
117+
if c.httpClient == nil && !c.disabled {
118118
iapTokenSource, err := roachprodutil.NewIAPTokenSource(roachprodutil.IAPTokenSourceOptions{
119119
OAuthClientID: OAuthClientID,
120120
ServiceAccountEmail: ServiceAccountEmail,

0 commit comments

Comments
 (0)