Documentation
¶
Index ¶
- Constants
- Variables
- func GetInjectedVolumeMountsAndEnvs(control SidecarControl, sidecarContainer *appsv1alpha1.SidecarContainer, ...) ([]corev1.VolumeMount, []corev1.EnvVar)
- func GetPodSidecarSetRevision(sidecarSetName string, pod metav1.Object) string
- func GetPodSidecarSetWithoutImageRevision(sidecarSetName string, pod metav1.Object) string
- func GetPodsSortFunc(pods []*corev1.Pod, waitUpdateIndexes []int) func(i, j int) bool
- func GetSidecarContainersInPod(sidecarSet *appsv1alpha1.SidecarSet) sets.String
- func GetSidecarSetRevision(sidecarSet *appsv1alpha1.SidecarSet) string
- func GetSidecarSetWithoutImageRevision(sidecarSet *appsv1alpha1.SidecarSet) string
- func GetSidecarTransferEnvs(sidecarContainer *appsv1alpha1.SidecarContainer, pod *corev1.Pod) (injectedEnvs []corev1.EnvVar)
- func IsActivePod(pod *corev1.Pod) bool
- func IsInjectedSidecarContainerInPod(container *corev1.Container) bool
- func IsPodSidecarUpdated(sidecarSet *appsv1alpha1.SidecarSet, pod *corev1.Pod) bool
- func IsSharePodVolumeMounts(container *appsv1alpha1.SidecarContainer) bool
- func PodMatchedSidecarSet(pod *corev1.Pod, sidecarSet appsv1alpha1.SidecarSet) (bool, error)
- type SidecarControl
- type SidecarSetUpgradeSpec
Constants ¶
View Source
const ( // SidecarSetHashAnnotation represents the key of a sidecarSet hash SidecarSetHashAnnotation = "kruise.io/sidecarset-hash" // SidecarSetHashWithoutImageAnnotation represents the key of a sidecarset hash without images of sidecar SidecarSetHashWithoutImageAnnotation = "kruise.io/sidecarset-hash-without-image" // SidecarSetListAnnotation represent sidecarset list that injected pods SidecarSetListAnnotation = "kruise.io/sidecarset-injected-list" // SidecarEnvKey specifies the environment variable which record a container as injected SidecarEnvKey = "IS_INJECTED" // SidecarsetInplaceUpdateStateKey records the state of inplace-update. // The value of annotation is SidecarsetInplaceUpdateStateKey. SidecarsetInplaceUpdateStateKey string = "kruise.io/sidecarset-inplace-update-state" )
Variables ¶
View Source
var ( // SidecarIgnoredNamespaces specifies the namespaces where Pods won't get injected SidecarIgnoredNamespaces = []string{"kube-system", "kube-public"} // SubPathExprEnvReg format: $(ODD_NAME)、$(POD_NAME)... SubPathExprEnvReg, _ = regexp.Compile(`\$\(([-._a-zA-Z][-._a-zA-Z0-9]*)\)`) )
Functions ¶
func GetInjectedVolumeMountsAndEnvs ¶
func GetInjectedVolumeMountsAndEnvs(control SidecarControl, sidecarContainer *appsv1alpha1.SidecarContainer, pod *corev1.Pod) ([]corev1.VolumeMount, []corev1.EnvVar)
func GetPodsSortFunc ¶
func GetSidecarContainersInPod ¶
func GetSidecarContainersInPod(sidecarSet *appsv1alpha1.SidecarSet) sets.String
func GetSidecarSetRevision ¶
func GetSidecarSetRevision(sidecarSet *appsv1alpha1.SidecarSet) string
func GetSidecarSetWithoutImageRevision ¶
func GetSidecarSetWithoutImageRevision(sidecarSet *appsv1alpha1.SidecarSet) string
func GetSidecarTransferEnvs ¶
func GetSidecarTransferEnvs(sidecarContainer *appsv1alpha1.SidecarContainer, pod *corev1.Pod) (injectedEnvs []corev1.EnvVar)
func IsActivePod ¶
IsActivePod determines the pod whether need be injected and updated
func IsPodSidecarUpdated ¶
func IsPodSidecarUpdated(sidecarSet *appsv1alpha1.SidecarSet, pod *corev1.Pod) bool
whether this pod has been updated based on the latest sidecarSet
func IsSharePodVolumeMounts ¶
func IsSharePodVolumeMounts(container *appsv1alpha1.SidecarContainer) bool
func PodMatchedSidecarSet ¶
func PodMatchedSidecarSet(pod *corev1.Pod, sidecarSet appsv1alpha1.SidecarSet) (bool, error)
PodMatchSidecarSet determines if pod match Selector of sidecar.
Types ¶
type SidecarControl ¶
type SidecarControl interface { //common // get sidecarset GetSidecarset() *appsv1alpha1.SidecarSet // inject // whether need inject the volumeMount into container IsNeedInjectVolumeMount(volumeMount v1.VolumeMount) bool // when update pod, judge whether inject sidecar container into pod NeedInjectOnUpdatedPod(pod, oldPod *v1.Pod, sidecarContainer *appsv1alpha1.SidecarContainer, injectedEnvs []v1.EnvVar, injectedMounts []v1.VolumeMount) (needInject bool, existSidecars []*appsv1alpha1.SidecarContainer, existVolumes []v1.Volume) // update // pod whether consistent and ready IsPodConsistentAndReady(pod *v1.Pod) bool // update pod sidecar container to sidecarSet latest version UpdateSidecarContainerToLatest(containerInSidecarSet, containerInPod v1.Container) v1.Container // update pod information in upgrade UpdatePodAnnotationsInUpgrade(changedContainers []string, pod *v1.Pod) // IsPodUpdatedConsistent indicates whether pod.spec and pod.status are consistent after updating the sidecar containers IsPodUpdatedConsistent(pod *v1.Pod, ignoreContainers sets.String) bool // Is sidecarset can upgrade pods IsSidecarSetCanUpgrade(pod *v1.Pod) bool }
func New ¶
func New(cs *appsv1alpha1.SidecarSet) SidecarControl
Click to show internal directories.
Click to hide internal directories.