From ae8a784d67662f9f342e291a2f2f023335299ebe Mon Sep 17 00:00:00 2001 From: Harsh Thakur Date: Wed, 28 Oct 2020 19:30:11 +0530 Subject: [PATCH] Adding pubsub auth trigger Signed-off-by: Harsh Thakur --- content/docs/2.0/scalers/gcp-pub-sub.md | 38 +++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/content/docs/2.0/scalers/gcp-pub-sub.md b/content/docs/2.0/scalers/gcp-pub-sub.md index ea08b8b3c..71bee1a21 100644 --- a/content/docs/2.0/scalers/gcp-pub-sub.md +++ b/content/docs/2.0/scalers/gcp-pub-sub.md @@ -26,11 +26,17 @@ The `credentialsFromEnv` property maps to the name of an environment variable in `subscriptionName` defines the subscription that should be monitored. The `subscriptionSize` determines the target average which the deployment will be scaled on. The default `subscriptionSize` is 5. +Here's an [example](https://github.com/kedacore/sample-go-gcppubsub). + ### Authentication Parameters +You can use `TriggerAuthentication` CRD to configure the authenticate by providing the service account credentials in JSON. + + +**Credential based authentication:** -Not supported yet. +- `GoogleApplicationCredentials` - Service account credentials in JSON -### Example +### Example ```yaml apiVersion: keda.sh/v1alpha1 @@ -48,3 +54,31 @@ spec: subscriptionName: "mysubscription" # Required credentialsFromEnv: GOOGLE_APPLICATION_CREDENTIALS_JSON # Required ``` + +### Example using TriggerAuthentication + +```yaml +apiVersion: keda.sh/v1alpha1 +kind: TriggerAuthentication +metadata: + name: keda-trigger-auth-gcp-credentials +spec: + secretTargetRef: + - parameter: GoogleApplicationCredentials + name: pubsub-secret # Required. Refers to the name of the secret + key: GOOGLE_APPLICATION_CREDENTIALS_JSON # Required. +--- +apiVersion: keda.sh/v1alpha1 +kind: ScaledObject +metadata: + name: pubsub-scaledobject +spec: + scaleTargetRef: + name: keda-pubsub-go + triggers: + - type: gcp-pubsub + authenticationRef: + name: keda-trigger-auth-gcp-credentials + metadata: + subscriptionName: "input" # Required +```