Просмотр исходного кода

docs(e2e): correct the webhook url templating note

The read and push paths do template disjoint variable sets, but a fallback
bridges them ("{{ or .remoteRef.key .remoteRef.remoteKey }}"); only naming both
plainly fails, because the absent one renders as the literal "<no value>". The
comment claimed no single template could serve both, which reads as a provider
limitation that does not exist.

Refs: external-secrets/external-secrets#6757
Signed-off-by: Alexander Chernov <alexander@chernov.it>
Alexander Chernov 1 месяц назад
Родитель
Сommit
87bf214250

+ 5 - 3
e2e/suites/provider/cases/webhook/provider.go

@@ -84,9 +84,11 @@ const (
 	// The read and the push code paths template spec.url from disjoint variable
 	// sets: a read exposes .remoteRef.key, while a push and a delete expose
 	// .remoteRef.remoteKey. text/template runs with missingkey=default, so
-	// referencing the absent one renders the literal "<no value>" rather than an
-	// empty string, which means one url template cannot serve both. Specs pick
-	// the template that matches what they exercise.
+	// naming the absent one renders the literal "<no value>" rather than an
+	// empty string. Concatenating both therefore does not work, though a
+	// fallback does ("{{ or .remoteRef.key .remoteRef.remoteKey }}"). The specs
+	// use one explicit template per path anyway, so it stays obvious which
+	// variable set each one exercises.
 	readKeyTemplate = "{{ .remoteRef.key }}"
 	pushKeyTemplate = "{{ .remoteRef.remoteKey }}"
 )

+ 3 - 4
e2e/suites/provider/cases/webhook/webhook.go

@@ -133,10 +133,9 @@ var _ = Describe("[webhook]", Label("webhook"), func() {
 			Namespace: f.Namespace.Name, Name: f.Namespace.Name,
 		}, store)).To(Succeed())
 		base := store.DeepCopy()
-		// The url and headers have to switch to .remoteRef.remoteKey: the push
-		// path never populates .remoteRef.key, and referencing it would render
-		// the literal "<no value>" into the path. See the note on
-		// readKeyTemplate.
+		// The url and headers switch to .remoteRef.remoteKey: the push path never
+		// populates .remoteRef.key, so naming it would render the literal
+		// "<no value>" into the path. See the note on readKeyTemplate.
 		store.Spec = prov.storeSpec(authSecretName, pushKeyTemplate)
 		store.Spec.Provider.Webhook.Body = `{"pushed":"{{ .remoteRef.` + remoteKey + ` }}"}`
 		Expect(f.CRClient.Patch(GinkgoT().Context(), store, client.MergeFrom(base))).To(Succeed())