apiVersion: v1
data:
  check_for_masters.sh: |
    #!/usr/bin/env bash
    if [[ -d "$PUPPET_SSL_DIR" ]]; then
        ls -la /etc/puppetlabs/puppet/ssl/certs/
        echo "A Puppetserver master has already started running."
        echo "Waiting to finish the generation of the Puppet SSL certs..."
        sleep 5
        while ! [[ -n "$(find /etc/puppetlabs/puppet/ssl/certs -name 'puppet*.pem' | head -1)" ]];
            do
              echo "Still waiting..."
              sleep 5
            done
        sleep 15
        echo "Puppet SSL certs have been generated. Continuing..."
    else
        echo "No other Puppetserver master is running. Continuing..."
    fi
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/component: puppetserver
    app.kubernetes.io/instance: puppetserver
    app.kubernetes.io/name: puppetserver
    app.kubernetes.io/version: 8.8.0
  name: puppetserver-init-masters-config
  namespace: puppet
