|
64 | 64 | #define FLB_KUBE_TAG_PREFIX "kube.var.log.containers."
|
65 | 65 | #endif
|
66 | 66 |
|
| 67 | +/* |
| 68 | + * Maximum attribute length for Entity's KeyAttributes |
| 69 | + * values |
| 70 | + * https://docs.aws.amazon.com/applicationsignals/latest/APIReference/API_Service.html#:~:text=Maximum%20length%20of%201024. |
| 71 | + */ |
| 72 | +#define KEY_ATTRIBUTES_MAX_LEN 1024 |
| 73 | +#define SERVICE_NAME_SOURCE_MAX_LEN 64 |
| 74 | + |
| 75 | +/* |
| 76 | + * Configmap used for verifying whether if FluentBit is |
| 77 | + * on EKS or native Kubernetes |
| 78 | + */ |
| 79 | +#define KUBE_SYSTEM_NAMESPACE "kube-system" |
| 80 | +#define AWS_AUTH_CONFIG_MAP "aws-auth" |
| 81 | + |
| 82 | +/* |
| 83 | + * Possible platform values for Kubernetes plugin |
| 84 | + */ |
| 85 | +#define NATIVE_KUBERNETES_PLATFORM "k8s" |
| 86 | +#define EKS_PLATFORM "eks" |
| 87 | + |
67 | 88 | struct kube_meta;
|
68 | 89 |
|
| 90 | +struct service_attributes { |
| 91 | + char name[KEY_ATTRIBUTES_MAX_LEN]; |
| 92 | + int name_len; |
| 93 | + char environment[KEY_ATTRIBUTES_MAX_LEN]; |
| 94 | + int environment_len; |
| 95 | + char name_source[SERVICE_NAME_SOURCE_MAX_LEN]; |
| 96 | + int name_source_len; |
| 97 | + int fields; |
| 98 | + |
| 99 | +}; |
| 100 | + |
69 | 101 | /* Filter context */
|
70 | 102 | struct flb_kube {
|
71 | 103 | /* Configuration parameters */
|
@@ -119,6 +151,7 @@ struct flb_kube {
|
119 | 151 |
|
120 | 152 | /* Regex context to parse records */
|
121 | 153 | struct flb_regex *regex;
|
| 154 | + struct flb_regex *deploymentRegex; |
122 | 155 | struct flb_parser *parser;
|
123 | 156 |
|
124 | 157 | /* TLS CA certificate file */
|
@@ -158,6 +191,45 @@ struct flb_kube {
|
158 | 191 |
|
159 | 192 | int kube_meta_cache_ttl;
|
160 | 193 |
|
| 194 | + /* Configuration used for enabling pod to service name mapping*/ |
| 195 | + int use_pod_association; |
| 196 | + char *pod_association_host; |
| 197 | + char *pod_association_endpoint; |
| 198 | + int pod_association_port; |
| 199 | + |
| 200 | + /* |
| 201 | + * TTL is used to check how long should the mapped entry |
| 202 | + * remain in the hash table |
| 203 | + */ |
| 204 | + struct flb_hash *pod_hash_table; |
| 205 | + int pod_service_map_ttl; |
| 206 | + int pod_service_map_refresh_interval; |
| 207 | + flb_sds_t pod_service_preload_cache_path; |
| 208 | + struct flb_upstream *pod_association_upstream; |
| 209 | + /* |
| 210 | + * This connection is used for calling Kubernetes configmaps |
| 211 | + * endpoint so pod association can determine the environment. |
| 212 | + * Example: EKS or Native Kubernetes. |
| 213 | + */ |
| 214 | + char *kubernetes_api_host; |
| 215 | + int kubernetes_api_port; |
| 216 | + struct flb_upstream *kubernetes_upstream; |
| 217 | + char *platform; |
| 218 | + /* |
| 219 | + * This value is used for holding the platform config |
| 220 | + * value. Platform will be overriden with this variable |
| 221 | + * if it's set |
| 222 | + */ |
| 223 | + char *set_platform; |
| 224 | + |
| 225 | + //Agent TLS certs |
| 226 | + struct flb_tls *pod_association_tls; |
| 227 | + char *pod_association_host_server_ca_file; |
| 228 | + char *pod_association_host_client_cert_file; |
| 229 | + char *pod_association_host_client_key_file; |
| 230 | + int pod_association_host_tls_debug; |
| 231 | + int pod_association_host_tls_verify; |
| 232 | + |
161 | 233 | struct flb_tls *tls;
|
162 | 234 |
|
163 | 235 | struct flb_config *config;
|
|
0 commit comments