apiVersion: v1
kind: ConfigMap
metadata:
  name: pem-to-keystore
data:
  local-keystore-trustore: |
    #!/bin/sh
    echo "Generating Keystore"
    openssl pkcs12 -export -inkey $keyfile -in $crtfile -out $keystore_pkcs12 -password pass:$key_store_password 
    echo "Import Keystore"
    keytool -importkeystore -noprompt -srckeystore $keystore_pkcs12 -srcstoretype pkcs12 -destkeystore $keystore_jks -storepass $key_store_password -srcstorepass $key_store_password 
    echo "Import Truststore"
    cd /var/run/secrets/java.io/keystores
    keytool -importkeystore -srckeystore /etc/ssl/certs/java/cacerts -destkeystore app-trustore -deststorepass changeit -srcstorepass changeit -noprompt
    echo "Add CA to Truststore "
    keytool -importcert -file /etc/ssl/certs/service-ca.crt -keystore app-trustore -storepass changeit -noprompt 
    echo "Truststore added to shared volume" 

    