@@ -14,6 +14,30 @@ See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
16
17
+ // Package annotation allows to set custom install, upgrade or uninstall options on custom resource objects with annotations.
18
+ // To create custom annotations implement the Install, Upgrade or Uninstall interface.
19
+ //
20
+ // Example:
21
+ //
22
+ // To disable hooks based on annotations the InstallDisableHooks is passed to the reconciler as an option.
23
+ //
24
+ // r, err := reconciler.New(
25
+ // reconciler.WithChart(*w.Chart),
26
+ // reconciler.WithGroupVersionKind(w.GroupVersionKind),
27
+ // reconciler.WithInstallAnnotations(annotation.InstallDisableHooks{}),
28
+ // )
29
+ //
30
+ // If the reconciler detects an annotation named "helm.sdk.operatorframework.io/install-disable-hooks"
31
+ // on the watched custom resource, it sets the install.DisableHooks option to the annotations value. For more information
32
+ // take a look at the InstallDisableHooks.InstallOption method.
33
+ //
34
+ // kind: OperatorHelmKind
35
+ // apiVersion: test.example.com/v1
36
+ // metadata:
37
+ // name: nginx-sample
38
+ // annotations:
39
+ // "helm.sdk.operatorframework.io/install-disable-hooks": true
40
+ //
17
41
package annotation
18
42
19
43
import (
@@ -30,27 +54,24 @@ var (
30
54
DefaultUninstallAnnotations = []Uninstall {UninstallDescription {}, UninstallDisableHooks {}}
31
55
)
32
56
57
+ // Install configures an install annotation.
33
58
type Install interface {
34
59
Name () string
35
60
InstallOption (string ) helmclient.InstallOption
36
61
}
37
62
63
+ // Upgrade configures an upgrade annotation.
38
64
type Upgrade interface {
39
65
Name () string
40
66
UpgradeOption (string ) helmclient.UpgradeOption
41
67
}
42
68
69
+ // Uninstall configures an uninstall annotation.
43
70
type Uninstall interface {
44
71
Name () string
45
72
UninstallOption (string ) helmclient.UninstallOption
46
73
}
47
74
48
- type InstallDisableHooks struct {
49
- CustomName string
50
- }
51
-
52
- var _ Install = & InstallDisableHooks {}
53
-
54
75
const (
55
76
defaultDomain = "helm.sdk.operatorframework.io"
56
77
defaultInstallDisableHooksName = defaultDomain + "/install-disable-hooks"
@@ -64,6 +85,12 @@ const (
64
85
defaultUninstallDescriptionName = defaultDomain + "/uninstall-description"
65
86
)
66
87
88
+ type InstallDisableHooks struct {
89
+ CustomName string
90
+ }
91
+
92
+ var _ Install = & InstallDisableHooks {}
93
+
67
94
func (i InstallDisableHooks ) Name () string {
68
95
if i .CustomName != "" {
69
96
return i .CustomName
0 commit comments