Skip to content

Instantly share code, notes, and snippets.

@welshstew
Last active January 6, 2021 11:00
Show Gist options
  • Save welshstew/d34165229910f6f7e1206f982974dcaa to your computer and use it in GitHub Desktop.
Save welshstew/d34165229910f6f7e1206f982974dcaa to your computer and use it in GitHub Desktop.
Sealed Secrets on Openshift - using the operatorhub helm installed controller
htpasswd -c htpasswd admin
cat userpasswords.csv | while read line; do
USERNAME=$(echo $line | awk -F ',' '{print $1}');
PASSWORD=$(echo $line | awk -F ',' '{print $2}');
echo $PASSWORD | htpasswd -i ./htpasswd $USERNAME;
done;
cat users.csv | while read line; do HELLO=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16}; echo); echo ${line},$HELLO >> userpasswords.csv; done;
kubeseal <htpass-secret.yaml >sealed-htpass-secret.yaml -n openshift-config --controller-namespace sealed-secrets --controller-name sealed-secret-controller-sealed-secrets -o yaml
cat users.csv | while read line; do USERNAME=$(echo $line | awk -F ',' '{print $1}'); if [[ $line == *"redhat"* ]]; then oc adm policy add-cluster-role-to-user admin $USERNAME; else oc adm policy add-cluster-role-to-user edit $USERNAME; fi; done;
oc adm policy add-cluster-role-to-user admin admin
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
admin
person1@redhat.com
person2@redhat.com
some@tutanota.com
other@tutanota.com
email@tutanota.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment