Last active
January 6, 2021 11:00
-
-
Save welshstew/d34165229910f6f7e1206f982974dcaa to your computer and use it in GitHub Desktop.
Sealed Secrets on Openshift - using the operatorhub helm installed controller
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
| 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; |
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
| 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; |
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
| kubeseal <htpass-secret.yaml >sealed-htpass-secret.yaml -n openshift-config --controller-namespace sealed-secrets --controller-name sealed-secret-controller-sealed-secrets -o yaml |
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
| 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.
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
| 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