Skip to content

Commit 75ef506

Browse files
committed
Update Fluentd and Fluentbit containers as well
1 parent cf277ea commit 75ef506

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2025, Oracle and/or its affiliates.
1+
// Copyright (c) 2024, 2025, 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;
@@ -18,6 +18,7 @@
1818
import io.kubernetes.client.openapi.models.V1VolumeMount;
1919
import oracle.kubernetes.operator.LabelConstants;
2020
import oracle.kubernetes.operator.LogHomeLayoutType;
21+
import oracle.kubernetes.operator.processing.EffectiveServerSpec;
2122
import oracle.kubernetes.weblogic.domain.model.DomainResource;
2223
import oracle.kubernetes.weblogic.domain.model.FluentbitSpecification;
2324

@@ -35,12 +36,14 @@ private FluentbitHelper() {
3536

3637
/**
3738
* Add sidecar container for fluentbit.
39+
* @param serverSpec Server specification
3840
* @param fluentbitSpecification FluentbitSpecification.
3941
* @param containers List of containers.
4042
* @param isJobPod whether it belongs to the introspector job pod.
4143
* @param domain Domain.
4244
*/
43-
public static void addFluentbitContainer(FluentbitSpecification fluentbitSpecification, List<V1Container> containers,
45+
public static void addFluentbitContainer(EffectiveServerSpec serverSpec,
46+
FluentbitSpecification fluentbitSpecification, List<V1Container> containers,
4447
DomainResource domain, boolean isJobPod, boolean isReadOnlyRootFileSystem) {
4548
V1Container fluentbitContainer = new V1Container();
4649

@@ -57,7 +60,7 @@ public static void addFluentbitContainer(FluentbitSpecification fluentbitSpecifi
5760
fluentbitContainer.setImage(fluentbitSpecification.getImage());
5861
fluentbitContainer.setImagePullPolicy(fluentbitSpecification.getImagePullPolicy());
5962
fluentbitContainer.setResources(fluentbitSpecification.getResources());
60-
fluentbitContainer.setSecurityContext(PodSecurityHelper.getDefaultContainerSecurityContext());
63+
fluentbitContainer.setSecurityContext(serverSpec.getContainerSecurityContext());
6164

6265
if (fluentbitSpecification.getContainerCommand() != null) {
6366
fluentbitContainer.setCommand(fluentbitSpecification.getContainerCommand());

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018, 2023, Oracle and/or its affiliates.
1+
// Copyright (c) 2018, 2025, 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;
@@ -18,6 +18,7 @@
1818
import io.kubernetes.client.openapi.models.V1VolumeMount;
1919
import oracle.kubernetes.operator.LabelConstants;
2020
import oracle.kubernetes.operator.LogHomeLayoutType;
21+
import oracle.kubernetes.operator.processing.EffectiveServerSpec;
2122
import oracle.kubernetes.weblogic.domain.model.DomainResource;
2223
import oracle.kubernetes.weblogic.domain.model.FluentdSpecification;
2324

@@ -35,12 +36,14 @@ private FluentdHelper() {
3536

3637
/**
3738
* Add sidecar container for fluentd.
39+
* @param serverSpec Server specification
3840
* @param fluentdSpecification FluentdSpecification.
3941
* @param containers List of containers.
4042
* @param isJobPod whether it belongs to the introspector job pod.
4143
* @param domain Domain.
4244
*/
43-
public static void addFluentdContainer(FluentdSpecification fluentdSpecification, List<V1Container> containers,
45+
public static void addFluentdContainer(EffectiveServerSpec serverSpec,
46+
FluentdSpecification fluentdSpecification, List<V1Container> containers,
4447
DomainResource domain, boolean isJobPod, boolean isReadOnlyRootFileSystem) {
4548

4649
V1Container fluentdContainer = new V1Container();
@@ -59,7 +62,7 @@ public static void addFluentdContainer(FluentdSpecification fluentdSpecification
5962
fluentdContainer.setImage(fluentdSpecification.getImage());
6063
fluentdContainer.setImagePullPolicy(fluentdSpecification.getImagePullPolicy());
6164
fluentdContainer.setResources(fluentdSpecification.getResources());
62-
fluentdContainer.setSecurityContext(PodSecurityHelper.getDefaultContainerSecurityContext());
65+
fluentdContainer.setSecurityContext(serverSpec.getContainerSecurityContext());
6366

6467
if (fluentdSpecification.getContainerCommand() != null) {
6568
fluentdContainer.setCommand(fluentdSpecification.getContainerCommand());

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,15 +841,15 @@ protected List<V1Container> getContainers() {
841841
Optional.ofNullable(getDomain().getFluentdSpecification())
842842
.ifPresent(fluentd -> {
843843
if (Boolean.TRUE.equals(fluentd.getWatchIntrospectorLogs())) {
844-
FluentdHelper.addFluentdContainer(fluentd,
844+
FluentdHelper.addFluentdContainer(getServerSpec(), fluentd,
845845
containers, getDomain(), true, isReadOnlyRootFileSystem());
846846
}
847847
});
848848

849849
Optional.ofNullable(getDomain().getFluentbitSpecification())
850850
.ifPresent(fluentbit -> {
851851
if (Boolean.TRUE.equals(fluentbit.getWatchIntrospectorLogs())) {
852-
FluentbitHelper.addFluentbitContainer(fluentbit,
852+
FluentbitHelper.addFluentbitContainer(getServerSpec(), fluentbit,
853853
containers, getDomain(), true, isReadOnlyRootFileSystem());
854854
}
855855
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,10 +784,10 @@ protected List<V1Container> getContainers() {
784784
exporterContext.addContainer(containers);
785785
boolean isReadOnlyRootFileSystem = isReadOnlyRootFileSystem();
786786
Optional.ofNullable(getDomain().getFluentdSpecification())
787-
.ifPresent(fluentd -> addFluentdContainer(fluentd, containers, getDomain(), false,
787+
.ifPresent(fluentd -> addFluentdContainer(getServerSpec(), fluentd, containers, getDomain(), false,
788788
isReadOnlyRootFileSystem));
789789
Optional.ofNullable(getDomain().getFluentbitSpecification())
790-
.ifPresent(fluentbit -> addFluentbitContainer(fluentbit, containers, getDomain(),
790+
.ifPresent(fluentbit -> addFluentbitContainer(getServerSpec(), fluentbit, containers, getDomain(),
791791
false, isReadOnlyRootFileSystem));
792792
return containers;
793793
}

0 commit comments

Comments
 (0)