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

Commit 256b089

Browse files
dkoshkinjimmidyson
authored andcommitted
fix: the handlers should be changing user provided input (#35)
1 parent 5dbf460 commit 256b089

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

pkg/handlers/nutanix/mutation/prismcentralendpoint/inject.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,8 @@ func (h *nutanixPrismCentralEndpoint) Mutate(
120120
Kind: credentials.NutanixTrustBundleKindString,
121121
Data: string(decoded),
122122
}
123-
}
124-
125-
// Always force insecure to false if additional trust bundle is provided.
126-
// This ensures that the trust bundle is actually used to validate the connection.
127-
if additionalTrustBundle != "" && prismCentral.Insecure {
128-
log.Info("AdditionalTrustBundle is provided, setting insecure to false")
129-
prismCentral.Insecure = false
123+
// TODO: Consider always setting Insecure to false when AdditionalTrustBundle is set.
124+
// But do it in a webhook and not hidden in this handler.
130125
}
131126

132127
obj.Spec.Template.Spec.PrismCentral = prismCentral

pkg/handlers/nutanix/mutation/prismcentralendpoint/inject_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ var _ = Describe("Generate Nutanix Prism Central Endpoint patches", func() {
102102
gomega.BeEquivalentTo("prism-central.nutanix.com"),
103103
),
104104
gomega.HaveKeyWithValue("port", gomega.BeEquivalentTo(9441)),
105-
// Assert the insecure field was set to false as the additional trust bundle is set
106-
gomega.HaveKeyWithValue("insecure", false),
105+
// Assert the insecure field was not modified when additional trust bundle is set.
106+
gomega.HaveKeyWithValue("insecure", true),
107107
gomega.HaveKey("credentialRef"),
108108
gomega.HaveKey("additionalTrustBundle"),
109109
),

0 commit comments

Comments
 (0)