Skip to content

Commit

Permalink
fixes 'ksonnet namespace should be retrieved from env not params' (ku…
Browse files Browse the repository at this point in the history
…beflow#1829)

* fixes 'ksonnet namespace should be retrieved from env not params'

* /retest
  • Loading branch information
kkasravi authored and k8s-ci-robot committed Oct 19, 2018
1 parent 8d13c47 commit ee72474
Show file tree
Hide file tree
Showing 41 changed files with 22 additions and 104 deletions.
7 changes: 2 additions & 5 deletions kubeflow/argo/argo.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
// see https://github.com/argoproj/argo/blob/master/cmd/argo/commands/install.go
local k = import "k.libsonnet",
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: self + {
local params = _env + _params + {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
new(_env, _params):: {
local params = _env + _params,

// CRD's are not namespace scoped; see
// https://kubernetes.io/docs/tasks/access-kubernetes-api/extend-api-custom-resource-definitions/
Expand Down
1 change: 0 additions & 1 deletion kubeflow/argo/prototypes/argo.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// @description Deploy Argo workflow engine
// @shortDescription Argo workflow engine
// @param name string Name to give to the component
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.
// @optionalParam workflowControllerImage string argoproj/workflow-controller:v2.2.0 workflowControllerImage
// @optionalParam uiImage string argoproj/argoui:v2.2.0 uiImage
// @optionalParam executorImage string argoproj/argoexec:v2.2.0 executorImage
Expand Down
5 changes: 1 addition & 4 deletions kubeflow/core/ambassador.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
local k = import "k.libsonnet",
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

local ambassadorService = {
apiVersion: "v1",
Expand Down
5 changes: 1 addition & 4 deletions kubeflow/core/centraldashboard.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
local k = import "k.libsonnet",
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params + {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

local centralDashboardDeployment = {
apiVersion: "extensions/v1beta1",
Expand Down
5 changes: 1 addition & 4 deletions kubeflow/core/cert-manager.libsonnet
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

local certificateCRD = {
apiVersion: "apiextensions.k8s.io/v1beta1",
Expand Down
2 changes: 0 additions & 2 deletions kubeflow/core/cloud-endpoints.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
cloudEndpointsImage: "gcr.io/cloud-solutions-group/cloud-endpoints-controller:0.1.1",
metacontrollerImage: "gcr.io/enisoc-kubernetes/metacontroller@sha256:18561c63e1c5380ac5bbaabefa933e484bdb499f10b61071506f9a0070bc65f6",
},
Expand Down
5 changes: 1 addition & 4 deletions kubeflow/core/echo-server.libsonnet
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

local service = {
apiVersion: "v1",
Expand Down
5 changes: 1 addition & 4 deletions kubeflow/core/google-cloud-filestore-pv.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
local k = import "k.libsonnet",
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

local persistentVolume = {
apiVersion: "v1",
Expand Down
2 changes: 0 additions & 2 deletions kubeflow/core/iap.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
disableJwtChecking: util.toBool(_params.disableJwtChecking),
hostname: if std.objectHas(_params, "hostname") then _params.hostname else "null",
envoyPort: 8080,
Expand Down
5 changes: 1 addition & 4 deletions kubeflow/core/jupyterhub.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
local k = import "k.libsonnet",
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

local kubeSpawnerConfig = {
apiVersion: "v1",
Expand Down
5 changes: 1 addition & 4 deletions kubeflow/core/metric-collector.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
local k = import "k.libsonnet",
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

local metricServiceAccount = {
apiVersion: "v1",
Expand Down
5 changes: 1 addition & 4 deletions kubeflow/core/prometheus.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
local k = import "k.libsonnet",
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

local namespace = {
apiVersion: "v1",
Expand Down
1 change: 0 additions & 1 deletion kubeflow/core/prototypes/cert-manager.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// @description Provides cert-manager prototypes for generating SSL certificates.
// @shortDescription Certificate generation on GKE.
// @param name string Name for the component
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.
// @param acmeEmail string The Lets Encrypt account email address
// @optionalParam acmeUrl string https://acme-v02.api.letsencrypt.org/directory The ACME server URL, set to https://acme-staging-v02.api.letsencrypt.org/directory for staging API.
// @optionalParam certManagerImage string quay.io/jetstack/cert-manager-controller:v0.4.0 certManagerImage
Expand Down
1 change: 0 additions & 1 deletion kubeflow/core/prototypes/cloud-endpoints.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// @param name string Name for the component
// @optionalParam secretName string admin-gcp-sa Name of secret containing the json service account key.
// @optionalParam secretKey string admin-gcp-sa.json Name of the key in the secret containing the JSON service account key.
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.

local cloudEndpoints = import "kubeflow/core/cloud-endpoints.libsonnet";
local instance = cloudEndpoints.new(env, params);
Expand Down
1 change: 0 additions & 1 deletion kubeflow/core/prototypes/iap-ingress.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// @shortDescription Ingress for IAP on GKE.
// @param name string Name for the component
// @param ipName string The name of the global ip address to use.
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.
// @optionalParam secretName string envoy-ingress-tls The name of the secret containing the SSL certificates.
// @optionalParam hostname string null The hostname associated with this ingress. Eg: mykubeflow.example.com
// @optionalParam issuer string letsencrypt-prod The cert-manager issuer name.
Expand Down
1 change: 0 additions & 1 deletion kubeflow/core/prototypes/jupyterhub.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// @shortDescription jupyterhub Component
// @param name string Name
// @optionalParam cloud string null Cloud
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.
// @optionalParam serviceType string ClusterIP The service type for Jupyterhub.
// @optionalParam image string gcr.io/kubeflow/jupyterhub-k8s:v20180531-3bb991b1 The image to use for JupyterHub.
// @optionalParam jupyterHubAuthenticator string null The authenticator to use
Expand Down
1 change: 0 additions & 1 deletion kubeflow/core/prototypes/tf-job-operator.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// @description A TensorFlow job operator CRD
// @shortDescription A TensorFlow job operator.
// @param name string Name to give to each of the components
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.
// @optionalParam cloud string null String identifying the cloud to customize the deployment for.
// @optionalParam tfJobImage string gcr.io/kubeflow-images-public/tf_operator:v0.3.0 The image for the TfJob controller.
// @optionalParam tfDefaultImage string null The default image to use for TensorFlow.
Expand Down
2 changes: 0 additions & 2 deletions kubeflow/core/spartakus.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
reportUsageBool: util.toBool(_params.reportUsage),
},

Expand Down
1 change: 0 additions & 1 deletion kubeflow/core/tests/centraldashboard_test.jsonnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
local centraldashboard = import "../centraldashboard.libsonnet";
local params = {
namespace:: "kftest",
image:: "gcr.io/kubeflow-images-public/centraldashboard:v0.3.0",
};
local env = {
Expand Down
5 changes: 1 addition & 4 deletions kubeflow/core/tf-job-operator.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
local deployment = k.apps.v1beta1.deployment,

new(_env, _params):: {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

// tfJobCrd schema
local openAPIV3Schema = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
// @param name string Name to give to each of the components
// @param serviceAccountName string Name of the GCP service account
// @param secretName string Name of the kubernetes secret containing the credentials
// @optionalParam namespace string null Namespace to use for the pod preset. It is automatically inherited from the environment if not set.

local k = import "k.libsonnet";

// updatedParams uses the environment namespace if
// the namespace parameter is not explicitly set
local updatedParams = params {
namespace: if params.namespace == "null" then env.namespace else params.namespace,
namespace: env.namespace,
};

local podPreset = {
Expand Down
5 changes: 1 addition & 4 deletions kubeflow/knative-build/knative-build.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
local k = import "k.libsonnet",
local util = import "kubeflow/core/util.libsonnet",
new(_env, _params):: {
local params = _env + _params + {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

local knativeBuildLoggingConfigMap = {
apiVersion: "v1",
Expand Down
3 changes: 1 addition & 2 deletions kubeflow/kubebench/prototypes/kubebench-job.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// @description A benchmark job on Kubeflow
// @shortDescription A benchmark job on Kubeflow
// @param name string Name to give to each of the components
// @optionalParam namespace string null Namespace
// @optionalParam serviceAccount string null The service account used to run the job
// @optionalParam controllerImage string gcr.io/kubeflow-images-public/kubebench/kubebench-controller:v0.3.0 Configurator image
// @optionalParam githubTokenSecret string null Github token secret
Expand All @@ -28,7 +27,7 @@ local kubebenchJob = import "kubeflow/kubebench/kubebench-job.libsonnet";
local kubebenchRbac = import "kubeflow/kubebench/kubebench-rbac.libsonnet";

local name = params.name;
local namespace = if params.namespace == "null" then env.namespace else params.namespace;
local namespace = env.namespace;
local serviceAccount = params.serviceAccount;
local controllerImage = params.controllerImage;
local configPvc = params.experimentConfigPvc;
Expand Down
7 changes: 1 addition & 6 deletions kubeflow/metacontroller/metacontroller.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
local crd = k8s.apiextensions.v1beta1.customResourceDefinition,

new(_env, _params):: {
local params = _env + _params {
namespace:
if std.objectHas(_params, "namespace") &&
_params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

local compositeControllerCRD = {
apiVersion: "apiextensions.k8s.io/v1beta1",
Expand Down
1 change: 0 additions & 1 deletion kubeflow/metacontroller/prototypes/metacontroller.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// @description metacontroller Component
// @shortDescription metacontroller Component
// @param name string Name
// @optionalParam namespace string default Namespace for metacontroller

local metacontroller = import "kubeflow/metacontroller/metacontroller.libsonnet";
local instance = metacontroller.new(env, params);
Expand Down
2 changes: 1 addition & 1 deletion kubeflow/mxnet-job/mxnet-operator.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],

parts(params, env):: {
local namespace = if params.namespace != "null" then params.namespace else env.namespace,
local namespace = env.namespace,
crd: {
apiVersion: "apiextensions.k8s.io/v1beta1",
kind: "CustomResourceDefinition",
Expand Down
1 change: 0 additions & 1 deletion kubeflow/mxnet-job/prototypes/mxnet-job.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// @description A MXNet job (could be training or evaluation).
// @shortDescription A MXNet job.
// @param name string Name to give to each of the components
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.
// @optionalParam args string null Comma separated list of arguments to pass to the job
// @optionalParam image string null The docker image to use for the job.
// @optionalParam imageGpu string mxjob/mxnet:gpu The docker image to use when using GPUs.
Expand Down
1 change: 0 additions & 1 deletion kubeflow/mxnet-job/prototypes/mxnet-operator.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// @description MXNet Operator
// @shortDescription MXNet Operator for distributed mxnet on Kubernetes
// @param name string Name to give to each of the components
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.
// @optionalParam disks string null Comma separated list of Google persistent disks to attach to jupyter environments.
// @optionalParam cloud string null String identifying the cloud to customize the deployment for.
// @optionalParam mxnetJobImage string mxjob/mxnet-operator:v1 The image for the MXNetJob controller
Expand Down
5 changes: 1 addition & 4 deletions kubeflow/new-package-stub/newpackage.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
// sets a local variable params which is _env + _params
// All resources defined within self can then access param values as params.<name>
new(_env, _params):: self {
local params = _env + _params {
namespace: if std.objectHas(_params, "namespace") && _params.namespace != "null" then
_params.namespace else _env.namespace,
},
local params = _env + _params,

// Define the various resource manifests as local class variables
// The resource variable should be descriptive of the resource value being exported,
Expand Down
4 changes: 1 addition & 3 deletions kubeflow/openmpi/all.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ local workloads = import "kubeflow/openmpi/workloads.libsonnet";
all(params, env):: $.parts(params, env).all,

parts(params, env):: {
// updatedParams uses the environment namespace if
// the namespace parameter is not explicitly set
local updatedParams = params {
namespace: if params.namespace == "null" then env.namespace else params.namespace,
namespace: env.namespace,
init: if params.init == "null" then "/kubeflow/openmpi/assets/init.sh" else params.init,
exec: if params.exec == "null" then "sleep infinity" else params.exec,
},
Expand Down
1 change: 0 additions & 1 deletion kubeflow/openmpi/prototypes/openmpi.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// @param name string Name to give to each of the components.
// @param image string Docker image with openmpi.
// @param secret string Name of secret containing ssh keys.
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.
// @optionalParam workers number 4 Number of workers.
// @optionalParam init string null Command to bootstrap the containers. Defaults to init.sh.
// @optionalParam exec string null Command to execute in master after bootstrap is done. It sleeps indefinitely if not set.
Expand Down
1 change: 0 additions & 1 deletion kubeflow/pytorch-job/prototypes/pytorch-job.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// @description A PyTorch job (could be training or evaluation).
// @shortDescription A PyTorch job.
// @param name string Name to give to each of the components
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.
// @optionalParam args string null Comma separated list of arguments to pass to the job
// @optionalParam image string gcr.io/kubeflow-examples/pytorch-dist-mnist:v20180702-a57993c The docker image to use for the job.
// @optionalParam numMasters number 1 The number of masters to use
Expand Down
1 change: 0 additions & 1 deletion kubeflow/pytorch-job/prototypes/pytorch-operator.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// @description PyTorch Operator
// @shortDescription PyTorch Operator for distributed pytorch on Kubernetes
// @param name string Name to give to each of the components
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.
// @optionalParam disks string null Comma separated list of Google persistent disks to attach to jupyter environments.
// @optionalParam cloud string null String identifying the cloud to customize the deployment for.
// @optionalParam pytorchJobImage string gcr.io/kubeflow-images-public/pytorch-operator:v0.3.0 The image for the PyTorchJob controller
Expand Down
2 changes: 1 addition & 1 deletion kubeflow/pytorch-job/pytorch-operator.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],

parts(params, env):: {
local namespace = if params.namespace != "null" then params.namespace else env.namespace,
local namespace = env.namespace,
crd: {
apiVersion: "apiextensions.k8s.io/v1beta1",
kind: "CustomResourceDefinition",
Expand Down
9 changes: 1 addition & 8 deletions kubeflow/seldon/prototypes/core.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// @description Seldon Core components. Operator and API FrontEnd.
// @shortDescription Seldon Core components.
// @param name string seldon Name to give seldon
// @optionalParam namespace string null Namespace to use for the components. It is automatically inherited from the environment if not set.
// @optionalParam withRbac string true Whether to include RBAC setup
// @optionalParam withApife string false Whether to include builtin API OAuth gateway server for ingress
// @optionalParam withAmbassador string false Whether to include Ambassador reverse proxy
Expand All @@ -16,16 +15,10 @@
local k = import "k.libsonnet";
local core = import "kubeflow/seldon/core.libsonnet";

// updatedParams uses the environment namespace if
// the namespace parameter is not explicitly set
local updatedParams = params {
namespace: if params.namespace == "null" then env.namespace else params.namespace,
};

local seldonVersion = import "param://seldonVersion";

local name = import "param://name";
local namespace = updatedParams.namespace;
local namespace = env.namespace;
local withRbac = import "param://withRbac";
local withApife = import "param://withApife";
local withAmbassador = import "param://withAmbassador";
Expand Down
4 changes: 0 additions & 4 deletions kubeflow/tensorboard/tensorboard.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

new(_env, _params):: {
local params = _env + _params {
namespace:
if std.objectHas(_params, "namespace") &&
_params.namespace != "null" then
_params.namespace else _env.namespace,
labels: {
app: _params.name,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ local k = import "k.libsonnet";
local name = import "param://name";

// updatedParams includes the namespace from env by default.
// We can override namespace in params if needed
local updatedParams = env + params;

local tfServingBase = import "kubeflow/tf-serving/tf-serving.libsonnet";
Expand Down
Loading

0 comments on commit ee72474

Please sign in to comment.