111 lines
5.0 KiB
Diff
111 lines
5.0 KiB
Diff
|
|
From 4e6473570e3a5cd59585818216218a7a512790a5 Mon Sep 17 00:00:00 2001
|
||
|
|
From: zhongtao <zhongtao17@huawei.com>
|
||
|
|
Date: Mon, 4 Sep 2023 08:45:55 +0000
|
||
|
|
Subject: [PATCH 26/33] !2169 using macros to isolate isulad's enable_plugin
|
||
|
|
configuration option * using macros to isolate isulad's enable_plugin
|
||
|
|
configuration option
|
||
|
|
|
||
|
|
---
|
||
|
|
src/cmd/isulad/isulad_commands.h | 15 +++++++++++----
|
||
|
|
src/common/constants.h | 2 ++
|
||
|
|
src/daemon/config/isulad_config.c | 4 ++++
|
||
|
|
src/daemon/config/isulad_config.h | 2 ++
|
||
|
|
4 files changed, 19 insertions(+), 4 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/src/cmd/isulad/isulad_commands.h b/src/cmd/isulad/isulad_commands.h
|
||
|
|
index 6a8220cc..05d3551c 100644
|
||
|
|
--- a/src/cmd/isulad/isulad_commands.h
|
||
|
|
+++ b/src/cmd/isulad/isulad_commands.h
|
||
|
|
@@ -78,6 +78,16 @@ int command_default_ulimit_append(command_option_t *option, const char *arg);
|
||
|
|
#define USERNS_REMAP_OPT(cmdargs)
|
||
|
|
#endif
|
||
|
|
|
||
|
|
+#ifdef ENABLE_PLUGIN
|
||
|
|
+#define PLUGINS_OPT(cmdargs) \
|
||
|
|
+ { CMD_OPT_TYPE_STRING_DUP, \
|
||
|
|
+ false, "enable-plugins", 0, &(cmdargs)->json_confs->enable_plugins, \
|
||
|
|
+ "Enable plugins for all containers", NULL \
|
||
|
|
+ },
|
||
|
|
+#else
|
||
|
|
+#define PLUGINS_OPT(cmdargs)
|
||
|
|
+#endif
|
||
|
|
+
|
||
|
|
#ifdef ENABLE_GRPC_REMOTE_CONNECT
|
||
|
|
#define ISULAD_TLS_OPTIONS(cmdargs) \
|
||
|
|
{ CMD_OPT_TYPE_STRING_DUP, \
|
||
|
|
@@ -326,10 +336,7 @@ int command_default_ulimit_append(command_option_t *option, const char *arg);
|
||
|
|
false, "cpu-rt-runtime", 0, &(cmdargs)->json_confs->cpu_rt_runtime, \
|
||
|
|
"Limit CPU real-time runtime in microseconds for all containers", command_convert_llong \
|
||
|
|
}, \
|
||
|
|
- { CMD_OPT_TYPE_STRING_DUP, \
|
||
|
|
- false, "enable-plugins", 0, &(cmdargs)->json_confs->enable_plugins, \
|
||
|
|
- "Enable plugins for all containers", NULL \
|
||
|
|
- }, \
|
||
|
|
+ PLUGINS_OPT(cmdargs) \
|
||
|
|
{ CMD_OPT_TYPE_CALLBACK, \
|
||
|
|
false, "cri-runtime", 0, (cmdargs), \
|
||
|
|
"CRI runtime class transform", server_callback_cri_runtime \
|
||
|
|
diff --git a/src/common/constants.h b/src/common/constants.h
|
||
|
|
index c0417263..f98fb930 100644
|
||
|
|
--- a/src/common/constants.h
|
||
|
|
+++ b/src/common/constants.h
|
||
|
|
@@ -134,9 +134,11 @@ extern "C" {
|
||
|
|
|
||
|
|
#define AUTH_PLUGIN "authz-broker"
|
||
|
|
|
||
|
|
+#ifdef ENABLE_PLUGIN
|
||
|
|
#define ISULAD_ENABLE_PLUGINS "ISULAD_ENABLE_PLUGINS"
|
||
|
|
#define ISULAD_ENABLE_PLUGINS_SEPERATOR ","
|
||
|
|
#define ISULAD_ENABLE_PLUGINS_SEPERATOR_CHAR ','
|
||
|
|
+#endif
|
||
|
|
|
||
|
|
#ifdef ENABLE_NETWORK
|
||
|
|
#define ISULAD_CNI_NETWORK_CONF_FILE_PRE "isulacni-"
|
||
|
|
diff --git a/src/daemon/config/isulad_config.c b/src/daemon/config/isulad_config.c
|
||
|
|
index f600f0cf..72722c30 100644
|
||
|
|
--- a/src/daemon/config/isulad_config.c
|
||
|
|
+++ b/src/daemon/config/isulad_config.c
|
||
|
|
@@ -1253,6 +1253,7 @@ out:
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
+#ifdef ENABLE_PLUGIN
|
||
|
|
char *conf_get_enable_plugins(void)
|
||
|
|
{
|
||
|
|
struct service_arguments *conf = NULL;
|
||
|
|
@@ -1274,6 +1275,7 @@ out:
|
||
|
|
(void)isulad_server_conf_unlock();
|
||
|
|
return plugins;
|
||
|
|
}
|
||
|
|
+#endif
|
||
|
|
|
||
|
|
#ifdef ENABLE_USERNS_REMAP
|
||
|
|
char *conf_get_isulad_userns_remap(void)
|
||
|
|
@@ -1739,7 +1741,9 @@ int merge_json_confs_into_global(struct service_arguments *args)
|
||
|
|
override_string_value(&args->json_confs->pidfile, &tmp_json_confs->pidfile);
|
||
|
|
// iSulad runtime execution options
|
||
|
|
override_string_value(&args->json_confs->hook_spec, &tmp_json_confs->hook_spec);
|
||
|
|
+#ifdef ENABLE_PLUGIN
|
||
|
|
override_string_value(&args->json_confs->enable_plugins, &tmp_json_confs->enable_plugins);
|
||
|
|
+#endif
|
||
|
|
#ifdef ENABLE_USERNS_REMAP
|
||
|
|
override_string_value(&args->json_confs->userns_remap, &tmp_json_confs->userns_remap);
|
||
|
|
#endif
|
||
|
|
diff --git a/src/daemon/config/isulad_config.h b/src/daemon/config/isulad_config.h
|
||
|
|
index 4fe1acdc..459ea331 100644
|
||
|
|
--- a/src/daemon/config/isulad_config.h
|
||
|
|
+++ b/src/daemon/config/isulad_config.h
|
||
|
|
@@ -60,7 +60,9 @@ int conf_get_container_log_opts(isulad_daemon_configs_container_log **opts);
|
||
|
|
|
||
|
|
char *conf_get_isulad_log_file(void);
|
||
|
|
char *conf_get_engine_log_file(void);
|
||
|
|
+#ifdef ENABLE_PLUGIN
|
||
|
|
char *conf_get_enable_plugins(void);
|
||
|
|
+#endif
|
||
|
|
#ifdef ENABLE_USERNS_REMAP
|
||
|
|
char *conf_get_isulad_userns_remap(void);
|
||
|
|
#endif
|
||
|
|
--
|
||
|
|
2.40.1
|
||
|
|
|