Commit Graph

46 Commits

Author SHA1 Message Date
Clayton Coleman
8d8884a907
daemonset: Remove unnecessary error returns in strategy code
The nodeShouldRunDaemonPod method does not need to return an error
because there are no scenarios under which it fails. Remove the
error return path for its direct calls as well.
2021-03-01 13:23:18 -05:00
Clayton Coleman
9f296c133d
daemonset: Simplify the logic for calculating unavailable pods
In order to maintain the correct invariants, the existing maxUnavailable
logic calculated the same data several times in different ways. Leverage
the simpler structure from maxSurge and calculate pod availability only
once, as well as perform only a single pass over all the pods in the
daemonset. This changed no behavior of the current controller, and
has a structure that is almost identical to maxSurge.
2021-03-01 13:23:16 -05:00
Clayton Coleman
18f43e4120
daemonset: Implement MaxSurge on daemonset update
If MaxSurge is set, the controller will attempt to double up nodes
up to the allowed limit with a new pod, and then when the most recent
(by hash) pod is ready, trigger deletion on the old pod. If the old
pod goes unready before the new pod is ready, the old pod is immediately
deleted. If an old pod goes unready before a new pod is placed on that
node, a new pod is immediately added for that node even past the MaxSurge
limit.

The backoff clock is used consistently throughout the daemonset controller
as an injectable clock for the purposes of testing.
2021-03-01 13:21:12 -05:00
Renato Viana
316eff8dee Fixed percentage behavior in instr
fixed syntax, wrote a test

fixed a test

.

1

Update staging/src/k8s.io/apimachinery/pkg/util/intstr/intstr_test.go

Co-Authored-By: Joel Speed <Joel.speed@hotmail.co.uk>

added test

.

fix

fix test

fixed a test

gofmt

lint

fix

function name

validation fix

.

godocs added

.
2020-09-30 21:23:05 +01:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
Mike Danese
c58e69ec79 automated refactor 2020-03-05 14:59:46 -08:00
Mike Danese
25651408ae generated: run refactor 2020-02-08 12:30:21 -05:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
Abdullah Gharaibeh
7d604c318c Break DS controller on scheduler predicates and predicate errors 2020-01-03 13:05:07 -05:00
David Xia
fabfd950b1
cleanup: fix some log and error capitalizations
Part of https://github.com/kubernetes/kubernetes/issues/15863
2019-07-20 18:26:16 -04:00
Ted Yu
eebd8d2690 Remove unnecessary map in cleanupHistory 2019-04-02 15:45:49 -07:00
draveness
36c535cf42 fix: list nodes in sync daemonset 2019-04-02 13:54:28 +08:00
Jordan Liggitt
f100a762bc Stop using apps/v1beta1 in tests 2019-01-31 10:12:38 -05:00
Weibin Lin
842bd1e1ec update deployment, daemonset, replicaset, statefulset to apps/v1 2018-12-19 10:46:45 -05:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
Janet Kuo
fd7a694440 Avoid unnecessary DaemonSet collisionCount bump 2018-08-15 16:16:41 -07:00
Morten Torkildsen
a93ea43e15 Fix to handle hash collisions correctly for DaemonSet 2018-08-08 13:43:43 -07:00
Janet Kuo
666a41c2ea Safe encode template hash value to make it consistent with resource name 2018-07-13 09:52:26 -07:00
Kenneth Owens
f52e7ef4bf Update the DaemonSet controller to use the apps/v1 API 2018-02-22 11:38:54 -08:00
Kevin
4c8539cece use core client with explicit version globally 2017-10-27 15:48:32 +08:00
mattjmcnaughton
8323fb4b4f Modify apimachinery imports using staging
Currently some of the imports of `apimachinery` use
`k8s.io/kubernetes/staging/src/k8s.io/apimachinery...`. Replace
these with `k8s.io/apimachinery`, as is in use throughout the rest
of the code base.

Signed-off-by: mattjmcnaughton <mattjmcnaughton@gmail.com>
2017-09-10 10:19:30 -04:00
Kubernetes Submit Queue
52e3fdacbb Merge pull request #51538 from kow3ns/less-ugly-names
Automatic merge from submit-queue (batch tested with PRs 51553, 51538, 51663, 51069, 51737)

Consistent Names for ControllerRevisions, ReplicaSets, and objects using GenerateName

