8000 PROD-343: Change when the divert deploy logic is called to avoid problems when endpoints are defined in the manifest by ifbyol · Pull Request #4701 · okteto/okteto · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

PROD-343: Change when the divert deploy logic is called to avoid problems when endpoints are defined in the manifest #4701

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

Merged
merged 2 commits into from
Apr 15, 2025

Conversation

ifbyol
Copy link
Member
@ifbyol ifbyol commented Apr 11, 2025

Proposed changes

PROD-343

If you had a manifest with Divert, and then, you specify also the endpoints section, the update of the ingresses when the endpoints are deployed was making that the divert annotations were missing from the ingresses, so the header wasn't being propagated.

So, this started to happen when we re-organized the remote vs local deploy, as the divert deploy started to happen first. What I'm doing in this PR is to change the order, so, in the deployable phase (the one that can be happened locally or remotely, and the one running the proxy), we only apply the divert logic related to the proxy, but we don't call the Deploy function of the driver. That is started to be called at the end of the main flow (things that always happen locally), as the last stage of the deploy, so we ensure that the compose deployment (we already had issues in the past), and the endpoints deployment don't affect the divert logic.

I have been checking, and there is no need of executing the divert deploy in the proxy.

I was testing all the output from the UI and CLI, and the output looks good too.

How to validate

This repository can be used to validate the changes: https://github.com/ifbyol/test-okteto-divert

Follow the next steps:

  • First, use the current CLI you have installer (without these changes)
  • Deploy the main Okteto Manifest of the repo in a namespace
  • Then, change the .env file to et the namespace where you deployed the whole application
  • Then, deploy specifying okteto.serviceb.yaml as manifest in a new namespace

If you access to the endpoint https://test-okteto-divert-{rest-of-domain}/servicea/chain, you will see how three services are reported from the common namespace (which is wrong), and if you check the ingress generated in the last namespace, you will see how the divert annotations are missing. Also, you can see how the divert stage is executed before the "deploy compose"

Now, build the CLI from this branch and follow the same steps described above (recommendation is to deploy it from scratch).

In this case, you will see that the endpoint works fine. If you check the ingress, you will see how the divert annotation is applied, and you can see how the divert stage is running after the "deploy compose" one. So, any endpoint generated from the deploy compose phase is also updated accordingly when the divert phase is executed

Signed-off-by: Nacho Fuertes <nacho@okteto.com>
@ifbyol ifbyol requested a review from a team as a code owner April 11, 2025 14:28
Comment on lines -338 to -346
if params.Deployable.Divert != nil && params.Deployable.Divert.Namespace != params.Namespace {
oktetoLog.SetStage("Deploy Divert")
if err := r.DivertDeployer.Deploy(ctx); err != nil {
oktetoLog.AddToBuffer(oktetoLog.ErrorLevel, "error creating divert: %s", err.Error())
return err
}
oktetoLog.SetStage("")
}

Copy link
Member Author

Choose a reason for hiding this comment

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

The change is to move this from there to cmd/deploy/deploy.go

@ifbyol ifbyol added the run-e2e When used on a PR run windows & unix e2e label Apr 11, 2025
Copy link
codecov bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 40.74074% with 16 lines in your changes missing coverage. Please review.

Project coverage is 48.84%. Comparing base (8e49dfb) to head (de0d22d).
Report is 3 commits behind head on master.

❌ Your patch status has failed because the patch coverage (40.74%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4701      +/-   ##
==========================================
- Coverage   48.86%   48.84%   -0.02%     
==========================================
  Files         354      354              
  Lines       29510    29517       +7     
==========================================
- Hits        14421    14419       -2     
- Misses      13945    13952       +7     
- Partials     1144     1146       +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

8000
Signed-off-by: Nacho Fuertes <nacho@okteto.com>
@ifbyol ifbyol merged commit 0decf11 into master Apr 15, 2025
23 of 24 checks passed
@ifbyol ifbyol deleted the ifbyol/prod-343 branch April 15, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/bug-fix run-e2e When used on a PR run windows & unix e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0