Documentation ¶
Overview ¶
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func DeduplicateItems(included []string, excluded []string) (res []string)
- func ExtractNamespaceLabel(instance *policiesv1alpha1.TrustedNodePolicy) string
- func FindPattern(pattern string, list []string) (result []string)
- func GetAllNamespaces() (list []string, err error)
- func GetGenericObject(data []byte, namespace string) (unstructured.Unstructured, error)
- func GetSelectedNamespaces(included, excluded, allNamespaces []string) []string
- func IfMatch(name string, included, excluded []string) bool
- func Initialize(kClient *kubernetes.Interface, cfg *rest.Config)
- func MatchNames(all, included, excluded []string) []string
- func Round(num float64) int
- func ToFixed(num float64, precision int) float64
- type SyncedPolicyMap
Constants ¶
This section is empty.
Variables ¶
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 DeduplicateItems ¶
DeduplicateItems does the dedup
func ExtractNamespaceLabel ¶
func ExtractNamespaceLabel(instance *policiesv1alpha1.TrustedNodePolicy) 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 GetGenericObject ¶
func GetGenericObject(data []byte, namespace string) (unstructured.Unstructured, error)
GetGenericObject returns a generic object information from the k8s API server
func GetSelectedNamespaces ¶
================================================================= GetSelectedNamespaces returns the list of filtered namespaces according to the policy namespace selector
func Initialize ¶
func Initialize(kClient *kubernetes.Interface, cfg *rest.Config)
Initialize to initialize some controller variables
func MatchNames ¶
MatchNames matches names
Types ¶
type SyncedPolicyMap ¶
type SyncedPolicyMap struct { PolicyMap map[string]*policiesv1alpha1.TrustedNodePolicy //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 *policiesv1alpha1.TrustedNodePolicy)
AddObject safely add to map
func (*SyncedPolicyMap) GetObject ¶
func (spm *SyncedPolicyMap) GetObject(key string) (value *policiesv1alpha1.TrustedNodePolicy, 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