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
set okteto context and namespace from env vars #4247
base: master
Are you sure you want to change the base?
set okteto context and namespace from env vars #4247
Conversation
caf5e56
to
668bee0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have enough context in the CLI or understand how context works internally to confidently approve this PR. Deferring approval to @jLopezbarb
c7f0a8f
to
8cc6430
Compare
Moving to draft until e2e are passing |
23e504f
to
0087d3d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM besides of the e2e tests
0087d3d
to
9a6c151
Compare
Signed-off-by: Andrea Falzetti <andrea@okteto.com>
Signed-off-by: Andrea Falzetti <andrea@okteto.com>
Signed-off-by: Andrea Falzetti <andrea@okteto.com>
Signed-off-by: Andrea Falzetti <andrea@okteto.com>
Signed-off-by: Andrea Falzetti <andrea@okteto.com>
Signed-off-by: Andrea Falzetti <andrea@okteto.com>
Signed-off-by: Andrea Falzetti <andrea@okteto.com>
9a6c151
to
e8ea18e
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4247 +/- ##
==========================================
- Coverage 45.64% 45.64% -0.01%
==========================================
Files 308 308
Lines 27849 27839 -10
==========================================
- Hits 12711 12706 -5
+ Misses 14040 14035 -5
Partials 1098 1098 |
This looks like quite a sensitive change for a backport |
Proposed changes
Fixes DEV-281
How to validate
You need at least 2 different contexts to validate this change.
Scenario 1 - no context
Without any current context, or
--context
, orOKTETO_CONTEXT
the CLI should tell you that you have no context.Try the following:
And validate that you get a message in both cases saying your context is not set.
Scenario 2 - current context
Assuming you have a current context:
okteto context show
Scenario 3 - current context +
--context
flagThe flag should have priority over the current context, to validate this scenario, run:
okteto context show
<CTX1>
)okteto endpoints --context <CTX2>
<CTX2>
<CTX2>
okteto endpoints --context <CTX2> --namespace <NS2>
<NS2>
is picked up as expectedScenario 4 - current context +
OKTETO_CONTEXT
okteto context show
<CTX1>
)OKTETO_CONTEXT=<CTX2> okteto endpoints
<CTX2>
<CTX2>
OKTETO_CONTEXT=<CTX2> OKTETO_NAMESPACE=<NS2> okteto endpoints
<NS2>
is picked up as expectedScenario 5 - current context +
OKTETO_CONTEXT
+--context
For this scenario it's ideal to use 3 different contextes to avoid ambiguities.
okteto context show
<CTX1>
)OKTETO_CONTEXT=<CTX2> okteto endpoints --context <CTX3>
<CTX3>
<CTX3>
OKTETO_CONTEXT=<CTX2> OKTETO_NAMESPACE=<NS2> okteto endpoints --context <CTX3> --namespace <NS3>
<NS3>
is picked up as expectedScenario 6 - current context +
.env
withOKTETO_CONTEXT
+--context
okteto context show
<CTX1>
).env
withOKTETO_CONTEXT=<CTX2>
okteto endpoints --context <CTX3>
<CTX3>
<CTX3>
OKTETO_NAMESPACE=<NS2>
to the.env
okteto endpoints --context <CTX3> --namespace <NS3>
<NS3>
is picked up as expectedScenario 7 - current context + manifest
context:
+--context
okteto context show
<CTX1>
)context: <CTX2>
in your manifestokteto endpoints --context <CTX3>
<CTX2>
<CTX2>
namespace: <NS2>
in your manifestokteto endpoints --context <CTX3> --namespace <NS3>
<NS2>
is picked up as expectedScenario 8 - current context +
OKTETO_URL
okteto context show
<CTX1>
)OKTETO_URL=<CTX2> okteto endpoints
<CTX2>
<CTX2>
OKTETO_URL=<CTX2> OKTETO_NAMESPACE=<NS2> okteto endpoints
<NS2>
is picked up as expectedOut of scope scenarios:
These are lower-priority scenarios that may be worked on with a follow-up ticket/PR.
OKTETO_CONTEXT
var set in CatalogOKTETO_CONTEXT
var set in Catalog +--context
OKTETO_CONTEXT
set as--var
flag in deployOKTETO_CONTEXT
set as User variableOKTETO_CONTEXT
set as Cluster variableCLI Quality Reminders 🔧
For both authors and reviewers: