github.com/cilium/cilium@v1.16.2/pkg/endpoint/regeneration/regeneration_context.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package regeneration 5 6 import ( 7 "context" 8 ) 9 10 // DatapathRegenerationLevel determines what is expected of the datapath when 11 // a regeneration event is processed. 12 type DatapathRegenerationLevel int 13 14 const ( 15 // Invalid is the default level to enforce explicit setting of 16 // the regeneration level. 17 Invalid DatapathRegenerationLevel = iota 18 // RegenerateWithoutDatapath indicates that datapath rebuild or reload 19 // is not required to implement this regeneration. 20 RegenerateWithoutDatapath 21 // RegenerateWithDatapath indicates that the datapath must be 22 // recompiled and reloaded to implement this regeneration. 23 RegenerateWithDatapath 24 ) 25 26 // String converts a DatapathRegenerationLevel into a human-readable string. 27 func (r DatapathRegenerationLevel) String() string { 28 switch r { 29 case Invalid: 30 return "invalid" 31 case RegenerateWithoutDatapath: 32 return "no-rebuild" 33 case RegenerateWithDatapath: 34 return "rewrite+load" 35 default: 36 break 37 } 38 return "BUG: Unknown DatapathRegenerationLevel" 39 } 40 41 // ExternalRegenerationMetadata contains any information about a regeneration that 42 // the endpoint subsystem should be made aware of for a given endpoint. 43 type ExternalRegenerationMetadata struct { 44 // Reason provides context to source for the regeneration, which is 45 // used to generate useful log messages. 46 Reason string 47 48 // RegenerationLevel forces datapath regeneration according to the 49 // levels defined in the DatapathRegenerationLevel description. 50 RegenerationLevel DatapathRegenerationLevel 51 52 ParentContext context.Context 53 }