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

All resources deleted from permanent environment #5281

Closed
msvticket opened this issue Aug 30, 2019 · 5 comments · Fixed by #5323
Closed

All resources deleted from permanent environment #5281

msvticket opened this issue Aug 30, 2019 · 5 comments · Fixed by #5323

Comments

@msvticket
Copy link
Member

msvticket commented Aug 30, 2019

Summary

When running a remote environment set up according to https://jenkins-x.io/getting-started/multi-cluster/ a race condition exists that means all applications in the environment can be deleted.

Steps to reproduce the behavior

  1. Setup remote cluster according to https://jenkins-x.io/getting-started/multi-cluster/
  2. Promote 2 applications to environment in remote cluster at the same time

Expected behavior

Any changes are deployed

Actual behavior

All resources managed by the environment repo except pvc, configmaps and secrets got deleted.

Analysis

The step build-step-build-helm-apply in the second pipeline run that got started had applied it's changes just before the first pipeline runs build-step-build-helm-apply had come to "Removing Kubernetes resources from older releases using selector". So all resources from environment-sto-staging where deleted since they had gotten the version of the second pipeline run and thus mached the selector that was intended to fins old resources.

When using jenkins to deploy an environment the Jenkinsfile by default includes

    options {
        disableConcurrentBuilds()
    }

preventing a race condition to occur. This is missing from the mechanism set up with the environment controller.

It might be relevant that the environment is configured to use helm template and not tiller.

Jx version

Environment controller use the image gcr.io/jenkinsxio/builder-maven:0.1.549

The output of jx version is:

NAME               VERSION
jx                 2.0.643
Kubernetes cluster v1.13.8-eks-a977ba
kubectl            v1.14.1
helm client        Client: v2.14.1+g5270352
git                2.16.2
Operating System   Mac OS X 10.14.6 build 18G95
@msvticket
Copy link
Member Author

/kind bug
/important critical-urgent

@jenkins-x-bot jenkins-x-bot added the kind/bug Issue is a bug label Sep 2, 2019
@msvticket
Copy link
Member Author

/priority critical-urgent

@jenkins-x-bot jenkins-x-bot added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label Sep 2, 2019
@msvticket
Copy link
Member Author

/area multi-cluster

@pmuir pmuir added priority/critical and removed priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. labels Sep 5, 2019
@pmuir
Copy link
Contributor

pmuir commented Sep 5, 2019

Thank you for the PR. We will merge it when you are happy with it.

Downgrading to critical to level with other issues.

@msvticket
Copy link
Member Author

msvticket commented Sep 5, 2019

Thanks, but for my pull request to work I need jenkins-x-charts/environment-controller#252 to be merged.

EDIT: I rewrote the patch so it doesn't need jenkins-x-charts/environment-controller#252

jenkins-x-bot pushed a commit that referenced this issue Sep 8, 2019
Fixes #5281

Signed-off-by: Mårten Svantesson <Marten.Svantesson@ticket.se>
daveconde pushed a commit to daveconde/jx that referenced this issue Apr 7, 2020
Fixes jenkins-x#5281

Signed-off-by: Mårten Svantesson <Marten.Svantesson@ticket.se>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants