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

calyptia: switch to YAML for Fleet config #9698

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
4 changes: 3 additions & 1 deletion include/fluent-bit/calyptia/calyptia_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
#define CALYPTIA_ENDPOINT_TRACE "/v1/traces/%s"

#define CALYPTIA_ENDPOINT_FLEETS "/v1/fleets"
#define CALYPTIA_ENDPOINT_FLEET_CONFIG_INI "/v1/fleets/%s/config?format=ini"
#define CALYPTIA_ENDPOINT_FLEET_CONFIG_INI "/v1/fleets/%s/config?format=ini&config_format=ini"
#define CALYPTIA_ENDPOINT_FLEET_CONFIG_YAML "/v1/fleets/%s/config?format=yaml&config_format=yaml"
#define CALYPTIA_ENDPOINT_FLEET_FILES "/v1/fleets/%s/files"
#define CALYPTIA_ENDPOINT_FLEET_BY_NAME "/v1/search?project_id=%s&resource=fleet&term=%s&exact=true"

/* Storage */
#define CALYPTIA_SESSION_FILE "session.CALYPTIA"
Expand Down
2 changes: 0 additions & 2 deletions lib/cprofiles/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ if(CPROF_SYSTEM_MACOS)

if (CPACK_GENERATOR MATCHES "productbuild")
set(CPACK_SET_DESTDIR "ON")
configure_file(cpack/macos/welcome.txt.cmakein ${CMAKE_CURRENT_SOURCE_DIR}/welcome.txt)
configure_file(LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt)
find_program(CONVERTER textutil)
if (NOT CONVERTER)
Expand All @@ -363,7 +362,6 @@ if(CPROF_SYSTEM_MACOS)
execute_process(COMMAND ${CONVERTER} -convert html "${CMAKE_CURRENT_SOURCE_DIR}/README.md" -output "${CMAKE_CURRENT_SOURCE_DIR}/README.html")
endif()
set(CPACK_PACKAGE_FILE_NAME "${CMETRICS_PKG}")
set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_CURRENT_SOURCE_DIR}/welcome.txt)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt)
set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README.html)
set(CPACK_PRODUCTBUILD_IDENTIFIER "com.calyptia.${CPACK_PACKAGE_NAME}")
Expand Down
8 changes: 7 additions & 1 deletion plugins/custom_calyptia/calyptia.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ int set_fleet_input_properties(struct calyptia *ctx, struct flb_input_instance *
flb_input_set_property(fleet, "host", ctx->cloud_host);
flb_input_set_property(fleet, "port", ctx->cloud_port);
flb_input_set_property(fleet, "config_dir", ctx->fleet_config_dir);
flb_input_set_property(fleet, "fleet_config_legacy_format", ctx->fleet_config_legacy_format == 1 ? "on" : "off");

/* Set TLS properties */
flb_input_set_property(fleet, "tls", ctx->cloud_tls == 1 ? "on" : "off");
Expand Down Expand Up @@ -617,7 +618,7 @@ static int cb_calyptia_init(struct flb_custom_instance *ins,
flb_free(ctx);
return -1;
}
ctx->machine_id_auto_configured = 1;
ctx->machine_id_auto_configured = FLB_TRUE;
}

/* input collector */
Expand Down Expand Up @@ -774,6 +775,11 @@ static struct flb_config_map config_map[] = {
0, FLB_TRUE, offsetof(struct calyptia, register_retry_on_flush),
"Retry agent registration on flush if failed on init."
},
{
FLB_CONFIG_MAP_BOOL, "fleet_config_legacy_format", "true",
0, FLB_TRUE, offsetof(struct calyptia, fleet_config_legacy_format),
"If set, use legacy (TOML) format for configuration files."
},
/* EOF */
{0}
};
Expand Down
5 changes: 2 additions & 3 deletions plugins/custom_calyptia/calyptia.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#ifndef FLB_CALYPTIA_H
#define FLB_CALYPTIA_H

#include <stdbool.h>

struct calyptia {
/* config map options */
flb_sds_t api_key;
Expand Down Expand Up @@ -55,7 +53,8 @@ struct calyptia {
flb_sds_t fleet_max_http_buffer_size;
flb_sds_t fleet_interval_sec;
flb_sds_t fleet_interval_nsec;
bool register_retry_on_flush; /* retry registration on flush if failed */
int register_retry_on_flush; /* retry registration on flush if failed */
int fleet_config_legacy_format; /* Fleet config format to use: INI (true) or YAML (false) */
};

int set_fleet_input_properties(struct calyptia *ctx, struct flb_input_instance *fleet);
Expand Down
Loading
Loading