diff --git a/pkg/operator/edgefs/cluster/target/pod.go b/pkg/operator/edgefs/cluster/target/pod.go index d28ba8af1..4df620353 100644 --- a/pkg/operator/edgefs/cluster/target/pod.go +++ b/pkg/operator/edgefs/cluster/target/pod.go @@ -146,6 +146,10 @@ func (c *Cluster) makeAuditdContainer(containerImage string) v1.Container { }, }, }, + { + Name: "K8S_NAMESPACE", + Value: c.Namespace, + }, }, SecurityContext: securityContext, VolumeMounts: volumeMounts, @@ -281,6 +285,10 @@ func (c *Cluster) makeDaemonContainer(containerImage string, dro edgefsv1beta1.D }, }, }, + { + Name: "K8S_NAMESPACE", + Value: c.Namespace, + }, }, SecurityContext: securityContext, Resources: c.resources, diff --git a/pkg/operator/edgefs/iscsi/iscsi.go b/pkg/operator/edgefs/iscsi/iscsi.go index 4cad2aea8..fe37b987d 100644 --- a/pkg/operator/edgefs/iscsi/iscsi.go +++ b/pkg/operator/edgefs/iscsi/iscsi.go @@ -239,7 +239,7 @@ func (c *ISCSIController) iscsiContainer(svcname, name, containerImage string, i }, }, { - Name: "KUBERNETES_NAMESPACE", + Name: "K8S_NAMESPACE", ValueFrom: &v1.EnvVarSource{ FieldRef: &v1.ObjectFieldSelector{ FieldPath: "metadata.namespace", diff --git a/pkg/operator/edgefs/isgw/isgw.go b/pkg/operator/edgefs/isgw/isgw.go index 6fa2914b6..11a47973f 100644 --- a/pkg/operator/edgefs/isgw/isgw.go +++ b/pkg/operator/edgefs/isgw/isgw.go @@ -296,7 +296,7 @@ func (c *ISGWController) isgwContainer(svcname, name, containerImage string, isg }, }, { - Name: "KUBERNETES_NAMESPACE", + Name: "K8S_NAMESPACE", ValueFrom: &v1.EnvVarSource{ FieldRef: &v1.ObjectFieldSelector{ FieldPath: "metadata.namespace", diff --git a/pkg/operator/edgefs/nfs/nfs.go b/pkg/operator/edgefs/nfs/nfs.go index 72e1dffc5..324a5e660 100644 --- a/pkg/operator/edgefs/nfs/nfs.go +++ b/pkg/operator/edgefs/nfs/nfs.go @@ -226,6 +226,14 @@ func (c *NFSController) nfsContainer(svcname, name, containerImage string, nfsSp }, }, }, + { + Name: "K8S_NAMESPACE", + ValueFrom: &v1.EnvVarSource{ + FieldRef: &v1.ObjectFieldSelector{ + FieldPath: "metadata.namespace", + }, + }, + }, }, SecurityContext: securityContext, Resources: nfsSpec.Resources, diff --git a/pkg/operator/edgefs/s3/s3.go b/pkg/operator/edgefs/s3/s3.go index 35390cce9..6277706a4 100644 --- a/pkg/operator/edgefs/s3/s3.go +++ b/pkg/operator/edgefs/s3/s3.go @@ -298,6 +298,14 @@ func (c *S3Controller) s3Container(svcname, name, containerImage, args string, s }, }, }, + { + Name: "K8S_NAMESPACE", + ValueFrom: &v1.EnvVarSource{ + FieldRef: &v1.ObjectFieldSelector{ + FieldPath: "metadata.namespace", + }, + }, + }, { Name: "EFSS3_HTTP_PORT", Value: fmt.Sprint(s3Spec.Port), diff --git a/pkg/operator/edgefs/s3x/s3x.go b/pkg/operator/edgefs/s3x/s3x.go index 5c2afcc86..5b8090f79 100644 --- a/pkg/operator/edgefs/s3x/s3x.go +++ b/pkg/operator/edgefs/s3x/s3x.go @@ -268,6 +268,14 @@ func (c *S3XController) s3xContainer(svcname, name, containerImage string, s3xSp }, }, }, + { + Name: "K8S_NAMESPACE", + ValueFrom: &v1.EnvVarSource{ + FieldRef: &v1.ObjectFieldSelector{ + FieldPath: "metadata.namespace", + }, + }, + }, { Name: "EFSS3X_HTTP_PORT", Value: fmt.Sprint(s3xSpec.Port), diff --git a/pkg/operator/edgefs/swift/swift.go b/pkg/operator/edgefs/swift/swift.go index 56c1311eb..937d494e0 100644 --- a/pkg/operator/edgefs/swift/swift.go +++ b/pkg/operator/edgefs/swift/swift.go @@ -284,6 +284,14 @@ func (c *SWIFTController) swiftContainer(svcname, name, containerImage, args str }, }, }, + { + Name: "K8S_NAMESPACE", + ValueFrom: &v1.EnvVarSource{ + FieldRef: &v1.ObjectFieldSelector{ + FieldPath: "metadata.namespace", + }, + }, + }, { Name: "EFSSWIFT_HTTP_PORT", Value: fmt.Sprint(swiftSpec.Port),