Skip to content

Commit

Permalink
Revert "Fix for existing CRDs are deleted when crd-install hook is in…
Browse files Browse the repository at this point in the history
…troduced (helm#4709)" (helm#5067)

This reverts commit e2a0e7f.

Signed-off-by: Matthew Fisher <[email protected]>
  • Loading branch information
Matthew Fisher authored and adamreese committed Dec 19, 2018
1 parent d325d2a commit 02a47c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 31 deletions.
7 changes: 0 additions & 7 deletions pkg/tiller/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,6 @@ func (file *manifestFile) sort(result *result) error {
isUnknownHook = true
break
}
if e == release.Hook_CRD_INSTALL {
result.generic = append(result.generic, Manifest{
Name: file.path,
Content: m,
Head: &entry,
})
}
h.Events = append(h.Events, e)
}

Expand Down
33 changes: 9 additions & 24 deletions pkg/tiller/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,6 @@ metadata:
name: example-test
annotations:
"helm.sh/hook": test-success
`,
},
{
name: []string{"ninth"},
path: "nine",
kind: []string{"CustomResourceDefinition"},
hooks: map[string][]release.Hook_Event{"ninth": {release.Hook_CRD_INSTALL}},
manifest: `apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: ninth
labels:
doesnot: matter
annotations:
"helm.sh/hook": crd-install
`,
},
}
Expand All @@ -161,22 +146,22 @@ metadata:
}

// This test will fail if 'six' or 'seven' was added.
// changed to account for CustomResourceDefinition with crd-install hook being added to generic list of manifests
if len(generic) != 3 {
t.Errorf("Expected 3 generic manifests, got %d", len(generic))
if len(generic) != 2 {
t.Errorf("Expected 2 generic manifests, got %d", len(generic))
}

// changed to account for 5 hooks now that there is a crd-install hook added as member 9 of the data list. It was 4 before.
if len(hs) != 5 {
t.Errorf("Expected 5 hooks, got %d", len(hs))
if len(hs) != 4 {
t.Errorf("Expected 4 hooks, got %d", len(hs))
}

for _, out := range hs {
t.Logf("Checking name %s path %s and kind %s", out.Name, out.Path, out.Kind)
found := false
for _, expect := range data {
if out.Path == expect.path {
found = true
if out.Path != expect.path {
t.Errorf("Expected path %s, got %s", expect.path, out.Path)
}
nameFound := false
for _, expectedName := range expect.name {
if out.Name == expectedName {
Expand Down Expand Up @@ -224,8 +209,8 @@ metadata:

name := sh.Metadata.Name

//only keep track of non-hook manifests, that are not CustomResourceDefinitions with crd-install
if err == nil && (s.hooks[name] == nil || s.hooks[name][0] == release.Hook_CRD_INSTALL) {
//only keep track of non-hook manifests
if err == nil && s.hooks[name] == nil {
another := Manifest{
Content: m,
Name: name,
Expand Down

0 comments on commit 02a47c7

Please sign in to comment.