Created
April 22, 2019 07:14
-
-
Save surajnarwade/246997be066ba285fe327d51efa6f325 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HTPASSWD_FILE="./htpass" | |
USERNAME="suraj1" | |
USERPASS="developer" | |
HTPASSWD_SECRET="htpasswd-secret1" | |
htpasswd -cb $HTPASSWD_FILE $USERNAME $USERPASS | |
oc get secret $HTPASSWD_SECRET -n openshift-config &> /dev/null | |
oc create secret generic ${HTPASSWD_SECRET} --from-file=htpasswd=${HTPASSWD_FILE} -n openshift-config | |
oc apply -f - <<EOF | |
apiVersion: config.openshift.io/v1 | |
kind: OAuth | |
metadata: | |
name: cluster | |
spec: | |
identityProviders: | |
- name: htpassidp1 | |
challenge: true | |
login: true | |
mappingMethod: claim | |
type: HTPasswd | |
htpasswd: | |
fileData: | |
name: ${HTPASSWD_SECRET} | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment