Skip to content

Commit 4d5c685

Browse files
committed
Merge branch 'aditya/fluentbit-sidecar' into 'main'
FluentBit logging sidecar See merge request weblogic-cloud/weblogic-kubernetes-operator!4538
2 parents 832157d + fa43805 commit 4d5c685

File tree

19 files changed

+1075
-16
lines changed

19 files changed

+1075
-16
lines changed

common/src/main/java/oracle/kubernetes/common/logging/MessageKeys.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017, 2023, Oracle and/or its affiliates.
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.kubernetes.common.logging;
@@ -170,6 +170,8 @@ public class MessageKeys {
170170
public static final String PVC_IS_BOUND = "WLSKO-0237";
171171
public static final String WAITING_FOR_PVC_TO_BIND = "WLSKO-0238";
172172
public static final String PVC_NOT_BOUND_ERROR = "WLSKO-0239";
173+
public static final String FLUENTBIT_CONFIGMAP_CREATED = "WLSKO-0240";
174+
public static final String FLUENTBIT_CONFIGMAP_REPLACED = "WLSKO-0241";
173175

174176
// domain status messages
175177
public static final String MAKE_RIGHT_WILL_RETRY = "WLSDO-0000";

common/src/main/resources/Operator.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ WLSKO-0236=Persistent volume Claim with name {0} already exists for WebLogic dom
183183
WLSKO-0237=Persistent volume Claim ''{0}'' is bound.
184184
WLSKO-0238=Waiting for Persistent volume Claim ''{0}'' to be bound.
185185
WLSKO-0239=PersistentVolumeClaim ''{0}'' is not bound; the status phase is ''{1}''.
186+
WLSKO-0240=Fluentbit configmap created.
187+
WLSKO-0241=Fluentbit configmap replaced.
186188

187189
# Domain status messages
188190

documentation/domains/Domain.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@
415415
"FromModel"
416416
]
417417
},
418+
"fluentbitSpecification": {
419+
"description": "Automatic fluent-bit sidecar injection. If specified, the operator will deploy a sidecar container alongside each WebLogic Server instance that runs the fluent-bit, Optionally, the introspector job pod can be enabled to deploy with the fluent-bit sidecar container. WebLogic Server instances that are already running when the `fluentbitSpecification` field is created or deleted, will not be affected until they are restarted. When any given server is restarted for another reason, such as a change to the `restartVersion`, then the newly created pod will have the fluent-bit sidecar or not, as appropriate",
420+
"$ref": "#/definitions/FluentbitSpecification"
421+
},
418422
"httpAccessLogInLogHome": {
419423
"default": true,
420424
"description": "Specifies whether the server HTTP access log files will be written to the same directory specified in `logHome`. Otherwise, server HTTP access log files will be written to the directory configured in the WebLogic domain configuration. Defaults to true.",
@@ -595,6 +599,68 @@
595599
}
596600
}
597601
},
602+
"FluentbitSpecification": {
603+
"type": "object",
604+
"properties": {
605+
"image": {
606+
"default": "fluent/fluentd-kubernetes-daemonset:v1.16.1-debian-elasticsearch7-1.2",
607+
"description": "The Fluentbit container image name. Defaults to fluent/fluentd-kubernetes-daemonset:v1.16.1-debian-elasticsearch7-1.2",
608+
"type": "string"
609+
},
610+
"imagePullPolicy": {
611+
"description": "The image pull policy for the Fluentbit sidecar container image. Legal values are Always, Never, and IfNotPresent. Defaults to Always if image ends in :latest; IfNotPresent, otherwise.",
612+
"type": "string"
613+
},
614+
"elasticSearchCredentials": {
615+
"description": "Fluentbit elastic search credentials. A Kubernetes secret in the same namespace of the domain. It must contains 4 keys: elasticsearchhost - ElasticSearch Host Service Address, elasticsearchport - Elastic Search Service Port, elasticsearchuser - Elastic Search Service User Name, elasticsearchpassword - Elastic Search User Password",
616+
"type": "string"
617+
},
618+
"parserConfiguration": {
619+
"description": "The Fluentbit parser configuration text, specify your own custom fluentbit configuration.",
620+
"type": "string"
621+
},
622+
"resources": {
623+
"description": "Memory and CPU minimum requirements and limits for the fluentbit container. See `kubectl explain pods.spec.containers.resources`.",
624+
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.13.5/_definitions.json#/definitions/io.k8s.api.core.v1.ResourceRequirements"
625+
},
626+
"containerArgs": {
627+
"description": "(Optional) The Fluentbit sidecar container spec\u0027s args. Default is: [ -c, /etc/fluent-bit.conf ] if not specified",
628+
"type": "array",
629+
"items": {
630+
"type": "string"
631+
}
632+
},
633+
"fluentbitConfiguration": {
634+
"description": "The Fluentbit configuration text, specify your own custom fluentbit configuration.",
635+
"type": "string"
636+
},
637+
"watchIntrospectorLogs": {
638+
"description": "Fluentbit will watch introspector logs",
639+
"type": "boolean"
640+
},
641+
"env": {
642+
"description": "A list of environment variables to set in the fluentbit container. See `kubectl explain pods.spec.containers.env`.",
643+
"type": "array",
644+
"items": {
645+
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.13.5/_definitions.json#/definitions/io.k8s.api.core.v1.EnvVar"
646+
}
647+
},
648+
"containerCommand": {
649+
"description": "(Optional) The Fluentbit sidecar container spec\u0027s command. Default is not set if not specified",
650+
"type": "array",
651+
"items": {
652+
"type": "string"
653+
}
654+
},
655+
"volumeMounts": {
656+
"description": "Volume mounts for fluentbit container",
657+
"type": "array",
658+
"items": {
659+
"$ref": "https://github.com/garethr/kubernetes-json-schema/blob/master/v1.13.5/_definitions.json#/definitions/io.k8s.api.core.v1.VolumeMount"
660+
}
661+
}
662+
}
663+
},
598664
"FluentdSpecification": {
599665
"type": "object",
600666
"properties": {

documentation/domains/Domain.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The specification of the operation of the WebLogic domain. Required.
2525
| `domainUID` | string | Domain unique identifier. It is recommended that this value be unique to assist in future work to identify related domains in active-passive scenarios across data centers; however, it is only required that this value be unique within the namespace, similarly to the names of Kubernetes resources. This value is distinct and need not match the domain name from the WebLogic domain configuration. Defaults to the value of `metadata.name`. |
2626
| `failureRetryIntervalSeconds` | integer | The wait time in seconds before the start of the next retry after a Severe failure. Defaults to 120. |
2727
| `failureRetryLimitMinutes` | integer | The time in minutes before the operator will stop retrying Severe failures. Defaults to 1440. |
28+
| `fluentbitSpecification` | [Fluentbit Specification](#fluentbit-specification) | Automatic fluent-bit sidecar injection. If specified, the operator will deploy a sidecar container alongside each WebLogic Server instance that runs the fluent-bit, Optionally, the introspector job pod can be enabled to deploy with the fluent-bit sidecar container. WebLogic Server instances that are already running when the `fluentbitSpecification` field is created or deleted, will not be affected until they are restarted. When any given server is restarted for another reason, such as a change to the `restartVersion`, then the newly created pod will have the fluent-bit sidecar or not, as appropriate |
2829
| `fluentdSpecification` | [Fluentd Specification](#fluentd-specification) | Automatic fluentd sidecar injection. If specified, the operator will deploy a sidecar container alongside each WebLogic Server instance that runs the fluentd, Optionally, the introspector job pod can be enabled to deploy with the fluentd sidecar container. WebLogic Server instances that are already running when the `fluentdSpecification` field is created or deleted, will not be affected until they are restarted. When any given server is restarted for another reason, such as a change to the `restartVersion`, then the newly created pod will have the fluentd sidecar or not, as appropriate |
2930
| `httpAccessLogInLogHome` | Boolean | Specifies whether the server HTTP access log files will be written to the same directory specified in `logHome`. Otherwise, server HTTP access log files will be written to the directory configured in the WebLogic domain configuration. Defaults to true. |
3031
| `image` | string | The WebLogic Server image; required when `domainHomeSourceType` is Image or FromModel; otherwise, defaults to container-registry.oracle.com/middleware/weblogic:12.2.1.4. |
@@ -92,6 +93,22 @@ The current status of the operation of the WebLogic domain. Updated automaticall
9293
| `overridesConfigMap` | string | The name of the ConfigMap for WebLogic configuration overrides. |
9394
| `secrets` | Array of string | A list of names of the Secrets for WebLogic configuration overrides or model. |
9495

96+
### Fluentbit Specification
97+
98+
| Name | Type | Description |
99+
| --- | --- | --- |
100+
| `containerArgs` | Array of string | (Optional) The Fluentbit sidecar container spec's args. Default is: [ -c, /etc/fluent-bit.conf ] if not specified |
101+
| `containerCommand` | Array of string | (Optional) The Fluentbit sidecar container spec's command. Default is not set if not specified |
102+
| `elasticSearchCredentials` | string | Fluentbit elastic search credentials. A Kubernetes secret in the same namespace of the domain. It must contains 4 keys: elasticsearchhost - ElasticSearch Host Service Address, elasticsearchport - Elastic Search Service Port, elasticsearchuser - Elastic Search Service User Name, elasticsearchpassword - Elastic Search User Password |
103+
| `env` | Array of [Env Var](k8s1.13.5.md#env-var) | A list of environment variables to set in the fluentbit container. See `kubectl explain pods.spec.containers.env`. |
104+
| `fluentbitConfiguration` | string | The Fluentbit configuration text, specify your own custom fluentbit configuration. |
105+
| `image` | string | The Fluentbit container image name. Defaults to fluent/fluentd-kubernetes-daemonset:v1.16.1-debian-elasticsearch7-1.2 |
106+
| `imagePullPolicy` | string | The image pull policy for the Fluentbit sidecar container image. Legal values are Always, Never, and IfNotPresent. Defaults to Always if image ends in :latest; IfNotPresent, otherwise. |
107+
| `parserConfiguration` | string | The Fluentbit parser configuration text, specify your own custom fluentbit configuration. |
108+
| `resources` | [Resource Requirements](k8s1.13.5.md#resource-requirements) | Memory and CPU minimum requirements and limits for the fluentbit container. See `kubectl explain pods.spec.containers.resources`. |
109+
| `volumeMounts` | Array of [Volume Mount](k8s1.13.5.md#volume-mount) | Volume mounts for fluentbit container |
110+
| `watchIntrospectorLogs` | Boolean | Fluentbit will watch introspector logs |
111+
95112
### Fluentd Specification
96113

97114
| Name | Type | Description |

kubernetes/crd/domain-crd.yaml

Lines changed: 154 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apiVersion: apiextensions.k8s.io/v1
55
kind: CustomResourceDefinition
66
metadata:
77
annotations:
8-
weblogic.sha256: e13837460764db88c202b89ba80cf0b791f28c8e88e2912949366f5e99e001ad
8+
weblogic.sha256: 00d086baa58ae8ac5b6cc4f5a7a21535833aea22b5d31b5f38b98bcfa2521805
99
name: domains.weblogic.oracle
1010
spec:
1111
group: weblogic.oracle
@@ -985,6 +985,159 @@ spec:
985985
- PersistentVolume
986986
- FromModel
987987
type: string
988+
fluentbitSpecification:
989+
description: Automatic fluent-bit sidecar injection. If specified,
990+
the operator will deploy a sidecar container alongside each WebLogic
991+
Server instance that runs the fluent-bit, Optionally, the introspector
992+
job pod can be enabled to deploy with the fluent-bit sidecar container.
993+
WebLogic Server instances that are already running when the `fluentbitSpecification`
994+
field is created or deleted, will not be affected until they are
995+
restarted. When any given server is restarted for another reason,
996+
such as a change to the `restartVersion`, then the newly created
997+
pod will have the fluent-bit sidecar or not, as appropriate
998+
properties:
999+
image:
1000+
default: fluent/fluentd-kubernetes-daemonset:v1.16.1-debian-elasticsearch7-1.2
1001+
description: The Fluentbit container image name. Defaults to fluent/fluentd-kubernetes-daemonset:v1.16.1-debian-elasticsearch7-1.2
1002+
type: string
1003+
imagePullPolicy:
1004+
description: The image pull policy for the Fluentbit sidecar container
1005+
image. Legal values are Always, Never, and IfNotPresent. Defaults
1006+
to Always if image ends in :latest; IfNotPresent, otherwise.
1007+
type: string
1008+
elasticSearchCredentials:
1009+
description: 'Fluentbit elastic search credentials. A Kubernetes
1010+
secret in the same namespace of the domain. It must contains
1011+
4 keys: elasticsearchhost - ElasticSearch Host Service Address,
1012+
elasticsearchport - Elastic Search Service Port, elasticsearchuser
1013+
- Elastic Search Service User Name, elasticsearchpassword -
1014+
Elastic Search User Password'
1015+
type: string
1016+
parserConfiguration:
1017+
description: The Fluentbit parser configuration text, specify
1018+
your own custom fluentbit configuration.
1019+
type: string
1020+
resources:
1021+
description: Memory and CPU minimum requirements and limits for
1022+
the fluentbit container. See `kubectl explain pods.spec.containers.resources`.
1023+
properties:
1024+
claims:
1025+
items:
1026+
type: object
1027+
properties:
1028+
name:
1029+
type: string
1030+
required:
1031+
- name
1032+
type: array
1033+
requests:
1034+
additionalProperties:
1035+
type: string
1036+
type: object
1037+
limits:
1038+
additionalProperties:
1039+
type: string
1040+
type: object
1041+
type: object
1042+
containerArgs:
1043+
description: '(Optional) The Fluentbit sidecar container spec''s
1044+
args. Default is: [ -c, /etc/fluent-bit.conf ] if not specified'
1045+
items:
1046+
type: string
1047+
type: array
1048+
fluentbitConfiguration:
1049+
description: The Fluentbit configuration text, specify your own
1050+
custom fluentbit configuration.
1051+
type: string
1052+
watchIntrospectorLogs:
1053+
description: Fluentbit will watch introspector logs
1054+
type: boolean
1055+
env:
1056+
description: A list of environment variables to set in the fluentbit
1057+
container. See `kubectl explain pods.spec.containers.env`.
1058+
items:
1059+
type: object
1060+
properties:
1061+
name:
1062+
type: string
1063+
value:
1064+
type: string
1065+
valueFrom:
1066+
type: object
1067+
properties:
1068+
secretKeyRef:
1069+
type: object
1070+
properties:
1071+
name:
1072+
type: string
1073+
optional:
1074+
type: boolean
1075+
key:
1076+
type: string
1077+
required:
1078+
- key
1079+
resourceFieldRef:
1080+
type: object
1081+
properties:
1082+
divisor:
1083+
type: string
1084+
resource:
1085+
type: string
1086+
containerName:
1087+
type: string
1088+
required:
1089+
- resource
1090+
configMapKeyRef:
1091+
type: object
1092+
properties:
1093+
name:
1094+
type: string
1095+
optional:
1096+
type: boolean
1097+
key:
1098+
type: string
1099+
required:
1100+
- key
1101+
fieldRef:
1102+
type: object
1103+
properties:
1104+
apiVersion:
1105+
type: string
1106+
fieldPath:
1107+
type: string
1108+
required:
1109+
- fieldPath
1110+
required:
1111+
- name
1112+
type: array
1113+
containerCommand:
1114+
description: (Optional) The Fluentbit sidecar container spec's
1115+
command. Default is not set if not specified
1116+
items:
1117+
type: string
1118+
type: array
1119+
volumeMounts:
1120+
description: Volume mounts for fluentbit container
1121+
items:
1122+
type: object
1123+
properties:
1124+
mountPath:
1125+
type: string
1126+
mountPropagation:
1127+
type: string
1128+
name:
1129+
type: string
1130+
readOnly:
1131+
type: boolean
1132+
subPath:
1133+
type: string
1134+
subPathExpr:
1135+
type: string
1136+
required:
1137+
- mountPath
1138+
- name
1139+
type: array
1140+
type: object
9881141
httpAccessLogInLogHome:
9891142
default: true
9901143
description: Specifies whether the server HTTP access log files will

operator/src/main/java/oracle/kubernetes/operator/helpers/BasePodStepContext.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019, 2023, Oracle and/or its affiliates.
1+
// Copyright (c) 2019, 2024, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.kubernetes.operator.helpers;
@@ -103,6 +103,8 @@ private boolean hasMatchingVolumeName(V1VolumeMount volumeMount) {
103103

104104
abstract List<V1Volume> getFluentdVolumes();
105105

106+
abstract List<V1Volume> getFluentbitVolumes();
107+
106108
protected V1Container createPrimaryContainer() {
107109
return new V1Container()
108110
.name(getContainerName())
@@ -222,6 +224,7 @@ protected V1PodSpec createPodSpec() {
222224
return new V1PodSpec()
223225
.containers(getContainers())
224226
.volumes(getFluentdVolumes())
227+
.volumes(getFluentbitVolumes())
225228
.addContainersItem(createPrimaryContainer())
226229
.affinity(getServerSpec().getAffinity())
227230
.topologySpreadConstraints(getTopologySpreadConstraints())

0 commit comments

Comments
 (0)