2

I have two environmental variables defined which are working fine. Apart from this, I have one JSON object serviceAccount which stored in manually created secret firebase-connector. As soon as I add this second part I got an error. I followed syntax but it's not working.

[][1] [1]: https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables

syntax error: expected <block end>, but found '-' (syntax)

test.yml

    env:
      SPRING_DATASOURCE_USERNAME: pns_usr
      JAVA_OPTIONS: >-
        -server -Xmx700M -Xms700M -XX:NewSize=500M -XX:MaxNewSize=500M
        -Djava.net.preferIPv4Stack=true
      - name: PNS_SERVICEACCOUNT
        valueFrom:
          secretKeyRef:
            name: firebase-connector
            key: serviceAccount

FirebaseService.java

 @Value("${pns.serviceaccount}")
    String serviceAccountValue;

application.properties

pns.serviceaccount=${PNS_SERVICEACCOUNT}
spring.datasource.username=${SPRING_DATASOURCE_USERNAME}
Pramod
  • 69
  • 1
  • 10
  • is this your values.yaml file? your `- name: PNS_SERVICEACCOUNT` block should be in `containers:` section of your template – edbighead Jul 30 '20 at 06:57
  • updated question with details – Pramod Jul 30 '20 at 08:57
  • can you post your full drone.yml and deployment.yaml – edbighead Jul 30 '20 at 12:31
  • I think this information should be enough. because everything is working except adding new way of secret -name. cant post security reason – Pramod Jul 31 '20 at 14:34
  • if your drone.yaml is file where you keep your values, it's the wrong place to define `secretKeyRef`, this whole `- name: PNS_SERVICEACCOUNT` should be under the `containers:` section of your deployment. – edbighead Jul 31 '20 at 14:46
  • I have added a secret config in Openshift. config name is firebase-connector and the key is serviceAccount which holds value inside config. How can I access this value within application? – Pramod Jul 31 '20 at 20:39
  • my bad. the filename is to my environment following more like this. https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables – Pramod Jul 31 '20 at 20:42

0 Answers0