github.com/appscode/helm@v3.0.0-alpha.1+incompatible/pkg/release/hook.go (about) 1 /* 2 Copyright The Helm Authors. 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 */ 15 16 package release 17 18 import "time" 19 20 // HookEvent specifies the hook event 21 type HookEvent string 22 23 // Hook event types 24 const ( 25 HookPreInstall HookEvent = "pre-install" 26 HookPostInstall HookEvent = "post-install" 27 HookPreDelete HookEvent = "pre-delete" 28 HookPostDelete HookEvent = "post-delete" 29 HookPreUpgrade HookEvent = "pre-upgrade" 30 HookPostUpgrade HookEvent = "post-upgrade" 31 HookPreRollback HookEvent = "pre-rollback" 32 HookPostRollback HookEvent = "post-rollback" 33 HookReleaseTestSuccess HookEvent = "release-test-success" 34 HookReleaseTestFailure HookEvent = "release-test-failure" 35 ) 36 37 func (x HookEvent) String() string { return string(x) } 38 39 // HookDeletePolicy specifies the hook delete policy 40 type HookDeletePolicy string 41 42 // Hook delete policy types 43 const ( 44 HookSucceeded HookDeletePolicy = "succeeded" 45 HookFailed HookDeletePolicy = "failed" 46 HookBeforeHookCreation HookDeletePolicy = "before-hook-creation" 47 ) 48 49 func (x HookDeletePolicy) String() string { return string(x) } 50 51 // Hook defines a hook object. 52 type Hook struct { 53 Name string `json:"name,omitempty"` 54 // Kind is the Kubernetes kind. 55 Kind string `json:"kind,omitempty"` 56 // Path is the chart-relative path to the template. 57 Path string `json:"path,omitempty"` 58 // Manifest is the manifest contents. 59 Manifest string `json:"manifest,omitempty"` 60 // Events are the events that this hook fires on. 61 Events []HookEvent `json:"events,omitempty"` 62 // LastRun indicates the date/time this was last run. 63 LastRun time.Time `json:"last_run,omitempty"` 64 // Weight indicates the sort order for execution among similar Hook type 65 Weight int `json:"weight,omitempty"` 66 // DeletePolicies are the policies that indicate when to delete the hook 67 DeletePolicies []HookDeletePolicy `json:"delete_policies,omitempty"` 68 }