How do you get Jinja templates into spinnaker/echo for webhook processing?

12/6/2018

I have Spinnaker 1.10.5 deployed to Azure Kubernetes Service using Halyard.

I am trying to get Azure Container Registry webhooks to trigger a pipeline. I found that you can set up echo to allow artifact webhooks using an echo-local.yml like this:

webhooks:
  artifacts:
    enabled: true
    sources:
    - source: azurecr
      templatePath: /path/to/azurecr.jinja

However, I'm stuck on the templatePath value. Since I'm deploying with Halyard into Kubernetes, all the configuration files get mounted as volumes from Kubernetes secrets.

How do I get my Jinja template into my Halyard-deployed echo so it can be used in a custom webhook?

-- Travis Illig
azure-container-registry
kubernetes
spinnaker
spinnaker-halyard

1 Answer

12/6/2018

As of Halyard 1.13 there will be the ability to custom mount secrets in Kubernetes

Create a Kubernetes secret with your Jinja template.

apiVersion: v1
kind: Secret
metadata:
  name: echo-webhook-templates
  namespace: spinnaker
type: Opaque
data:
  mytemplate:  [base64-encoded-contents-of-template]

Set the templatePath in the ~/.hal/default/profiles/echo-local.yml to the place you're mounting the secret.

webhooks: artifacts: enabled: true sources: - source: mysource templatePath: /mnt/webhook-templates/mytemplate

Add the mount to ~/.hal/default/service-settings/echo.yml

kubernetes:
  volumes:
  - id: echo-webhook-templates
    type: secret
    mountPath: /mnt/webhook-templates

Since Halyard 1.13 hasn't actually been released yet, I obviously haven't tried this, but it's how it should work. Also... I guess I may be stuck until then.

-- Travis Illig
Source: StackOverflow