apiVersion: v1
kind: Secret
metadata:
  name: mysecret
type: Opaque
data:
  SECURE_DATA: dG9rZW46IG15dG9rZW4=
---
apiVersion: lifecycle.keptn.sh/v1
kind: KeptnTaskDefinition
metadata:
  name: pre-deployment-hello
  annotations:
    python: test
spec:
  ttlSecondsAfterFinished: 500
  python:
    parameters:
      map:
        user: "myuser"
    secureParameters:
      secret: mysecret
    inline:
      code: |
        import os
        import yaml
        data = os.getenv('DATA')
        dct = yaml.safe_load(data)
        USER= dct['user']
        PASSWORD = os.environ.get('SECURE_DATA')
        print(USER,PASSWORD)
---

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: test
  name: test
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test
  strategy: {}
  template:
    metadata:
      labels:
        app: test
      annotations:
        keptn.sh/workload: waiter
        keptn.sh/version: "0.4"
        keptn.sh/pre-deployment-tasks: pre-deployment-hello
    spec:
      containers:
        - image: busybox
          name: busybox
          command: ['sh', '-c', 'echo The app is running! && sleep infinity']
