Documentation ¶
Index ¶
- Constants
- func Add(ctx context.Context, c *appconfig.CompletedConfig, mgr manager.Manager) error
- func CloneAndAddLabel(labels map[string]string, labelKey, labelValue string) map[string]string
- func Format(format string, args ...interface{}) string
- func GetDaemonsetPods(c client.Client, 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(c client.Client, nodeName string) (bool, error)
- func SetPodUpgradeCondition(c client.Client, ds *appsv1.DaemonSet, pod *corev1.Pod) error
- type ReconcileDaemonpodupdater
Constants ¶
const ( // UpdateAnnotation is the annotation key used in DaemonSet spec to indicate // which update strategy is selected. Currently, "OTA" and "AdvancedRollingUpdate" 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" AdvancedRollingUpdate = "AdvancedRollingUpdate" // 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=AdvancedRollingUpdate". // 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 Add ¶
Add creates a new Daemonpodupdater Controller and adds it to the Manager with default RBAC. The Manager will set fields on the Controller and Start it when the Manager is Started.
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 ¶
NodeReadyByName check if the given node is ready
Types ¶
type ReconcileDaemonpodupdater ¶
ReconcileDaemonpodupdater reconciles a DaemonSet object
func (*ReconcileDaemonpodupdater) InjectConfig ¶
func (r *ReconcileDaemonpodupdater) InjectConfig(cfg *rest.Config) error
func (*ReconcileDaemonpodupdater) Reconcile ¶
func (r *ReconcileDaemonpodupdater) Reconcile(_ context.Context, request reconcile.Request) (reconcile.Result, error)
Reconcile reads that state of the cluster for a DaemonSet object and makes changes based on the state read and what is in the DaemonSet.Spec