Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

fix: don't modify user provider input for Nutanix insecure #35

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions pkg/handlers/nutanix/mutation/prismcentralendpoint/inject.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,8 @@ func (h *nutanixPrismCentralEndpoint) Mutate(
Kind: credentials.NutanixTrustBundleKindString,
Data: string(decoded),
}
}

// Always force insecure to false if additional trust bundle is provided.
// This ensures that the trust bundle is actually used to validate the connection.
if additionalTrustBundle != "" && prismCentral.Insecure {
log.Info("AdditionalTrustBundle is provided, setting insecure to false")
prismCentral.Insecure = false
// TODO: Consider always setting Insecure to false when AdditionalTrustBundle is set.
// But do it in a webhook and not hidden in this handler.
}

obj.Spec.Template.Spec.PrismCentral = prismCentral
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ var _ = Describe("Generate Nutanix Prism Central Endpoint patches", func() {
gomega.BeEquivalentTo("prism-central.nutanix.com"),
),
gomega.HaveKeyWithValue("port", gomega.BeEquivalentTo(9441)),
// Assert the insecure field was set to false as the additional trust bundle is set
gomega.HaveKeyWithValue("insecure", false),
// Assert the insecure field was not modified when additional trust bundle is set.
gomega.HaveKeyWithValue("insecure", true),
gomega.HaveKey("credentialRef"),
gomega.HaveKey("additionalTrustBundle"),
),
Expand Down