Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PVs that don't have dbadmin write access #53

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions docker-vertica/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,25 @@ start_cron(){
# it starts up empty and must be populated
copy_config_files() {
cp -r /home/dbadmin/logrotate/* /opt/vertica/config/
chown -R dbadmin:verticadba /opt/vertica/config/logrotate
rm -rf /home/dbadmin/logrotate

mkdir -p /opt/vertica/config/licensing
cp -r /home/dbadmin/licensing/ce/* /opt/vertica/config/licensing
chown -R dbadmin:verticadba /opt/vertica/config/licensing
chmod -R 0755 /opt/vertica/config/licensing
}

# Ensure all PV paths are owned by dbadmin. This is done for some PVs that
# start with restrictive ownership.
ensure_path_is_owned_by_dbadmin() {
# -z is to needed in case input arg is empty
[ -z "$1" ] || [ "$(stat -c "%U" "$1")" == "dbadmin" ] || sudo chown -R dbadmin:verticadba "$1"
}

start_cron
ensure_path_is_owned_by_dbadmin /opt/vertica/config
ensure_path_is_owned_by_dbadmin /opt/vertica/log
ensure_path_is_owned_by_dbadmin $DATA_PATH
ensure_path_is_owned_by_dbadmin $DEPOT_PATH
copy_config_files

echo "Vertica container is now running"
Expand Down
6 changes: 4 additions & 2 deletions pkg/controllers/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ func makeServerContainer(vdb *vapi.VerticaDB, sc *vapi.Subcluster) corev1.Contai
},
Env: []corev1.EnvVar{
{Name: "POD_IP", ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{FieldPath: "status.podIP"},
}},
FieldRef: &corev1.ObjectFieldSelector{FieldPath: "status.podIP"}},
},
{Name: "DATA_PATH", Value: vdb.Spec.Local.DataPath},
{Name: "DEPOT_PATH", Value: vdb.Spec.Local.DepotPath},
},
VolumeMounts: buildVolumeMounts(vdb),
}
Expand Down