Documentation ¶
Index ¶
- Constants
- func CloneAndAddLabel(labels map[string]string, labelKey, labelValue string) map[string]string
- func GetDaemonsetPods(podLister corelisters.PodLister, ds *appsv1.DaemonSet) ([]*corev1.Pod, error)
- func GetPodUpgradeCondition(status corev1.PodStatus) *corev1.PodCondition
- func GetTargetNodeName(pod *corev1.Pod) (string, error)
- func GetTemplateGeneration(ds *appsv1.DaemonSet) (*int64, error)
- func IsDaemonsetPodLatest(ds *appsv1.DaemonSet, pod *corev1.Pod) bool
- func IsPodUpdatable(pod *corev1.Pod) bool
- func IsPodUpgradeConditionTrue(status corev1.PodStatus) bool
- func NodeReady(nodeStatus *corev1.NodeStatus) bool
- func NodeReadyByName(nodeList corelisters.NodeLister, nodeName string) (bool, error)
- func SetPodUpgradeCondition(clientset client.Interface, ds *appsv1.DaemonSet, pod *corev1.Pod) error
- type Controller
Constants ¶
const ( // UpdateAnnotation is the annotation key used in daemonset spec to indicate // which update strategy is selected. Currently, "ota" and "auto" are supported. UpdateAnnotation = "apps.openyurt.io/update-strategy" // OTAUpdate set daemonset to over-the-air update mode. // In daemonPodUpdater controller, we add PodNeedUpgrade condition to pods. OTAUpdate = "ota" // AutoUpdate set daemonset to auto update mode. // In this mode, daemonset will keep updating even if there are not-ready nodes. // For more details, see https://github.com/openyurtio/openyurt/pull/921. AutoUpdate = "auto" // PodNeedUpgrade indicates whether the pod is able to upgrade. PodNeedUpgrade corev1.PodConditionType = "PodNeedUpgrade" // MaxUnavailableAnnotation is the annotation key added to daemonset to indicate // the max unavailable pods number. It's used with "apps.openyurt.io/update-strategy=auto". // If this annotation is not explicitly stated, it will be set to the default value 1. // BurstReplicas is a rate limiter for booting pods on a lot of pods. // The value of 250 is chosen b/c values that are too high can cause registry DoS issues. BurstReplicas = 250 )
Variables ¶
This section is empty.
Functions ¶
func CloneAndAddLabel ¶
CloneAndAddLabel clones the given map and returns a new map with the given key and value added. Returns the given map, if labelKey is empty.
func GetDaemonsetPods ¶
GetDaemonsetPods get all pods belong to the given daemonset
func GetPodUpgradeCondition ¶
func GetPodUpgradeCondition(status corev1.PodStatus) *corev1.PodCondition
GetPodUpgradeCondition extracts the pod upgrade condition from the given status and returns that. Returns nil if the condition is not present.
func GetTargetNodeName ¶
GetTargetNodeName get the target node name of DaemonSet pods. If `.spec.NodeName` is not empty (nil), return `.spec.NodeName`; otherwise, retrieve node name of pending pods from NodeAffinity. Return error if failed to retrieve node name from `.spec.NodeName` and NodeAffinity.
func GetTemplateGeneration ¶
GetTemplateGeneration get annotation "deprecated.daemonset.template.generation" of the given daemonset
func IsDaemonsetPodLatest ¶
IsDaemonsetPodLatest check whether pod is the latest by comparing its Spec with daemonset's If pod is latest, return true, otherwise return false
func IsPodUpdatable ¶
IsPodUpdatable returns true if a pod is updatable; false otherwise.
func IsPodUpgradeConditionTrue ¶
IsPodUpgradeConditionTrue returns true if a pod is updatable; false otherwise.
func NodeReady ¶
func NodeReady(nodeStatus *corev1.NodeStatus) bool
NodeReady check if the given node status is ready
func NodeReadyByName ¶
func NodeReadyByName(nodeList corelisters.NodeLister, nodeName string) (bool, error)
NodeReadyByName check if the given node is ready
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(kc client.Interface, daemonsetInformer appsinformers.DaemonSetInformer, nodeInformer coreinformers.NodeInformer, podInformer coreinformers.PodInformer) *Controller
func (*Controller) Run ¶
func (c *Controller) Run(threadiness int, stopCh <-chan struct{})