**What this PR does / why we need it**:
Adds the rand.SafeEncodeString function and uses this function to generate names for ReplicaSets and ControllerRevisions.

```release-note
The names generated for ControllerRevision and ReplicaSet are consistent with the GenerateName functionality of the API Server and will not contain "bad words".
```
2017-09-02 21:57:59 -07:00
Kenneth Owens
8ad18bf2ec Ensures that the DaemonSet controller does not launch a Pod on a Node while waiting for a Pod that it has previously created to terminate. 2017-08-31 10:29:03 -07:00
Kenneth Owens
313a8b304a Adds the rand.SafeEncodeString function and uses this function to
generate names for ReplicaSets and ControllerRevisions.
2017-08-30 14:01:11 -07:00
Dr. Stefan Schimanski
1d053c4f7c controllers: simplify deepcopy calls 2017-08-29 19:21:24 +02:00
Di Xu
85602fd542 CollisionCount should have type int32 across controllers that use it for collision avoidance 2017-08-18 10:48:12 +08:00
Mikhail Mazurskiy
042b5642b9
Migrate to NewControllerRef from meta/v1 package 2017-08-06 22:43:46 +10:00
Jacob Simpson
a765b8cfca Migrate api.Scheme to scheme.Scheme 2017-07-17 15:05:38 -07:00
Chao Xu
60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu
cde4772928 run ./root-rewrite-all-other-apis.sh, then run make all, pkg/... compiles 2017-06-22 11:30:52 -07:00
Chao Xu
f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
Janet Kuo
52a05d1632 Do not add unique label to DaemonSet 2017-06-13 17:04:27 -07:00
Janet Kuo
f43060ea41 Construct history once and pass around in DaemonSet sync loop 2017-06-13 17:04:27 -07:00
Janet Kuo
0035d86248 Update adoption/release of DaemonSet controller history 2017-06-12 23:33:31 -07:00
Janet Kuo
2b8f91e549 Update kubectl rollout to consume .data of DaemonSet history
Also update tset data to make sure DaemonSet template is replaced, not
merged, when rolling back.
2017-06-10 10:52:33 -07:00
Janet Kuo
f9070b6ace Change what is stored in DaemonSet history .data
In DaemonSet history `.data`, store a strategic merge patch that can be
applied to restore a DaemonSet. Only PodSpecTemplate is saved.
2017-06-10 10:52:33 -07:00
Janet Kuo
edabdac094 Implement kubectl rollout history and undo for DaemonSet 2017-06-03 17:10:57 -07:00
Janet Kuo
85ec49c9bb Verify histories and pods in DaemonSet e2e test 2017-06-03 00:46:11 -07:00
Janet Kuo
d02f40a5e7 Implement DaemonSet history logic in controller
1. Create controllerrevisions (history) and label pods with template
   hash for both RollingUpdate and OnDelete update strategy
2. Clean up old, non-live history based on revisionHistoryLimit
3. Remove duplicate controllerrevisions (the ones with the same template)
   and relabel their pods
4. Update RBAC to allow DaemonSet controller to manage
   controllerrevisions
5. In DaemonSet controller unit tests, create new pods with hash labels
2017-06-03 00:44:23 -07:00
yupengzte
e463c28db6 delete err when return _
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-05-16 16:15:06 +08:00
Łukasz Oleś
0f75e56722 Pods marked for deletion should be counted as unavailable 2017-04-18 22:32:59 +02:00
Chao Xu
4f9591b1de move pkg/api/v1/ref.go and pkg/api/v1/resource.go to subpackages. move some functions in resource.go to pkg/api/v1/node and pkg/api/v1/pod 2017-04-17 11:38:11 -07:00
Anthony Yeh
fac372d090 DaemonSet: Relist Pods before each phase of sync.
The design of DaemonSet requires a relist before each phase (manage,
update, status) because it does not short-circuit and requeue for each
action triggered.
2017-03-07 16:42:29 -08:00
Anthony Yeh
421e0bbd83 DaemonSet: Use ControllerRefManager to adopt/orphan. 2017-03-07 16:42:28 -08:00
Łukasz Oleś
620310c12f Move TemplateGeneration to the Spec 2017-02-27 09:15:56 +01:00
Łukasz Oleś
b27308c317 DaemonSet updates
It implements https://github.com/kubernetes/community/blob/master/contributors/design-proposals/daemonset-update.md
Feature https://github.com/kubernetes/features/issues/124
2017-02-27 09:15:56 +01:00