Skip to content
Draft
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
1 change: 1 addition & 0 deletions helm/flare-operator/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
metricsPort: 9090
# Default values for flare-operator.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
Expand Down
22 changes: 15 additions & 7 deletions src/flared/flared.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#endif

#ifdef ENABLE_K8S_OPERATOR
# include <cerrno>
# include <cstdlib>
#endif

Expand Down Expand Up @@ -220,13 +221,20 @@ int flared::startup(int argc, char **argv) {
const char* op_host = std::getenv("FLARE_OPERATOR_HOST");
const char* op_port = std::getenv("FLARE_OPERATOR_PORT");
if (op_host != NULL && op_port != NULL) {
k8s_index_servers.clear();
cluster::index_server s;
s.index_server_name = string(op_host);
s.index_server_port = atoi(op_port);
k8s_index_servers.push_back(s);
log_notice("K8s operator mode: using operator at %s:%d as index server",
op_host, atoi(op_port));
char* endptr = nullptr;
errno = 0;
long port_val = strtol(op_port, &endptr, 10);
if (errno != 0 || endptr == op_port || *endptr != '\0' || port_val < 1 || port_val > 65535) {
log_warning("K8s operator mode: invalid FLARE_OPERATOR_PORT value '%s', ignoring operator override", op_port);
} else {
k8s_index_servers.clear();
cluster::index_server s;
s.index_server_name = string(op_host);
s.index_server_port = static_cast<int>(port_val);
k8s_index_servers.push_back(s);
log_notice("K8s operator mode: using operator at %s:%d as index server",
op_host, static_cast<int>(port_val));
}
}
if (this->_cluster->startup_node(k8s_index_servers,
ini_option_object().get_proxy_prior_netmask()) < 0) {
Expand Down