Skip to content

Commit

Permalink
Fix nil pointer bug in credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
Jont828 committed Jan 18, 2024
1 parent 6deb57d commit 6b79e37
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func constructHelmReleaseProxy(existing *addonsv1alpha1.HelmReleaseProxy, helmCh
}

// Set the default value for EnableClientCache if it is not set
if helmReleaseProxy.Spec.Options.EnableClientCache == nil {
if helmReleaseProxy.Spec.Options != nil && helmReleaseProxy.Spec.Options.EnableClientCache == nil {
helmReleaseProxy.Spec.Options.EnableClientCache = &defaultEnableClientCache
}

Expand Down
4 changes: 2 additions & 2 deletions internal/helm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (c *HelmClient) InstallHelmRelease(ctx context.Context, kubeconfig string,
settings.RegistryConfig = credentialsPath

enableClientCache := true
if spec.Options.EnableClientCache != nil {
if spec.Options != nil && spec.Options.EnableClientCache != nil {
enableClientCache = *spec.Options.EnableClientCache
}
log.V(2).Info("Creating install registry client", "enableClientCache", enableClientCache, "credentialsPath", credentialsPath)
Expand Down Expand Up @@ -343,7 +343,7 @@ func (c *HelmClient) UpgradeHelmReleaseIfChanged(ctx context.Context, kubeconfig
settings.RegistryConfig = credentialsPath

enableClientCache := true
if spec.Options.EnableClientCache != nil {
if spec.Options != nil && spec.Options.EnableClientCache != nil {
enableClientCache = *spec.Options.EnableClientCache
}
log.V(2).Info("Creating upgrade registry client", "enableClientCache", enableClientCache, "credentialsPath", credentialsPath)
Expand Down

0 comments on commit 6b79e37

Please sign in to comment.