Documentation ¶
Index ¶
- Variables
- func CreateRecorder(kubeClient kubernetes.Interface, componentName string) (record.EventRecorder, error)
- func DeduplicateItems(included []string, excluded []string) (res []string)
- func ExtractNamespaceLabel(instance *policyv1.ConfigurationPolicy) string
- func FindPattern(pattern string, list []string) (result []string)
- func GetAllNamespaces() (list []string, err error)
- func GetOperatorNamespace() (string, error)
- func GetSelectedNamespaces(included, excluded, allNamespaces []string) []string
- func GetWatchNamespace() (string, error)
- func IfMatch(name string, included, excluded []string) bool
- func Initialize(kClient kubernetes.Interface, cfg *rest.Config)
- func LoadHubConfig(namespace string, secretname string) (*rest.Config, error)
- func MatchNames(all, included, excluded []string) []string
- func Round(num float64) int
- func ToFixed(num float64, precision int) float64
- type RunModeType
- type SyncedPolicyMap
Constants ¶
This section is empty.
Variables ¶
var ErrNoNamespace = fmt.Errorf("namespace not found for current environment")
ErrNoNamespace indicates that a namespace could not be found for the current environment
var ErrRunLocal = fmt.Errorf("operator run mode forced to local")
ErrRunLocal indicates that the operator is set to run in local mode (this error is returned by functions that only work on operators running in cluster mode)
var HubConfig *rest.Config
var KubeClient kubernetes.Interface
KubeClient a k8s client used for k8s native resources
var KubeConfig *rest.Config
KubeConfig is the given kubeconfig at startup
Functions ¶
func CreateRecorder ¶
func CreateRecorder(kubeClient kubernetes.Interface, componentName string) (record.EventRecorder, error)
CreateRecorder return recorder
func DeduplicateItems ¶
DeduplicateItems does the dedup
func ExtractNamespaceLabel ¶
func ExtractNamespaceLabel(instance *policyv1.ConfigurationPolicy) string
ExtractNamespaceLabel to find out the cluster-namespace from the label
func FindPattern ¶
FindPattern finds patterns
func GetAllNamespaces ¶
GetAllNamespaces gets the list of all namespaces from k8s
func GetOperatorNamespace ¶
GetOperatorNamespace returns the namespace the operator should be running in.
func GetSelectedNamespaces ¶
GetSelectedNamespaces returns the list of filtered namespaces according to the policy namespace selector
func GetWatchNamespace ¶
GetWatchNamespace returns the Namespace the operator should be watching for changes
func Initialize ¶
func Initialize(kClient kubernetes.Interface, cfg *rest.Config)
Initialize to initialize some controller variables
func MatchNames ¶
MatchNames matches names
Types ¶
type RunModeType ¶
type RunModeType string
const ( ForceRunModeEnv = "OSDK_FORCE_RUN_MODE" LocalRunMode RunModeType = "local" ClusterRunMode RunModeType = "cluster" )
type SyncedPolicyMap ¶
type SyncedPolicyMap struct { PolicyMap map[string]*policiesv1.ConfigurationPolicy // Mx for making the map thread safe Mx sync.RWMutex }
SyncedPolicyMap a thread safe map
func (*SyncedPolicyMap) AddObject ¶
func (spm *SyncedPolicyMap) AddObject(key string, plc *policiesv1.ConfigurationPolicy)
AddObject safely add to map
func (*SyncedPolicyMap) GetObject ¶
func (spm *SyncedPolicyMap) GetObject(key string) (value *policiesv1.ConfigurationPolicy, found bool)
GetObject used for fetching objects from the synced map
func (*SyncedPolicyMap) RemoveObject ¶
func (spm *SyncedPolicyMap) RemoveObject(key string)
RemoveObject safely remove from map