Skip to content

Commit

Permalink
User can specify the namespace in yaml for knative-serving
Browse files Browse the repository at this point in the history
  • Loading branch information
zxDiscovery authored and xu zhao committed Jan 8, 2019
1 parent acf7962 commit 39d0987
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
4 changes: 4 additions & 0 deletions config/activator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions config/autoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions config/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions config/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 12 additions & 3 deletions pkg/system/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit 39d0987

Please sign in to comment.