GithubHelp home page GithubHelp logo

patrick-vonsteht / test-netpol-deploy-fail Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5 KB

This repository contains a minimal example of a helm bug that leads to orphaned resources

Smarty 100.00%

test-netpol-deploy-fail's Introduction

This repository contains a minimal example of an issue in which helm creates orphaned resources.

Reproduction Case 1

In this test case, we first successfully deploy a helm chart without a network policy. Then we add a network policy, but simulate that the deployment fails. Afterwards we rename the network policy. As a result we end up with two network policies, although there should only be one. The first network policy seems to be orphaned, as it isn't deleted when uninstalling the helm chart:

PS > helm upgrade --install --wait --timeout 5s test1-netpol-deploy-fail .\test-netpol-deploy-fail\ --set netpolNameSuffix=test --set netpolPort=80 --set netpolEnabled=false --set fail=false
Release "test1-netpol-deploy-fail" does not exist. Installing it now.
NAME: test1-netpol-deploy-fail
LAST DEPLOYED: Thu Jan 19 13:04:59 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None

PS > kubectl get pods
NAME                                                              READY   STATUS    RESTARTS   AGE
test1-netpol-deploy-fail-test-netpol-deploy-fail-6f57dc577tc7td   1/1     Running   0          15s

PS > kubectl get networkpolicies
No resources found in default namespace.

PS > helm upgrade --install --wait --timeout 5s test1-netpol-deploy-fail .\test-netpol-deploy-fail\ --set netpolNameSuffix=test --set netpolPort=80 --set netpolEnabled=true --set fail=true
Error: UPGRADE FAILED: timed out waiting for the condition

PS > kubectl get pods
NAME                                                              READY   STATUS    RESTARTS   AGE
test1-netpol-deploy-fail-test-netpol-deploy-fail-6f57dc577tc7td   1/1     Running   0          36s
test1-netpol-deploy-fail-test-netpol-deploy-fail-76cf946d8lgmtf   0/1     Running   0          9s

PS > kubectl get networkpolicies
NAME                                                    POD-SELECTOR                                                                                         AGE
test1-netpol-deploy-fail-test-netpol-deploy-fail-test   app.kubernetes.io/instance=test1-netpol-deploy-fail,app.kubernetes.io/name=test-netpol-deploy-fail   14s

PS > helm upgrade --install --wait --timeout 5s test1-netpol-deploy-fail .\test-netpol-deploy-fail\ --set netpolNameSuffix=abc --set netpolPort=80 --set netpolEnabled=true --set fail=true
Error: UPGRADE FAILED: timed out waiting for the condition

PS > kubectl get pods
NAME                                                              READY   STATUS    RESTARTS   AGE
test1-netpol-deploy-fail-test-netpol-deploy-fail-6f57dc577tc7td   1/1     Running   0          71s
test1-netpol-deploy-fail-test-netpol-deploy-fail-76cf946d8lgmtf   0/1     Running   0          44s

PS > kubectl get networkpolicies
NAME                                                    POD-SELECTOR                                                                                         AGE
test1-netpol-deploy-fail-test-netpol-deploy-fail-abc    app.kubernetes.io/instance=test1-netpol-deploy-fail,app.kubernetes.io/name=test-netpol-deploy-fail   16s
test1-netpol-deploy-fail-test-netpol-deploy-fail-test   app.kubernetes.io/instance=test1-netpol-deploy-fail,app.kubernetes.io/name=test-netpol-deploy-fail   53s

PS > helm uninstall test1-netpol-deploy-fail
release "test1-netpol-deploy-fail" uninstalled

PS > kubectl get pods
No resources found in default namespace.

PS > kubectl get networkpolicies
NAME                                                    POD-SELECTOR                                                                                         AGE
test1-netpol-deploy-fail-test-netpol-deploy-fail-test   app.kubernetes.io/instance=test1-netpol-deploy-fail,app.kubernetes.io/name=test-netpol-deploy-fail   7m55s
PS >


