Documentation
¶
Index ¶
- Constants
- Variables
- func AddAnnotations(objMeta *metav1.ObjectMeta, annotations map[string]string)
- type ActionOp
- type ActionType
- type DeploymentHook
- type EventType
- type Hook
- func (h *Hook) Action(obj interface{}, resourceType int, eventType EventType) error
- func (h *Hook) ActionExists(resourceType int, eventType EventType) bool
- func (h *Hook) ExecuteHookOnBackendPV(client kubernetes.Interface, ctx context.Context, ns, backendPvcName string, ...) error
- func (h *Hook) ExecuteHookOnBackendPVC(client kubernetes.Interface, ctx context.Context, ns, backendPvcName string, ...) error
- func (h *Hook) ExecuteHookOnNFSDeployment(client kubernetes.Interface, ctx context.Context, ns, deployName string, ...) error
- func (h *Hook) ExecuteHookOnNFSPV(client kubernetes.Interface, ctx context.Context, pvName string, ...) error
- func (h *Hook) ExecuteHookOnNFSService(client kubernetes.Interface, ctx context.Context, ns, serviceName string, ...) error
- type HookConfig
- type PVCHook
- type PVHook
- type ServiceHook
- type TemplateVarName
Constants ¶
const ( // Type of resources created by nfs-provisioner ResourceBackendPVC int = iota ResourceBackendPV ResourceNFSService ResourceNFSPV ResourceNFSServerDeployment )
const HookVersion = "1.0.0"
HookVersion represent the hook config version
Variables ¶
var ( // ActionForEventMap stores the supported EventType for all ActionType ActionForEventMap = map[ActionType]struct { evType EventType actOp ActionOp }{ ActionAddOnCreateVolumeEvent: {/* contains filtered or unexported fields */}, ActionRemoveOnCreateVolumeEvent: {/* contains filtered or unexported fields */}, ActionAddOnDeleteVolumeEvent: {/* contains filtered or unexported fields */}, ActionRemoveOnDeleteVolumeEvent: {/* contains filtered or unexported fields */}, } )
Functions ¶
func AddAnnotations ¶
func AddAnnotations(objMeta *metav1.ObjectMeta, annotations map[string]string)
AddAnnotations add given annotations to given meta object Object annotations will be overridden if any of the given annotations exists with the same key
Types ¶
type ActionType ¶
type ActionType string
ActionType defines type of action for the hook entry
const ( // ActionAddOnCreateVolumeEvent represent add action on volume create Event ActionAddOnCreateVolumeEvent ActionType = "addOrUpdateEntriesOnCreateVolumeEvent" // ActionRemoveOnCreateVolumeEvent represent remove action on volume create Event ActionRemoveOnCreateVolumeEvent ActionType = "removeEntriesOnCreateVolumeEvent" // ActionAddOnDeleteVolumeEvent represent add action on volume delete Event ActionAddOnDeleteVolumeEvent ActionType = "addOrUpdateEntriesOnDeleteVolumeEvent" // ActionRemoveOnDeleteVolumeEvent represent remove action on volume delete Event ActionRemoveOnDeleteVolumeEvent ActionType = "removeEntriesOnDeleteVolumeEvent" )
type DeploymentHook ¶
type DeploymentHook struct { // Annotations needs to be added/removed on/from the Deployment Annotations map[string]string `json:"annotations,omitempty"` // Finalizers needs to be added/removed on/from the Deployment Finalizers []string `json:"finalizers,omitempty"` }
DeploymentHook defines the field which will be updated for Deployment Hook Action
type EventType ¶
type EventType string
EventType defines the type of events on which hook needs to be executed
type Hook ¶
type Hook struct { //Config represent the list of HookConfig Config map[ActionType]HookConfig `json:"hooks"` // Version represent HookConfig format version; includes major, minor and patch version Version string `json:"version"` // contains filtered or unexported fields }
Hook stores HookConfig and its version
func ParseHooks ¶
ParseHooks will parse the given data and return generated Hook object
func (*Hook) Action ¶
Action run hooks for the given object type as per the event Action will skip further hook execution if any error occurred
func (*Hook) ActionExists ¶
ActionExists will check if action exists for the give resource type and event type
func (*Hook) ExecuteHookOnBackendPV ¶
func (h *Hook) ExecuteHookOnBackendPV(client kubernetes.Interface, ctx context.Context, ns, backendPvcName string, eventType EventType) error
ExecuteHookOnBackendPV will execute the hook on the PV for given PVC and patch it
func (*Hook) ExecuteHookOnBackendPVC ¶
func (h *Hook) ExecuteHookOnBackendPVC(client kubernetes.Interface, ctx context.Context, ns, backendPvcName string, eventType EventType) error
ExecuteHookOnBackendPV will execute the hook on the PV for given PVC and patch it
func (*Hook) ExecuteHookOnNFSDeployment ¶
func (h *Hook) ExecuteHookOnNFSDeployment(client kubernetes.Interface, ctx context.Context, ns, deployName string, eventType EventType) error
ExecuteHookOnNFSDeployment will execute the hook on the given deployment and patch it
func (*Hook) ExecuteHookOnNFSPV ¶
func (h *Hook) ExecuteHookOnNFSPV(client kubernetes.Interface, ctx context.Context, pvName string, eventType EventType) error
ExecuteHookOnNFSPV will execute the hook on the given PV and patch it
func (*Hook) ExecuteHookOnNFSService ¶
func (h *Hook) ExecuteHookOnNFSService(client kubernetes.Interface, ctx context.Context, ns, serviceName string, eventType EventType) error
ExecuteHookOnNFSService will execute the hook on the given service and patch it
type HookConfig ¶
type HookConfig struct { // Name represent hook name Name string `json:"name"` // NFSPVConfig represent config for NFSPV resource NFSPVConfig *PVHook `json:"nfsPV,omitempty"` // BackendPVConfig represent config for BackendPV resource BackendPVConfig *PVHook `json:"backendPV,omitempty"` // BackendPVCConfig represent config for BackendPVC resource BackendPVCConfig *PVCHook `json:"backendPVC,omitempty"` // NFSServiceConfig represent config for NFS Service resource NFSServiceConfig *ServiceHook `json:"nfsService,omitempty"` // NFSDeploymentConfig represent config for NFS Deployment resource NFSDeploymentConfig *DeploymentHook `json:"nfsDeployment,omitempty"` }
HookConfig represent the to be executed by nfs-provisioner
type PVCHook ¶
type PVCHook struct { // Annotations needs to be added/removed on/from the PVC Annotations map[string]string `json:"annotations,omitempty"` // Finalizers needs to be added/removed on/from the PVC Finalizers []string `json:"finalizers,omitempty"` }
PVCHook defines the field which will be updated for PVC Hook Action
type PVHook ¶
type PVHook struct { // Annotations needs to be added/removed on/from the PV Annotations map[string]string `json:"annotations,omitempty"` // Finalizers needs to be added/removed on/from the PV Finalizers []string `json:"finalizers,omitempty"` }
PVHook defines the field which will be updated for PV Hook Action
type ServiceHook ¶
type ServiceHook struct { // Annotations needs to be added/removed on/from the Service Annotations map[string]string `json:"annotations,omitempty"` // Finalizers needs to be added/removed on/from the Service Finalizers []string `json:"finalizers,omitempty"` }
ServiceHook defines the field which will be updated for Service Hook Action
type TemplateVarName ¶
type TemplateVarName string
TemplateVarName represent template variable
const ( // TemplateVarCurrentTime defines variable name for Current Time TemplateVarCurrentTime TemplateVarName = "$current-time" )