Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F31787157
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
Bstorm
Apr 29 2020, 7:13 PM
2020-04-29 19:13:01 (UTC+0)
Size
3 KB
Referenced Files
None
Subscribers
None
raw.txt
View Options
#!/bin/bash
# Run this script with your root/cluster admin account as appropriate.
# This will fix the dumps mounts for all existing tools.
set -Eeuo pipefail
function check-ns(){
ns=$1
preset=$(kubectl -n "$ns" get podpresets mount-toolforge-vols -o yaml)
if [[ $preset =~ ^.*/mnt/nfs/.*$ ]]
then
return 1
else
return 0
fi
}
declare -a namespaces
readarray -t namespaces < <(kubectl get ns -l tenancy=tool --no-headers=true -o custom-columns=:metadata.name)
for ns in "${namespaces[@]}"
do
echo "Starting for $ns"
if check-ns "$ns"; then
echo "Deleting preset for $ns"
kubectl -n "$ns" delete podpresets mount-toolforge-vols
cat <<EOF | kubectl apply -f -
apiVersion: settings.k8s.io/v1alpha1
kind: PodPreset
metadata:
name: mount-toolforge-vols
namespace: tool-test
spec:
env:
- name: HOME
value: /data/project/test
selector:
matchLabels:
toolforge: tool
volumeMounts:
- mountPath: /public/dumps
name: dumps
readOnly: true
- mountPath: /mnt/nfs/dumps-labstore1007.wikimedia.org
name: dumpsrc1
readOnly: true
- mountPath: /data/project
name: home
- mountPath: /etc/wmcs-project
name: wmcs-project
readOnly: true
- mountPath: /data/scratch
name: scratch
- mountPath: /etc/ldap.conf
name: etcldap-conf
readOnly: true
- mountPath: /etc/ldap.yaml
name: etcldap-yaml
readOnly: true
- mountPath: /etc/novaobserver.yaml
name: etcnovaobserver-yaml
readOnly: true
- mountPath: /var/lib/sss/pipes
name: sssd-pipes
volumes:
- hostPath:
path: /public/dumps
type: Directory
name: dumps
- hostPath:
path: /mnt/nfs/dumps-labstore1007.wikimedia.org
type: Directory
name: dumpsrc1
- hostPath:
path: /mnt/nfs/dumps-labstore1006.wikimedia.org
type: Directory
name: dumpsrc2
- hostPath:
path: /data/project
type: Directory
name: home
- hostPath:
path: /etc/wmcs-project
type: File
name: wmcs-project
- hostPath:
path: /data/scratch
type: Directory
name: scratch
- hostPath:
path: /etc/ldap.conf
type: File
name: etcldap-conf
- hostPath:
path: /etc/ldap.yaml
type: File
name: etcldap-yaml
- hostPath:
path: /etc/novaobserver.yaml
type: File
name: etcnovaobserver-yaml
- hostPath:
path: /var/lib/sss/pipes
type: Directory
name: sssd-pipes
EOF
echo "created new preset for $ns"
else
echo "skipping $ns preset -- already updated"
fi
cat <<EOF | kubectl patch psp "${ns}-psp" --patch -
spec:
allowedHostPaths:
- pathPrefix: /var/lib/sss/pipes
- pathPrefix: /data/project
- pathPrefix: /data/scratch
- pathPrefix: /public/dumps
readOnly: true
- pathPrefix: /mnt/nfs
readOnly: true
- pathPrefix: /etc/wmcs-project
readOnly: true
- pathPrefix: /etc/ldap.yaml
readOnly: true
- pathPrefix: /etc/novaobserver.yaml
readOnly: true
- pathPrefix: /etc/ldap.conf
readOnly: true
EOF
echo "Finished $ns"
done
echo "*********************"
echo "Done!"
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8394470
Default Alt Text
raw.txt (3 KB)
Attached To
Mode
P11086 rewrite-psp-preset.sh
Attached
Detach File
Event Timeline
Log In to Comment