Skip to content

Commit 7161d71

Browse files
authored
Merge pull request #27 from carolynvs/pr26
Make --ignore-not-found the default for uninstall
2 parents d4b4ef2 + 6d25554 commit 7161d71

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ bin/porter$(FILE_EXT):
9898
chmod +x bin/porter$(FILE_EXT)
9999

100100
install:
101-
mkdir -p $(PORTER_HOME)/mixins/$(MIXIN)
101+
mkdir -p $(PORTER_HOME)/mixins/$(MIXIN)/runtimes
102102
install $(BINDIR)/$(MIXIN)$(FILE_EXT) $(PORTER_HOME)/mixins/$(MIXIN)/$(MIXIN)$(FILE_EXT)
103-
install $(BINDIR)/$(MIXIN)-runtime$(FILE_EXT) $(PORTER_HOME)/mixins/$(MIXIN)/$(MIXIN)-runtime$(FILE_EXT)
103+
install $(BINDIR)/$(MIXIN)-runtime$(FILE_EXT) $(PORTER_HOME)/mixins/$(MIXIN)/runtimes/$(MIXIN)-runtime$(FILE_EXT)
104104

105105
clean: clean-packr
106106
-rm -fr bin/

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ porter mixin install kubernetes --version $VERSION --url https://github.com/getp
3535
### Mixin Configuration
3636

3737
#### Kubernetes client version
38+
You can use the `clientVersion` field to specify the kubectl CLI version.
3839

3940
```yaml
4041
- kubernetes:
@@ -77,6 +78,8 @@ uninstall:
7778
- /cnab/app/manifests/hello
7879
wait: true
7980

81+
\* Uninstall automatically applies the --ignore-not-found flag so that you can safely repeat the uninstall action without errors.
82+
8083
```
8184

8285
#### Outputs

pkg/kubernetes/uninstall.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ type UninstallArguments struct {
2424
Namespace string `yaml:"namespace"`
2525
Manifests []string `yaml:"manifests,omitempty"`
2626

27-
Force *bool `yaml:force,omitempty"`
28-
GracePeriod *int `yaml:"gracePeriod,omitempty"`
29-
Selector string `yaml:"selector,omitempty"`
30-
Context string `yaml:"context,omitempty"`
31-
Timeout *int `yaml:"timeout,omitempty"`
32-
Wait *bool `yaml:"wait,omitempty"`
27+
Force *bool `yaml:force,omitempty"`
28+
GracePeriod *int `yaml:"gracePeriod,omitempty"`
29+
Selector string `yaml:"selector,omitempty"`
30+
Context string `yaml:"context,omitempty"`
31+
Timeout *int `yaml:"timeout,omitempty"`
32+
Wait *bool `yaml:"wait,omitempty"`
3333
}
3434

3535
// Uninstall will delete anything created during the install or upgrade step
@@ -79,7 +79,7 @@ func (m *Mixin) Uninstall() error {
7979
}
8080

8181
func (m *Mixin) buildUninstallCommand(args UninstallArguments, manifestPath string) ([]string, error) {
82-
command := []string{"delete", "-f", manifestPath}
82+
command := []string{"delete", "--ignore-not-found=true", "-f", manifestPath}
8383
if args.Namespace != "" {
8484
command = append(command, "-n", args.Namespace)
8585
}

pkg/kubernetes/uninstall_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestMixin_UninstallStep(t *testing.T) {
2121

2222
manifestDirectory := "/cnab/app/manifests"
2323

24-
deleteCmd := "kubectl delete -f"
24+
deleteCmd := "kubectl delete --ignore-not-found=true -f"
2525

2626
dontWait := false
2727

@@ -91,7 +91,7 @@ func TestMixin_UninstallStep(t *testing.T) {
9191
Description: "Hello",
9292
},
9393
Manifests: []string{manifestDirectory},
94-
Context: context,
94+
Context: context,
9595
},
9696
},
9797
},

0 commit comments

Comments
 (0)