Skip to content

Commit 481171c

Browse files
committed
Add short CLI flags to common configurations
This commit adds short flags to the config flags `root`, `log-level`, `storage-driver` and `config` as well as their usage within our scripting. Signed-off-by: Sascha Grunert <[email protected]>
1 parent 3707e1f commit 481171c

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ integration: ${GINKGO} crioimage
184184
-e CI=true \
185185
-e CRIO_BINARY \
186186
-e RUN_CRITEST \
187-
-e STORAGE_OPTIONS="--storage-driver=vfs" \
187+
-e STORAGE_OPTIONS="-s=vfs" \
188188
-e TESTFLAGS \
189189
-e TEST_USERNS \
190190
-t --privileged --rm \

cmd/crio/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ func main() {
285285

286286
app.Flags = []cli.Flag{
287287
cli.StringFlag{
288-
Name: "config",
288+
Name: "config, c",
289289
Value: server.CrioConfigPath,
290290
Usage: "path to configuration file",
291291
},
@@ -320,7 +320,7 @@ func main() {
320320
Usage: "set the format used by logs ('text' (default), or 'json')",
321321
},
322322
cli.StringFlag{
323-
Name: "log-level",
323+
Name: "log-level, l",
324324
Value: "error",
325325
Usage: "log messages above specified level: debug, info, warn, error (default), fatal or panic",
326326
},
@@ -346,15 +346,15 @@ func main() {
346346
Usage: fmt.Sprintf("path to signature policy file (default: %q)", defConf.SignaturePolicyPath),
347347
},
348348
cli.StringFlag{
349-
Name: "root",
349+
Name: "root, r",
350350
Usage: fmt.Sprintf("crio root dir (default: %q)", defConf.Root),
351351
},
352352
cli.StringFlag{
353353
Name: "runroot",
354354
Usage: fmt.Sprintf("crio state dir (default: %q)", defConf.RunRoot),
355355
},
356356
cli.StringFlag{
357-
Name: "storage-driver",
357+
Name: "storage-driver, s",
358358
Usage: fmt.Sprintf("storage driver (default: %q)", defConf.Storage),
359359
},
360360
cli.StringSliceFlag{

docs/crio.8.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ crio [GLOBAL OPTIONS] config [OPTIONS]
8787

8888
**--cni-plugin-dir**="": CNI plugin binaries directory (default: "/opt/cni/bin/")
8989

90-
**--config**="": path to configuration file
90+
**--config, -c**="": path to configuration file
9191

9292
**--conmon**="": Path to the conmon binary, used for monitoring the OCI runtime. Will be searched for using $PATH if empty. (default: "")
9393

@@ -143,7 +143,7 @@ If `hooks_dir` is unset, CRI-O will currently default to `/usr/share/containers/
143143

144144
**--log-format**="": Set the format used by logs ('text' (default), or 'json') (default: "text")
145145

146-
**--log-level**="": log crio messages above specified level: debug, info, warn, error (default), fatal or panic
146+
**--log-level, -l**="": log crio messages above specified level: debug, info, warn, error (default), fatal or panic
147147

148148
**--log-dir**="": default log directory where all logs will go unless directly specified by the kubelet
149149

@@ -167,7 +167,7 @@ If `hooks_dir` is unset, CRI-O will currently default to `/usr/share/containers/
167167

168168
**--read-only**=**true**|**false**: Run all containers in read-only mode (default: false). Automatically mount tmpfs on `/run`, `/tmp` and `/var/tmp`.
169169

170-
**--root**="": The crio root dir (default: "/var/lib/containers/storage")
170+
**--root, -r**="": The crio root dir (default: "/var/lib/containers/storage")
171171

172172
**--registry**="": Registry host which will be prepended to unqualified images, can be specified multiple times
173173

@@ -181,7 +181,7 @@ If `hooks_dir` is unset, CRI-O will currently default to `/usr/share/containers/
181181

182182
**--signature-policy**="": Path to the signature policy json file (default: "", to use the system-wide default)
183183

184-
**--storage-driver**: OCI storage driver (default: "overlay")
184+
**--storage-driver, -s**: OCI storage driver (default: "overlay")
185185

186186
**--storage-opt**: OCI storage driver option (no default)
187187

test/command.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
load helpers
44

55
@test "crio commands" {
6-
run ${CRIO_BINARY_PATH} --config /dev/null config > /dev/null
6+
run ${CRIO_BINARY_PATH} -c /dev/null config > /dev/null
77
echo "$output"
88
[ "$status" -eq 0 ]
99
run ${CRIO_BINARY_PATH} badoption > /dev/null

test/helpers.bash

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ case "$(stat -f -c %T ${TESTDIR})" in
110110
aufs)
111111
# None of device mapper, overlay, or aufs can be used dependably over aufs, and of course btrfs and zfs can't,
112112
# and we have to explicitly specify the "vfs" driver in order to use it, so do that now.
113-
STORAGE_OPTIONS=${STORAGE_OPTIONS:---storage-driver vfs}
113+
STORAGE_OPTIONS=${STORAGE_OPTIONS:--s vfs}
114114
;;
115115
esac
116116

@@ -260,7 +260,7 @@ function setup_crio() {
260260
"$COPYIMG_BINARY" --root "$TESTDIR/crio" $STORAGE_OPTIONS --runroot "$TESTDIR/crio-run" --image-name=quay.io/crio/image-volume-test:latest --import-from=dir:"$ARTIFACTS_PATH"/image-volume-test-image --signature-policy="$INTEGRATION_ROOT"/policy.json
261261
"$COPYIMG_BINARY" --root "$TESTDIR/crio" $STORAGE_OPTIONS --runroot "$TESTDIR/crio-run" --image-name=quay.io/crio/busybox:latest --import-from=dir:"$ARTIFACTS_PATH"/busybox-image --signature-policy="$INTEGRATION_ROOT"/policy.json
262262
"$COPYIMG_BINARY" --root "$TESTDIR/crio" $STORAGE_OPTIONS --runroot "$TESTDIR/crio-run" --image-name=quay.io/crio/stderr-test:latest --import-from=dir:"$ARTIFACTS_PATH"/stderr-test --signature-policy="$INTEGRATION_ROOT"/policy.json
263-
"$CRIO_BINARY_PATH" ${DEFAULT_MOUNTS_OPTS} ${HOOKS_OPTS} --default-capabilities "$capabilities" --conmon "$TESTDIR/conmon" --listen "$CRIO_SOCKET" --stream-port "$((STREAM_PORT + BATS_TEST_NUMBER))" --conmon-cgroup "$CONMON_CGROUP" --cgroup-manager "$CGROUP_MANAGER" --default-mounts-file "$TESTDIR/containers/mounts.conf" --registry "quay.io" --registry "docker.io" --default-runtime $DEFAULT_RUNTIME --runtimes "$RUNTIME_NAME:$RUNTIME_BINARY:$RUNTIME_ROOT" --root "$TESTDIR/crio" --runroot "$TESTDIR/crio-run" $STORAGE_OPTIONS --seccomp-profile "$seccomp" --apparmor-profile "$apparmor" --cni-config-dir "$CRIO_CNI_CONFIG" --cni-plugin-dir "$CRIO_CNI_PLUGIN" --signature-policy "$INTEGRATION_ROOT"/policy.json --image-volumes "$IMAGE_VOLUMES" --pids-limit "$PIDS_LIMIT" --log-size-max "$LOG_SIZE_MAX_LIMIT" $DEVICES $ULIMITS --uid-mappings "$UID_MAPPINGS" --gid-mappings "$GID_MAPPINGS" --default-sysctls "$TEST_SYSCTL" $OVERRIDE_OPTIONS --config /dev/null config >$CRIO_CONFIG
263+
"$CRIO_BINARY_PATH" ${DEFAULT_MOUNTS_OPTS} ${HOOKS_OPTS} --default-capabilities "$capabilities" --conmon "$TESTDIR/conmon" --listen "$CRIO_SOCKET" --stream-port "$((STREAM_PORT + BATS_TEST_NUMBER))" --conmon-cgroup "$CONMON_CGROUP" --cgroup-manager "$CGROUP_MANAGER" --default-mounts-file "$TESTDIR/containers/mounts.conf" --registry "quay.io" --registry "docker.io" --default-runtime $DEFAULT_RUNTIME --runtimes "$RUNTIME_NAME:$RUNTIME_BINARY:$RUNTIME_ROOT" -r "$TESTDIR/crio" --runroot "$TESTDIR/crio-run" $STORAGE_OPTIONS --seccomp-profile "$seccomp" --apparmor-profile "$apparmor" --cni-config-dir "$CRIO_CNI_CONFIG" --cni-plugin-dir "$CRIO_CNI_PLUGIN" --signature-policy "$INTEGRATION_ROOT"/policy.json --image-volumes "$IMAGE_VOLUMES" --pids-limit "$PIDS_LIMIT" --log-size-max "$LOG_SIZE_MAX_LIMIT" $DEVICES $ULIMITS --uid-mappings "$UID_MAPPINGS" --gid-mappings "$GID_MAPPINGS" --default-sysctls "$TEST_SYSCTL" $OVERRIDE_OPTIONS --config /dev/null config >$CRIO_CONFIG
264264
sed -r -e 's/^(#)?root =/root =/g' -e 's/^(#)?runroot =/runroot =/g' -e 's/^(#)?storage_driver =/storage_driver =/g' -e '/^(#)?storage_option = (\[)?[ \t]*$/,/^#?$/s/^(#)?//g' -e '/^(#)?registries = (\[)?[ \t]*$/,/^#?$/s/^(#)?//g' -e '/^(#)?default_ulimits = (\[)?[ \t]*$/,/^#?$/s/^(#)?//g' -i $CRIO_CONFIG
265265
sed -ie 's;\(container_exits_dir =\) \(.*\);\1 "'$CONTAINER_EXITS_DIR'";g' $CRIO_CONFIG
266266
sed -ie 's;\(container_attach_socket_dir =\) \(.*\);\1 "'$CONTAINER_ATTACH_SOCKET_DIR'";g' $CRIO_CONFIG
@@ -308,8 +308,8 @@ function start_crio() {
308308
setup_crio "$@"
309309
"$CRIO_BINARY_PATH" \
310310
--default-mounts-file "$TESTDIR/containers/mounts.conf" \
311-
--log-level debug \
312-
--config "$CRIO_CONFIG" \
311+
-l debug \
312+
-c "$CRIO_CONFIG" \
313313
&> >(tee "$CRIO_LOG") & CRIO_PID=$!
314314
wait_until_reachable
315315
pull_test_containers
@@ -318,7 +318,7 @@ function start_crio() {
318318
# Start crio with journald logging
319319
function start_crio_journald() {
320320
setup_crio "$@"
321-
"$CRIO_BINARY_PATH" --default-mounts-file "$TESTDIR/containers/mounts.conf" --log-level debug --log-journald --config "$CRIO_CONFIG" & CRIO_PID=$!
321+
"$CRIO_BINARY_PATH" --default-mounts-file "$TESTDIR/containers/mounts.conf" -l debug --log-journald -c "$CRIO_CONFIG" & CRIO_PID=$!
322322
wait_until_reachable
323323
pull_test_containers
324324
}

0 commit comments

Comments
 (0)