{"action":"created","issue":{"url":"https://api.github.com/repos/kubernetes/helm/issues/4315","repository_url":"https://api.github.com/repos/kubernetes/helm","labels_url":"https://api.github.com/repos/kubernetes/helm/issues/4315/labels{/name}","comments_url":"https://api.github.com/repos/kubernetes/helm/issues/4315/comments","events_url":"https://api.github.com/repos/kubernetes/helm/issues/4315/events","html_url":"https://github.com/kubernetes/helm/issues/4315","id":338949029,"node_id":"MDU6SXNzdWUzMzg5NDkwMjk=","number":4315,"title":"Helm removes a namespace after upgrade command","user":{"login":"sgrigorev","id":22893469,"node_id":"MDQ6VXNlcjIyODkzNDY5","avatar_url":"https://avatars1.githubusercontent.com/u/22893469?v=4","gravatar_id":"","url":"https://api.github.com/users/sgrigorev","html_url":"https://github.com/sgrigorev","followers_url":"https://api.github.com/users/sgrigorev/followers","following_url":"https://api.github.com/users/sgrigorev/following{/other_user}","gists_url":"https://api.github.com/users/sgrigorev/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrigorev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrigorev/subscriptions","organizations_url":"https://api.github.com/users/sgrigorev/orgs","repos_url":"https://api.github.com/users/sgrigorev/repos","events_url":"https://api.github.com/users/sgrigorev/events{/privacy}","received_events_url":"https://api.github.com/users/sgrigorev/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-06T13:55:52Z","updated_at":"2018-07-06T14:15:42Z","closed_at":"2018-07-06T14:15:42Z","author_association":"NONE","body":"**Description:** I want to have a chart that installs workloads into specified namespace. Installation is going successful but when I try to do upgrade, helm deletes namespace and everything inside it.\r\nIn future I'm planning to have charts for each namespace in order to have able to package them into main one. For this reason, I don't use the `--namespace` key.\r\n\r\n**Steps to reproduce:**\r\nYou can use files that I described below to reproduce issue.\r\n1. Install chart\r\n```\r\n$ helm install testing/ --name testing --set shouldCreateNamespace=true\r\n```\r\n2. Make sure that mongo is installed into testing namespace\r\n3. Upgrade chart\r\n```\r\n$ helm upgrade testing testing/ --set shouldCreateNamespace=false --set mongo.image.tag=3.6\r\n```\r\n**Result:** namespace is deleted\r\nIs it a bug or I did something wrong?\r\n\r\n**Possible workaround:**\r\nIf I use the `--namespace` key then namespace is not deleted after upgrade.\r\n```\r\n$ helm install testing/ --name testing --namespace testing\r\n$ helm upgrade testing testing/ --set mongo.image.tag=3.6\r\n```\r\n\r\n**My directories structure:**\r\n```\r\nhelm-charts/\r\n    mongo/\r\n        templates/\r\n            deployment.yaml\r\n        Chart.yaml\r\n        values.yaml\r\n    testing/\r\n        templates/\r\n            namespace.yaml\r\n        Chart.yaml\r\n        values.yaml\r\n        requirements.yaml\r\n```\r\n`mongo/templates/deployment.yaml` :\r\n```\r\napiVersion: apps/v1beta2\r\nkind: Deployment\r\nmetadata:\r\n  name: {{ .Chart.Name }}\r\n  namespace: {{ default .Values.namespace .Values.global.namespace }}\r\nspec:\r\n  replicas: 1\r\n  selector:\r\n    matchLabels:\r\n      name: {{ .Chart.Name }}\r\n  template:\r\n    metadata:\r\n      labels:\r\n        name: {{ .Chart.Name }}\r\n    spec:\r\n      containers:\r\n        - name: {{ .Chart.Name }}\r\n          image: {{ .Values.image.repository }}:{{ .Values.image.tag }}\r\n          ports:\r\n            - name: mongo\r\n              containerPort: 27017\r\n              protocol: TCP\r\n\r\n```\r\n`mongo/values.yaml`:\r\n```\r\nnamespace: default\r\n\r\nimage:\r\n  repository: mongo\r\n  tag: 3.4\r\n```\r\n`testing/templates/namespace.yaml`:\r\n```\r\n{{- if .Values.shouldCreateNamespace -}}\r\nkind: Namespace\r\napiVersion: v1\r\nmetadata:\r\n  name: {{ .Values.global.namespace }}\r\n{{- end -}}\r\n```\r\n`testing/values.yaml`:\r\n```\r\nshouldCreateNamespace: false\r\n\r\nglobal:\r\n  namespace: testing\r\n```\r\n`testing/requirements.yaml`:\r\n```\r\ndependencies:\r\n  - name: mongo\r\n    repository: \"file://../mongo\"\r\n    version: 0.1.0\r\n```\r\n\r\n\r\nOutput of `helm version`:\r\nClient: &version.Version{SemVer:\"v2.9.1\", GitCommit:\"20adb27c7c5868466912eebdf6664e7390ebe710\", GitTreeState:\"clean\"}\r\nServer: &version.Version{SemVer:\"v2.9.1\", GitCommit:\"20adb27c7c5868466912eebdf6664e7390ebe710\", GitTreeState:\"clean\"}\r\n\r\nOutput of `kubectl version`:\r\nClient Version: version.Info{Major:\"1\", Minor:\"9\", GitVersion:\"v1.9.0\", GitCommit:\"925c127ec6b946659ad0fd596fa959be43f0cc05\", GitTreeState:\"clean\", BuildDate:\"2017-12-15T21:07:38Z\", GoVersion:\"go1.9.2\", Compiler:\"gc\", Platform:\"linux/amd64\"}\r\nServer Version: version.Info{Major:\"1\", Minor:\"8+\", GitVersion:\"v1.8.10-gke.0\", GitCommit:\"16ebd0de8e0ab2d1ef86d5b16ab1899b624a77cd\", GitTreeState:\"clean\", BuildDate:\"2018-03-20T20:21:01Z\", GoVersion:\"go1.8.3b4\", Compiler:\"gc\", Platform:\"linux/amd64\"}\r\n\r\nCloud Provider/Platform (AKS, GKE, Minikube etc.): GKE\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/kubernetes/helm/issues/comments/403047038","html_url":"https://github.com/kubernetes/helm/issues/4315#issuecomment-403047038","issue_url":"https://api.github.com/repos/kubernetes/helm/issues/4315","id":403047038,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzA0NzAzOA==","user":{"login":"sgrigorev","id":22893469,"node_id":"MDQ6VXNlcjIyODkzNDY5","avatar_url":"https://avatars1.githubusercontent.com/u/22893469?v=4","gravatar_id":"","url":"https://api.github.com/users/sgrigorev","html_url":"https://github.com/sgrigorev","followers_url":"https://api.github.com/users/sgrigorev/followers","following_url":"https://api.github.com/users/sgrigorev/following{/other_user}","gists_url":"https://api.github.com/users/sgrigorev/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrigorev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrigorev/subscriptions","organizations_url":"https://api.github.com/users/sgrigorev/orgs","repos_url":"https://api.github.com/users/sgrigorev/repos","events_url":"https://api.github.com/users/sgrigorev/events{/privacy}","received_events_url":"https://api.github.com/users/sgrigorev/received_events","type":"User","site_admin":false},"created_at":"2018-07-06T14:15:42Z","updated_at":"2018-07-06T14:15:42Z","author_association":"NONE","body":"This is my dumb mistake. I must not override the `shouldCreateNamespace` variable. I'm closing the ticket."}}
{"actor":{"display_login":"sgrigorev"}}