Documentation ¶
Overview ¶
* Copyright The Kmesh 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 The Kmesh 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 ¶
- func AnnotationEnabled(annotation string) bool
- func AtomicCopy(srcFilepath, targetDir, targetFilename string) error
- func AtomicWrite(path string, data []byte, mode os.FileMode) error
- func CreateK8sClientSet(kubeconfig string) (kubernetes.Interface, error)
- func DelKmeshRedirectAnnotation(client kubernetes.Interface, pod *corev1.Pod) error
- func Execute(cmd string, args []string) error
- func ExecuteWithRedirect(cmd string, args []string, stdout io.Writer) error
- func GetK8sclient() (kubernetes.Interface, error)
- func GetKernelVersion() string
- func GetMapByName(name string) (*ebpf.Map, error)
- func GetProgramByName(name string) (*ebpf.Program, error)
- func HandleKmeshManage(ns string, enroll bool) error
- func Ifname2ifindex(ifname string) (int, error)
- func KernelVersionLowerThan5_13() bool
- func PatchKmeshRedirectAnnotation(client kubernetes.Interface, pod *corev1.Pod) error
- func ShouldEnroll(pod *corev1.Pod, ns *corev1.Namespace) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnnotationEnabled ¶
func AtomicCopy ¶
AtomicCopy copies file by reading the file then writing atomically into the target directory
func AtomicWrite ¶
create a temp file and rename to path
func CreateK8sClientSet ¶
func CreateK8sClientSet(kubeconfig string) (kubernetes.Interface, error)
CreateK8sClientSet creates a Kubernetes clientset from a kubeconfig file
func DelKmeshRedirectAnnotation ¶
func DelKmeshRedirectAnnotation(client kubernetes.Interface, pod *corev1.Pod) error
func ExecuteWithRedirect ¶
func GetK8sclient ¶
func GetK8sclient() (kubernetes.Interface, error)
func GetKernelVersion ¶
func GetKernelVersion() string
GetKernelVersion return part of the result of 'uname -a' like '5.15.153.1-xxxx'
func HandleKmeshManage ¶
func Ifname2ifindex ¶
func KernelVersionLowerThan5_13 ¶
func KernelVersionLowerThan5_13() bool
KernelVersionLowerThan5_13 return whether the current kernel version is lower than 5.13, and will fallback to less BPF log ability(return true) if error
func PatchKmeshRedirectAnnotation ¶
func PatchKmeshRedirectAnnotation(client kubernetes.Interface, pod *corev1.Pod) error
func ShouldEnroll ¶
ShouldEnroll checks whether a pod should be managed by kmesh. Kmesh manages a pod if a pod has "istio.io/dataplane-mode: kmesh" label or the namespace where it resides has the label while pod have no "istio.io/dataplane-mode: none" label Excluding cases: a pod has sidecar injected, or the pod is istio managed waypoint https://github.com/istio/istio/blob/33539491628fe5f3ad4f5f1fb339b0da9455c028/manifests/charts/istio-control/istio-discovery/files/waypoint.yaml#L35
Types ¶
This section is empty.