diff --git a/config/activator.yaml b/config/activator.yaml index 4500b36944ee..02ea748d3cac 100644 --- a/config/activator.yaml +++ b/config/activator.yaml @@ -61,6 +61,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.name + - name: SYSTEM_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace volumeMounts: - name: config-logging mountPath: /etc/config-logging diff --git a/config/autoscaler.yaml b/config/autoscaler.yaml index 5a8bd629527c..ceed1029318f 100644 --- a/config/autoscaler.yaml +++ b/config/autoscaler.yaml @@ -56,6 +56,11 @@ spec: mountPath: /etc/config-logging - name: config-observability mountPath: /etc/config-observability + env: + - name: SYSTEM_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace volumes: - name: config-autoscaler configMap: diff --git a/config/controller.yaml b/config/controller.yaml index aeb3384c87c3..36e5e9f77673 100644 --- a/config/controller.yaml +++ b/config/controller.yaml @@ -50,6 +50,11 @@ spec: volumeMounts: - name: config-logging mountPath: /etc/config-logging + env: + - name: SYSTEM_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace volumes: - name: config-logging configMap: diff --git a/config/webhook.yaml b/config/webhook.yaml index 68e5a5315ca9..eb037c98f124 100644 --- a/config/webhook.yaml +++ b/config/webhook.yaml @@ -49,6 +49,11 @@ spec: volumeMounts: - name: config-logging mountPath: /etc/config-logging + env: + - name: SYSTEM_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace volumes: - name: config-logging configMap: diff --git a/pkg/system/names.go b/pkg/system/names.go index a81a1fff6509..85ef512ed291 100644 --- a/pkg/system/names.go +++ b/pkg/system/names.go @@ -16,8 +16,17 @@ limitations under the License. package system -const ( - // Namespace holds the K8s namespace where our serving system +import "os" + +var ( + // Namespace holds the K8s namespace where our build system // components run. - Namespace = "knative-serving" + Namespace string ) + +func init() { + Namespace = os.Getenv("SYSTEM_NAMESPACE") + if Namespace == "" { + Namespace = "knative-serving" + } +}