#! /bin/sh | |
set -e -o pipefail | |
pod=$(kubectl get pods -lname=samba -ojsonpath='{.items[].metadata.name}') | |
kubectl exec -c master -ti "$pod" -- pdbedit --configfile=/var/lib/samba/smb.conf "$@" | |
kubectl cp "$pod":/var/lib/samba/private/smbpasswd smbpasswd | |
kubectl create secret generic samba-smbpasswd --save-config --dry-run=client --from-file=smbpasswd=smbpasswd -oyaml | kubectl apply -f - |