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

Use sed as a stream editor and redirect to file #1069

Merged
merged 5 commits into from
Jul 9, 2020
Merged
Changes from 4 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
16 changes: 11 additions & 5 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,17 @@ log_in_json info "Copying CNI plugin binary and config file ... "

install aws-cni "$HOST_CNI_BIN_PATH"

sed -i s~__VETHPREFIX__~"${AWS_VPC_K8S_CNI_VETHPREFIX}"~g 10-aws.conflist
sed -i s~__MTU__~"${AWS_VPC_ENI_MTU}"~g 10-aws.conflist
sed -i s~__PLUGINLOGFILE__~"${AWS_VPC_K8S_PLUGIN_LOG_FILE}"~g 10-aws.conflist
sed -i s~__PLUGINLOGLEVEL__~"${AWS_VPC_K8S_PLUGIN_LOG_LEVEL}"~g 10-aws.conflist
cp 10-aws.conflist "$HOST_CNI_CONFDIR_PATH"
# create a temporary file to be manipulated by sed (ergh).
# this enables you to mount your own config file from a configmap that is read only
temp_config_file=$(mktemp)
cp 10-aws.conflist "$temp_config_file"
willejs marked this conversation as resolved.
Show resolved Hide resolved
sed -i s~__VETHPREFIX__~"${AWS_VPC_K8S_CNI_VETHPREFIX}"~g "$temp_config_file"
sed -i s~__MTU__~"${AWS_VPC_ENI_MTU}"~g "$temp_config_file"
sed -i s~__PLUGINLOGFILE__~"${AWS_VPC_K8S_PLUGIN_LOG_FILE}"~g "$temp_config_file"
sed -i s~__PLUGINLOGLEVEL__~"${AWS_VPC_K8S_PLUGIN_LOG_LEVEL}"~g "$temp_config_file"
cp "$temp_config_file" "$HOST_CNI_CONFDIR_PATH"
# clean up temp file
rm "$temp_config_file"
willejs marked this conversation as resolved.
Show resolved Hide resolved

log_in_json info "Successfully copied CNI plugin binary and config file."

Expand Down