Skip to content
Open
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
6 changes: 6 additions & 0 deletions operator/internal/manifests/gateway_tenants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,9 @@ func TestConfigureDeploymentForMode(t *testing.T) {
Containers: []corev1.Container{
{
Name: gatewayContainerName,
Args: []string{
"--logs.auth.extract-selectors=SrcK8S_Namespace,DstK8S_Namespace",
},
},
{
Name: "opa",
Expand Down Expand Up @@ -1051,6 +1054,9 @@ func TestConfigureDeploymentForMode(t *testing.T) {
Containers: []corev1.Container{
{
Name: gatewayContainerName,
Args: []string{
"--logs.auth.extract-selectors=SrcK8S_Namespace,DstK8S_Namespace",
},
},
{
Name: "opa",
Expand Down
12 changes: 10 additions & 2 deletions operator/internal/manifests/openshift/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,23 @@ func ConfigureGatewayDeployment(
return kverrors.Wrap(err, "failed to merge sidecar container spec ")
}

if mode == lokiv1.OpenshiftLogging {
if mode == lokiv1.OpenshiftLogging || mode == lokiv1.OpenshiftNetwork {
// enable extraction of namespace selector
for i, c := range d.Spec.Template.Spec.Containers {
if c.Name != "gateway" {
continue
}

var authSelectors string
switch mode {
case lokiv1.OpenshiftLogging:
authSelectors = opaDefaultLabelMatchers
case lokiv1.OpenshiftNetwork:
authSelectors = opaNetworkLabelMatchers
}

d.Spec.Template.Spec.Containers[i].Args = append(d.Spec.Template.Spec.Containers[i].Args,
fmt.Sprintf("--logs.auth.extract-selectors=%s", opaDefaultLabelMatchers),
fmt.Sprintf("--logs.auth.extract-selectors=%s", authSelectors),
)
}
}
Expand Down
Loading