Reproduction Case 2

In this test case, we first successfully deploy a helm chart with a network policy. Then we rename the network policy and change the port that it applies to and simulate that this deployment fails. Afterwards we rename the network policy again. As a result we end up with two network policies, although there should only be one. The first network policy seems to be orphaned, as it isn't deleted when uninstalling the helm chart:

PS > helm upgrade --install --wait --timeout 5s test2-netpol-deploy-fail .\test-netpol-deploy-fail\ --set netpolNameSuffix=test --set netpolPort=80 --set netpolEnabled=true --set fail=false
Release "test2-netpol-deploy-fail" does not exist. Installing it now.
NAME: test2-netpol-deploy-fail
LAST DEPLOYED: Thu Jan 19 13:15:43 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None

PS > kubectl get pods
NAME                                                              READY   STATUS    RESTARTS   AGE
test2-netpol-deploy-fail-test-netpol-deploy-fail-879fc689bss2nk   1/1     Running   0          8s

PS > kubectl get networkpolicies
NAME                                                    POD-SELECTOR                                                                                         AGE
test2-netpol-deploy-fail-test-netpol-deploy-fail-test   app.kubernetes.io/instance=test2-netpol-deploy-fail,app.kubernetes.io/name=test-netpol-deploy-fail   12s

PS > helm upgrade --install --wait --timeout 5s test2-netpol-deploy-fail .\test-netpol-deploy-fail\ --set netpolNameSuffix=abc --set netpolPort=70 --set netpolEnabled=true --set fail=true
Error: UPGRADE FAILED: timed out waiting for the condition

PS > kubectl get pods
NAME                                                              READY   STATUS    RESTARTS   AGE
test2-netpol-deploy-fail-test-netpol-deploy-fail-879fc689bss2nk   1/1     Running   0          41s
test2-netpol-deploy-fail-test-netpol-deploy-fail-88df8f6c79qmkk   0/1     Running   0          7s

PS > kubectl get networkpolicies
NAME                                                   POD-SELECTOR                                                                                         AGE
test2-netpol-deploy-fail-test-netpol-deploy-fail-abc   app.kubernetes.io/instance=test2-netpol-deploy-fail,app.kubernetes.io/name=test-netpol-deploy-fail   12s

PS > helm upgrade --install --wait --timeout 5s test2-netpol-deploy-fail .\test-netpol-deploy-fail\ --set netpolNameSuffix=123 --set netpolPort=70 --set netpolEnabled=true --set fail=true
Error: UPGRADE FAILED: timed out waiting for the condition

PS > kubectl get pods
NAME                                                              READY   STATUS    RESTARTS   AGE
test2-netpol-deploy-fail-test-netpol-deploy-fail-879fc689bss2nk   1/1     Running   0          73s
test2-netpol-deploy-fail-test-netpol-deploy-fail-88df8f6c79qmkk   0/1     Running   0          39s

PS > kubectl get networkpolicies
NAME                                                   POD-SELECTOR                                                                                         AGE
test2-netpol-deploy-fail-test-netpol-deploy-fail-123   app.kubernetes.io/instance=test2-netpol-deploy-fail,app.kubernetes.io/name=test-netpol-deploy-fail   9s
test2-netpol-deploy-fail-test-netpol-deploy-fail-abc   app.kubernetes.io/instance=test2-netpol-deploy-fail,app.kubernetes.io/name=test-netpol-deploy-fail   41s

PS > helm uninstall test2-netpol-deploy-fail
release "test2-netpol-deploy-fail" uninstalled

PS > kubectl get pods
No resources found in default namespace.

PS > kubectl get networkpolicies
NAME                                                   POD-SELECTOR                                                                                         AGE
test2-netpol-deploy-fail-test-netpol-deploy-fail-abc   app.kubernetes.io/instance=test2-netpol-deploy-fail,app.kubernetes.io/name=test-netpol-deploy-fail   57s

test-netpol-deploy-fail's People

Contributors

patrick-vonsteht avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.