This repository has been archived by the owner on May 3, 2022. It is now read-only.
/
installation.go
66 lines (50 loc) · 1.62 KB
/
installation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package errors
import (
"fmt"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
type DecodeManifestError struct {
err error
}
func (e DecodeManifestError) Error() string {
return e.err.Error()
}
func (e DecodeManifestError) ShouldRetry() bool {
return false
}
func NewDecodeManifestError(format string, args ...interface{}) DecodeManifestError {
return DecodeManifestError{fmt.Errorf(format, args...)}
}
func IsDecodeManifestError(err error) bool {
_, ok := err.(DecodeManifestError)
return ok
}
type ConvertUnstructuredError struct {
err error
}
func (e ConvertUnstructuredError) Error() string {
return e.err.Error()
}
func (e ConvertUnstructuredError) ShouldRetry() bool {
return false
}
func NewConvertUnstructuredError(format string, args ...interface{}) ConvertUnstructuredError {
return ConvertUnstructuredError{fmt.Errorf(format, args...)}
}
func IsConvertUnstructuredError(err error) bool {
_, ok := err.(ConvertUnstructuredError)
return ok
}
type InstallationTargetOwnershipError struct {
obj *unstructured.Unstructured
}
func NewInstallationTargetOwnershipError(obj *unstructured.Unstructured) InstallationTargetOwnershipError {
return InstallationTargetOwnershipError{obj: obj}
}
func (e InstallationTargetOwnershipError) Error() string {
msg := `%s "%s/%s" cannot be updated as it does not belong to the application. It may have been created by other means, and it conflicts with a matching object in the chart shipper is currently trying to install`
return fmt.Sprintf(msg, e.obj.GetKind(), e.obj.GetNamespace(), e.obj.GetName())
}
func (e InstallationTargetOwnershipError) ShouldRetry() bool {
return false
}