-
Notifications
You must be signed in to change notification settings - Fork 225
chore: introduce the instance crd #9546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Auto Cherry-pick Instructions
|
/nopick |
0f9f3f1
to
d169a30
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #9546 +/- ##
==========================================
- Coverage 59.94% 59.62% -0.32%
==========================================
Files 518 551 +33
Lines 56636 59931 +3295
==========================================
+ Hits 33948 35734 +1786
- Misses 19636 20936 +1300
- Partials 3052 3261 +209
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d169a30
to
688d714
Compare
6154703
to
f9cfcae
Compare
428a60d
to
611875e
Compare
611875e
to
784684f
Compare
784684f
to
3f2d28d
Compare
What's the main advantage of introducing the new instance api? |
snapshotVersion := strconv.FormatInt(event.EventTime.UnixMicro(), 10) | ||
lastSnapshotVersion, ok := pod.Annotations[constant.LastRoleSnapshotVersionAnnotationKey] | ||
if ok { | ||
if snapshotVersion <= lastSnapshotVersion && !strings.Contains(lastSnapshotVersion, ":") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bug related to time comparison will be introduced here. It will be triggered in about 200 years, although we'll all be gone by then. :) It's recommended to also compare the lengths of the two strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
func (r *revisionUpdateReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubebuilderx.Result, error) { | ||
its, _ := tree.GetRoot().(*workloads.InstanceSet) | ||
|
||
updatedReplicas, err := r.calculateUpdatedReplicas(its, tree.List(&workloads.Instance{})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err
is always nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
} | ||
} | ||
|
||
// TODO: ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code was introduced by #8151. I think it's still useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not supported within the instance API.
// merge pvcs | ||
for i := range newInst.Spec.VolumeClaimTemplates { | ||
newPVC := &newInst.Spec.VolumeClaimTemplates[i] | ||
oldPVC := &targetInst.Spec.VolumeClaimTemplates[i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential out-of-bound error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
|
||
copyNMergeAssistantObjects := func() { | ||
for i := range newInst.Spec.InstanceAssistantObjects { | ||
oldObj := &targetInst.Spec.InstanceAssistantObjects[i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
} | ||
return true | ||
case []corev1.Toleration: | ||
return true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are tolerations ignored?
return false, err | ||
} | ||
if err != nil || robj == nil { | ||
labels := obj.GetLabels() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
labels
can be nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
for _, object := range oldPodList { | ||
oldNameSet.Insert(object.GetName()) | ||
} | ||
deleteNameSet := oldNameSet.Difference(newNameSet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the newNameSet
only contains inst.name
, in what case will oldNameSet
contain another value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-implemented it.
meta.RemoveStatusCondition(&inst.Status.Conditions, string(workloads.InstanceUpdateRestricted)) | ||
} | ||
if needRetry { | ||
return kubebuilderx.RetryAfter(time.Second * time.Duration(inst.Spec.MinReadySeconds)), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inst.Spec.MinReadySeconds
can be zero. Maybe sleep for at least a few seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That needRetry is true indicates that the minReadySeconds is not 0.
var ( | ||
codecs = serializer.NewCodecFactory(model.GetScheme()) | ||
patchCodec = codecs.LegacyCodec(workloads.SchemeGroupVersion) | ||
controllerKind = appsv1.SchemeGroupVersion.WithKind("StatefulSet") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"InstanceSet"? Although it affects nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
apis/workloads/v1/instance_types.go
Outdated
ConfigMap *corev1.ConfigMap `json:"configMap,omitempty"` | ||
Secret *corev1.Secret `json:"secret,omitempty"` | ||
ServiceAccount *corev1.ServiceAccount `json:"serviceAccount,omitempty"` | ||
Role *rbacv1.Role `json:"clusterRole,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clusterRole => role
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
edd75f5
to
532f11a
Compare
532f11a
to
a0aeedb
Compare
No description provided.