Skip to content

Instantly share code, notes, and snippets.

@jefferyb
Created July 5, 2017 21:21
Show Gist options
  • Save jefferyb/15b3eb58ae41ef2925a3b7134d621f30 to your computer and use it in GitHub Desktop.
Save jefferyb/15b3eb58ae41ef2925a3b7134d621f30 to your computer and use it in GitHub Desktop.
Changing the default SSL certificate on your OpenShift routers Raw
#!/bin/bash
OC_DEFAULT_SUBDOMAIN="openshift.example.com"
# Create a pem file with the new files
cat ${OC_DEFAULT_SUBDOMAIN}.crt ${OC_DEFAULT_SUBDOMAIN}.key ${OC_DEFAULT_SUBDOMAIN}.ca-cert > ${OC_DEFAULT_SUBDOMAIN}.combined.pem
# Create a backup, just in case
mkdir -p openshift/backup
oc export -n default secrets/router-certs sa/router clusterrolebindings/router-router-role deploymentconfig/router service/router > openshift/backup/default.router.backup.yaml
# Remove the existing one
oc delete -n default secrets/router-certs sa/router clusterrolebindings/router-router-role deploymentconfig/router service/router
# Create a new one with your certificate
oc adm router -n default --default-cert=${OC_DEFAULT_SUBDOMAIN}.combined.pem --subdomain="${name}-${namespace}.${OC_DEFAULT_SUBDOMAIN}" --service-account=router
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment