Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherit namespace from ksonnet environment #426

Merged
merged 9 commits into from Mar 20, 2018
Merged

Inherit namespace from ksonnet environment #426

merged 9 commits into from Mar 20, 2018

Conversation

ankushagarwal
Copy link
Contributor

@ankushagarwal ankushagarwal commented Mar 14, 2018

Now that ksonnet makes env available in it's components, we can
leverate that to use the environment's namespace instead of hardcoding a
default namespace in the component parameters.

So now the behaviour is that when components are generated from
prototypes, we default to using the environment's namespace. If the user
has overridden namespace as a parameter, that will get used for the
component.

Tested by deploying kubeflow-core and tf-serving to a new k8s cluster

Fixes #43


This change is Reviewable

@ankushagarwal
Copy link
Contributor Author

/cc @lluunn

Now that ksonnet makes `env` available in it's components, we can
leverate that to use the environment's namespace instead of hardcoding a
default namespace in the component parameters.

So now the behaviour is that when components are generated from
prototypes, we default to using the environment's namespace. If the user
has overridden namespace as a parameter, that will get used for the
component.

Tested by deploying kubeflow-core and tf-serving to a new k8s cluster

Fixes #43
@lluunn
Copy link
Contributor

lluunn commented Mar 14, 2018

With #411 test should pass

@@ -1,7 +1,4 @@
{
// TODO(https://github.com/ksonnet/ksonnet/issues/222): Taking namespace as an argument is a work around for the fact that ksonnet
// doesn't support automatically piping in the namespace from the environment to prototypes.
//
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this TODO for removing namespace param in parts(namespace)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment in the TODO mentions that Taking namespace as an argument is a work around for the fact that ksonnet doesn't support automatically piping in the namespace from the environment to prototypes - I don't think that is true.

The workaround for ksonnet not piping the namespace from env to prototypes is we have an explicit parameter called namespace in our prototype - this PR addresses this issue by removing the namespace parameter from our prototypes.

std.prune(k.core.v1.list.new(argo.parts(params.namespace).all))
// updatedParams includes the namespace from env by default.
// We can override namespace in params if needed
local updatedParams = env + params;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env is the params from environment?
Aren't we already setting per environment param to override default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env is not params. params are defined per component in component/params.libsonnet and can be overridden per-environment in environments/<env>/params.libsonnet

env is the ksonnet environment definition. It is the value you get when you execute ks env list

For example

% ks env list
NAME    KUBERNETES-VERSION NAMESPACE SERVER
====    ================== ========= ======
default v1.7.0             kubeflow  https://35.184.102.122```

For this default environment, env will contain

{
  "namespace": "kubeflow",
  "server": "https://35.184.102.122",
}

The main idea is that we should not have to define the namespace parameter per component, it will automatically be inherited by the environment in which we do a ks apply <env>

@ankushagarwal
Copy link
Contributor Author

/retest

@lluunn
Copy link
Contributor

lluunn commented Mar 15, 2018

/retest

@ankushagarwal
Copy link
Contributor Author

/retest

3 similar comments
@ankushagarwal
Copy link
Contributor Author

/retest

@ankushagarwal
Copy link
Contributor Author

/retest

@ankushagarwal
Copy link
Contributor Author

/retest

@ankushagarwal
Copy link
Contributor Author

/retest

1 similar comment
@ankushagarwal
Copy link
Contributor Author

/retest

@lluunn
Copy link
Contributor

lluunn commented Mar 15, 2018

For workflow kubeflow-presubmit-kubeflow-e2e-426-34cf6d3-644-1359
I see
INFO|2018-03-15T23:08:56|/mnt/test-data-volume/kubeflow-presubmit-kubeflow-e2e-426-34cf6d3-644-1359/src/kubeflow/tf-operator/py/util.py|43| Running: ks param set --env=test-env-3033 simple_tfjob namespace kubeflow-presubmit-kubeflow-e2e-426-34cf6d3-644-1359
cwd=/mnt/test-data-volume/kubeflow-presubmit-kubeflow-e2e-426-34cf6d3-644-1359/src/kubeflow/tf-operator/test/workflows
INFO|2018-03-15T23:08:57|/mnt/test-data-volume/kubeflow-presubmit-kubeflow-e2e-426-34cf6d3-644-1359/src/kubeflow/tf-operator/py/util.py|82| Subprocess output:
Your application's apiVersion is below 0.1.0. In order to use all ks features, you can upgrade your application using ks upgrade.
Parameter 'namespace' successfully set to '"kubeflow-presubmit-kubeflow-e2e-426-34cf6d3-644-1359"' for component 'simple_tfjob' in environment 'test-env-3033'

INFO|2018-03-15T23:08:57|/mnt/test-data-volume/kubeflow-presubmit-kubeflow-e2e-426-34cf6d3-644-1359/src/kubeflow/tf-operator/py/test_runner.py|163| Trial 0
INFO|2018-03-15T23:08:57|/mnt/test-data-volume/kubeflow-presubmit-kubeflow-e2e-426-34cf6d3-644-1359/src/kubeflow/tf-operator/py/util.py|43| Running: ks apply test-env-3033 -c simple_tfjob
cwd=/mnt/test-data-volume/kubeflow-presubmit-kubeflow-e2e-426-34cf6d3-644-1359/src/kubeflow/tf-operator/test/workflows
INFO|2018-03-15T23:08:57|/mnt/test-data-volume/kubeflow-presubmit-kubeflow-e2e-426-34cf6d3-644-1359/src/kubeflow/tf-operator/py/util.py|82| Subprocess output:
Your application's apiVersion is below 0.1.0. In order to use all ks features, you can upgrade your application using ks upgrade.
generate objects for namespace : unable to read /mnt/test-data-volume/kubeflow-presubmit-kubeflow-e2e-426-34cf6d3-644-1359/src/kubeflow/tf-operator/test/workflows/environments/test-env-3033/main.jsonnet: RUNTIME ERROR: Couldn't open import "k.libsonnet": No match locally or in the Jsonnet library paths.

@lluunn
Copy link
Contributor

lluunn commented Mar 16, 2018

kubeflow/training-operator#464 should fix tf-operator test

@ankushagarwal
Copy link
Contributor Author

/retest

@jlewi
Copy link
Contributor

jlewi commented Mar 17, 2018

This is great thanks!

* Update jupyterhub.libsonnet comment

* Set imagePullPolicy to always

* Print ks version

* Update tfserving test to use kubeflow-ci/test-worker
@ankushagarwal
Copy link
Contributor Author

@jlewi Can you please take a look again. I pushed a few changes to fix tests.

@jlewi
Copy link
Contributor

jlewi commented Mar 20, 2018

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jlewi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 8d617d6 into kubeflow:master Mar 20, 2018
@ankushagarwal ankushagarwal deleted the top-level-namespace branch March 20, 2018 17:45
k8s-ci-robot pushed a commit that referenced this pull request Mar 20, 2018
* Update docs so that namespace is only set at ks env level

Now that #426 is merged, we do
not need to set namespace at the component level. namespace will be
automatically inherited by the component from env.

* Update ksonnet version requirement
yanniszark pushed a commit to arrikto/kubeflow that referenced this pull request Nov 1, 2019
* Restore Metadata fix (kubeflow#424)

* Fix metadata deployment for KFP's UI

* Only update metadata test files

* This PR was originally committed as kubeflow#424 but it got rolled back in kubeflow#429
  in order to fix master.

  * This PR is rolling it forward.

  * Related to kubeflow#426

* Add the virtual service for grpc metadata to kustomization.yaml

* Port for the virtual service should be 9090.

* Fix tests.
elenzio9 pushed a commit to arrikto/kubeflow that referenced this pull request Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants