Skip to content
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

Check the length of parts while using ParseNamespacedName and ParseNamespacedNameContainer #2141

Merged
merged 32 commits into from Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
16154e7
check length of parts
Jul 22, 2021
26c79b5
check length of parts
Jul 22, 2021
fa72055
fix: deadline reconciler, keep deadline exceed with true (#2120)
STRRL Jul 22, 2021
a5aaae1
chore: disable scope in advance (#2135)
g1eny0ung Jul 22, 2021
1fd55dd
Merge branch 'master' into master
FingerLeader Jul 26, 2021
857fb88
Merge branch 'master' into master
FingerLeader Jul 26, 2021
337e063
adding error throwing to ParseNamespacedName and ParseNamespacedNameC…
FingerLeader Jul 26, 2021
dac2f8b
Merge branch 'master' of https://github.com/FingerLeader/chaos-mesh
FingerLeader Jul 26, 2021
a71b8e1
Merge branch 'master' into master
FingerLeader Jul 26, 2021
8f39d26
adding error throwing to ParseNamespacedName and ParseNamespacedNameC…
FingerLeader Jul 26, 2021
4e3070f
adding error throwing to ParseNamespacedName and ParseNamespacedNameC…
FingerLeader Jul 26, 2021
b87a0fa
Merge branch 'master' of https://github.com/FingerLeader/chaos-mesh
FingerLeader Jul 26, 2021
3d337c5
delete fallpoint files
FingerLeader Jul 26, 2021
67bc490
chang func ParseNamespacedaNameContainer to ParseNamespacedName in ht…
FingerLeader Jul 27, 2021
63b49b3
change func ParseNamespacedaNameContainer to ParseNamespacedName in h…
FingerLeader Jul 27, 2021
c0b3a64
change func ParseNamespacedaNameContainer to ParseNamespacedName in h…
FingerLeader Jul 27, 2021
5b99b68
change func ParseNamespacedaNameContainer to ParseNamespacedName in h…
FingerLeader Jul 27, 2021
338619e
change func ParseNamespacedaNameContainer to ParseNamespacedName in h…
FingerLeader Jul 27, 2021
f13cafb
add length check of parts without error throwing
FingerLeader Jul 28, 2021
588ac79
change ParseNamespacedNameContainr to ParseNamespacedName in recover
FingerLeader Jul 28, 2021
7b9d5fc
change ParseNamespaecdName back to ParseNamespacedName
FingerLeader Jul 29, 2021
07cde4d
change ParseNamespacedName to ParseNamespacedNameContainer
FingerLeader Jul 29, 2021
ca88de6
ParseNamespacedName return values when length of parts > 1
FingerLeader Jul 29, 2021
eb18be4
Merge branch 'master' into master
FingerLeader Jul 30, 2021
084d57a
add error throwing to ParseNamespacedNameContainer and ParseNamespace…
FingerLeader Aug 1, 2021
9b84118
error throwing added ParseNamespacedNameContainer and ParseNamespaced…
Aug 1, 2021
27a1657
Merge branch 'master' into master
FingerLeader Aug 2, 2021
c9045c5
revert: rollback unexpected file mode changes.
Colstuwjx Aug 2, 2021
90ad42c
change content of setupLog
FingerLeader Aug 2, 2021
209de76
change content of setupLog
FingerLeader Aug 2, 2021
128c47e
Merge branch 'master' into master
ti-chi-bot Aug 4, 2021
7192928
Merge branch 'master' into master
ti-chi-bot Aug 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 22 additions & 6 deletions controllers/chaosimpl/httpchaos/impl.go
Expand Up @@ -59,7 +59,11 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco

if phase == waitForApplySync {
podhttpchaos := &v1alpha1.PodHttpChaos{}
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), podhttpchaos)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
return waitForApplySync, err
}
err = impl.Client.Get(ctx, namespacedName, podhttpchaos)
if err != nil {
return waitForApplySync, err
}
Expand All @@ -75,9 +79,12 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco
return waitForApplySync, nil
}

podId, _ := controller.ParseNamespacedNameContainer(records[index].Id)
podId, err := controller.ParseNamespacedName(records[index].Id)
if err != nil {
return v1alpha1.NotInjected, err
}
var pod v1.Pod
err := impl.Client.Get(ctx, podId, &pod)
err = impl.Client.Get(ctx, podId, &pod)
if err != nil {
return v1alpha1.NotInjected, err
}
Expand Down Expand Up @@ -126,7 +133,12 @@ func (impl *Impl) Recover(ctx context.Context, index int, records []*v1alpha1.Re
phase := record.Phase
if phase == waitForRecoverSync {
podhttpchaos := &v1alpha1.PodHttpChaos{}
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), podhttpchaos)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
// This error is not expected to exist
return waitForRecoverSync, err
}
err = impl.Client.Get(ctx, namespacedName, podhttpchaos)
if err != nil {
// TODO: handle this error
if k8sError.IsNotFound(err) {
Expand All @@ -153,9 +165,13 @@ func (impl *Impl) Recover(ctx context.Context, index int, records []*v1alpha1.Re
return waitForRecoverSync, nil
}

podId, _ := controller.ParseNamespacedNameContainer(records[index].Id)
podId, err := controller.ParseNamespacedName(records[index].Id)
if err != nil {
// This error is not expected to exist
return v1alpha1.NotInjected, err
}
var pod v1.Pod
err := impl.Client.Get(ctx, podId, &pod)
err = impl.Client.Get(ctx, podId, &pod)
if err != nil {
// TODO: handle this error
if k8sError.IsNotFound(err) {
Expand Down
28 changes: 22 additions & 6 deletions controllers/chaosimpl/iochaos/impl.go
Expand Up @@ -58,7 +58,11 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco

if phase == waitForApplySync {
podiochaos := &v1alpha1.PodIOChaos{}
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), podiochaos)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
return waitForApplySync, err
}
err = impl.Client.Get(ctx, namespacedName, podiochaos)
if err != nil {
if k8sError.IsNotFound(err) {
return v1alpha1.NotInjected, nil
Expand All @@ -84,9 +88,12 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco
return waitForApplySync, nil
}

podId, containerName := controller.ParseNamespacedNameContainer(records[index].Id)
podId, containerName, err := controller.ParseNamespacedNameContainer(records[index].Id)
if err != nil {
return v1alpha1.NotInjected, err
}
var pod v1.Pod
err := impl.Client.Get(ctx, podId, &pod)
err = impl.Client.Get(ctx, podId, &pod)
if err != nil {
return v1alpha1.NotInjected, err
}
Expand Down Expand Up @@ -140,7 +147,12 @@ func (impl *Impl) Recover(ctx context.Context, index int, records []*v1alpha1.Re
phase := record.Phase
if phase == waitForRecoverSync {
podiochaos := &v1alpha1.PodIOChaos{}
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), podiochaos)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
// This error is not expected to exist
return waitForRecoverSync, nil
}
err = impl.Client.Get(ctx, namespacedName, podiochaos)
if err != nil {
// TODO: handle this error
if k8sError.IsNotFound(err) {
Expand All @@ -160,9 +172,13 @@ func (impl *Impl) Recover(ctx context.Context, index int, records []*v1alpha1.Re
return waitForRecoverSync, nil
}

podId, _ := controller.ParseNamespacedNameContainer(records[index].Id)
podId, _, err := controller.ParseNamespacedNameContainer(records[index].Id)
if err != nil {
// This error is not expected to exist
return v1alpha1.NotInjected, err
}
var pod v1.Pod
err := impl.Client.Get(ctx, podId, &pod)
err = impl.Client.Get(ctx, podId, &pod)
if err != nil {
// TODO: handle this error
if k8sError.IsNotFound(err) {
Expand Down
13 changes: 11 additions & 2 deletions controllers/chaosimpl/jvmchaos/impl.go
Expand Up @@ -40,7 +40,11 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco
jvmchaos := obj.(*v1alpha1.JVMChaos)

var pod v1.Pod
err := impl.Client.Get(ctx, controller.ParseNamespacedName(records[index].Id), &pod)
namespacedName, err := controller.ParseNamespacedName(records[index].Id)
if err != nil {
return v1alpha1.NotInjected, err
}
err = impl.Client.Get(ctx, namespacedName, &pod)
if err != nil {
// TODO: handle this error
return v1alpha1.NotInjected, err
Expand Down Expand Up @@ -87,7 +91,12 @@ func (impl *Impl) Recover(ctx context.Context, index int, records []*v1alpha1.Re
jvmchaos := obj.(*v1alpha1.JVMChaos)

var pod v1.Pod
err := impl.Client.Get(ctx, controller.ParseNamespacedName(records[index].Id), &pod)
namespacedName, err := controller.ParseNamespacedName(records[index].Id)
if err != nil {
// This error is not expected to exist
return v1alpha1.NotInjected, err
}
err = impl.Client.Get(ctx, namespacedName, &pod)
if err != nil {
if client.IgnoreNotFound(err) != nil {
return v1alpha1.Injected, err
Expand Down
17 changes: 13 additions & 4 deletions controllers/chaosimpl/kernelchaos/types.go
Expand Up @@ -47,9 +47,12 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco
record := records[index]

log := impl.Log.WithValues("chaos", kernelChaos, "record", record)
podId := controller.ParseNamespacedName(record.Id)
podId, err := controller.ParseNamespacedName(record.Id)
if err != nil {
return v1alpha1.NotInjected, err
}
var pod v1.Pod
err := impl.Client.Get(ctx, podId, &pod)
err = impl.Client.Get(ctx, podId, &pod)
if err != nil {
log.Error(err, "fail to get pod by record")
// TODO: handle this error
Expand All @@ -75,9 +78,15 @@ func (impl *Impl) Recover(ctx context.Context, index int, records []*v1alpha1.Re
record := records[index]

log := impl.Log.WithValues("chaos", kernelChaos, "record", record)
podId := controller.ParseNamespacedName(record.Id)
podId, err := controller.ParseNamespacedName(record.Id)
if err != nil {
errorInfo := fmt.Sprintf("kernelChaos recover error, record ID is %s", record.Id)
log.Error(err, errorInfo)
// This error is not expected to exist
return v1alpha1.Injected, err
}
var pod v1.Pod
err := impl.Client.Get(ctx, podId, &pod)
err = impl.Client.Get(ctx, podId, &pod)
if err != nil {
log.Error(err, "fail to get pod by record")
// TODO: handle this error
Expand Down
33 changes: 28 additions & 5 deletions controllers/chaosimpl/networkchaos/partition/impl.go
Expand Up @@ -68,7 +68,11 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco

if phase == waitForApplySync {
podnetworkchaos := &v1alpha1.PodNetworkChaos{}
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), podnetworkchaos)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
return waitForApplySync, err
}
err = impl.Client.Get(ctx, namespacedName, podnetworkchaos)
if err != nil {
if k8sError.IsNotFound(err) {
return v1alpha1.NotInjected, nil
Expand All @@ -95,7 +99,11 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco
}

var pod v1.Pod
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), &pod)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
return v1alpha1.NotInjected, err
}
err = impl.Client.Get(ctx, namespacedName, &pod)
if err != nil {
// TODO: handle this error
return v1alpha1.NotInjected, err
Expand Down Expand Up @@ -244,7 +252,12 @@ func (impl *Impl) Recover(ctx context.Context, index int, records []*v1alpha1.Re

if phase == waitForRecoverSync {
podnetworkchaos := &v1alpha1.PodNetworkChaos{}
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), podnetworkchaos)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
// This error is not expected to exist
return waitForApplySync, err
}
err = impl.Client.Get(ctx, namespacedName, podnetworkchaos)
if err != nil {
// TODO: handle this error
if k8sError.IsNotFound(err) {
Expand All @@ -265,7 +278,12 @@ func (impl *Impl) Recover(ctx context.Context, index int, records []*v1alpha1.Re
}

var pod v1.Pod
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), &pod)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
// This error is not expected to exist
return v1alpha1.NotInjected, err
}
err = impl.Client.Get(ctx, namespacedName, &pod)
if err != nil {
// TODO: handle this error
if k8sError.IsNotFound(err) {
Expand Down Expand Up @@ -324,7 +342,12 @@ func (impl *Impl) SetDrop(ctx context.Context, m *podnetworkchaosmanager.PodNetw
targetPods := []v1.Pod{}
for _, record := range targets {
var pod v1.Pod
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), &pod)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
// TODO: handle this error
return err
}
err = impl.Client.Get(ctx, namespacedName, &pod)
if err != nil {
// TODO: handle this error
return err
Expand Down
33 changes: 28 additions & 5 deletions controllers/chaosimpl/networkchaos/trafficcontrol/impl.go
Expand Up @@ -71,7 +71,11 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco

if phase == waitForApplySync {
podnetworkchaos := &v1alpha1.PodNetworkChaos{}
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), podnetworkchaos)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
return waitForApplySync, err
}
err = impl.Client.Get(ctx, namespacedName, podnetworkchaos)
if err != nil {
if k8sError.IsNotFound(err) {
return v1alpha1.NotInjected, nil
Expand All @@ -98,7 +102,11 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco
}

var pod v1.Pod
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), &pod)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
return v1alpha1.NotInjected, err
}
err = impl.Client.Get(ctx, namespacedName, &pod)
if err != nil {
// TODO: handle this error
return v1alpha1.NotInjected, err
Expand Down Expand Up @@ -182,7 +190,12 @@ func (impl *Impl) Recover(ctx context.Context, index int, records []*v1alpha1.Re

if phase == waitForRecoverSync {
podnetworkchaos := &v1alpha1.PodNetworkChaos{}
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), podnetworkchaos)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
// This error is not expected to exist
return waitForRecoverSync, err
}
err = impl.Client.Get(ctx, namespacedName, podnetworkchaos)
if err != nil {
// TODO: handle this error
if k8sError.IsNotFound(err) {
Expand All @@ -203,7 +216,12 @@ func (impl *Impl) Recover(ctx context.Context, index int, records []*v1alpha1.Re
}

var pod v1.Pod
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), &pod)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
// This error is not expected to exist
return v1alpha1.Injected, err
}
err = impl.Client.Get(ctx, namespacedName, &pod)
if err != nil {
// TODO: handle this error
if k8sError.IsNotFound(err) {
Expand Down Expand Up @@ -267,7 +285,12 @@ func (impl *Impl) ApplyTc(ctx context.Context, m *podnetworkchaosmanager.PodNetw
targetPods := []v1.Pod{}
for _, record := range targets {
var pod v1.Pod
err := impl.Client.Get(ctx, controller.ParseNamespacedName(record.Id), &pod)
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
// TODO: handle this error
return err
}
err = impl.Client.Get(ctx, namespacedName, &pod)
if err != nil {
// TODO: handle this error
return err
Expand Down
13 changes: 11 additions & 2 deletions controllers/chaosimpl/podchaos/podfailure/impl.go
Expand Up @@ -39,7 +39,11 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco
podchaos := obj.(*v1alpha1.PodChaos)

var origin v1.Pod
err := impl.Get(ctx, controller.ParseNamespacedName(records[index].Id), &origin)
namespacedName, err := controller.ParseNamespacedName(records[index].Id)
if err != nil {
return v1alpha1.NotInjected, err
}
err = impl.Get(ctx, namespacedName, &origin)
if err != nil {
// TODO: handle this error
return v1alpha1.NotInjected, err
Expand Down Expand Up @@ -92,7 +96,12 @@ func (impl *Impl) Recover(ctx context.Context, index int, records []*v1alpha1.Re
podchaos := obj.(*v1alpha1.PodChaos)

var origin v1.Pod
err := impl.Get(ctx, controller.ParseNamespacedName(records[index].Id), &origin)
namespacedName, err := controller.ParseNamespacedName(records[index].Id)
if err != nil {
// This error is not expected to exist
return v1alpha1.NotInjected, err
}
err = impl.Get(ctx, namespacedName, &origin)
if err != nil {
// TODO: handle this error
if k8sError.IsNotFound(err) {
Expand Down
6 changes: 5 additions & 1 deletion controllers/chaosimpl/podchaos/podkill/impl.go
Expand Up @@ -31,7 +31,11 @@ func (impl *Impl) Apply(ctx context.Context, index int, records []*v1alpha1.Reco
podchaos := obj.(*v1alpha1.PodChaos)

var pod v1.Pod
err := impl.Get(ctx, controller.ParseNamespacedName(records[index].Id), &pod)
namespacedName, err := controller.ParseNamespacedName(records[index].Id)
if err != nil {
return v1alpha1.NotInjected, err
}
err = impl.Get(ctx, namespacedName, &pod)
if err != nil {
// TODO: handle this error
return v1alpha1.NotInjected, err
Expand Down
7 changes: 6 additions & 1 deletion controllers/chaosimpl/utils/record.go
Expand Up @@ -46,7 +46,12 @@ type DecodedContainerRecord struct {

func (d *ContianerRecordDecoder) DecodeContainerRecord(ctx context.Context, record *v1alpha1.Record) (decoded DecodedContainerRecord, err error) {
var pod v1.Pod
podId, containerName := controller.ParseNamespacedNameContainer(record.Id)
podId, containerName, err := controller.ParseNamespacedNameContainer(record.Id)
if err != nil {
// TODO: organize the error in a better way
err = NewFailToFindContainer(pod.Namespace, pod.Name, containerName, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it parses failed, both of the containerName and podId should be the empty strings, it's non-sense to define this error, I suggest just return it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did just as you say, but httpchaos threw an error of can't find pod "", so I add this error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I find that may be the wrong use of NewFailToFindContainer in httpchaos

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ParseNamespacedNameContainer returns error should be sth like too few parts of namespacedname as L51, it's different to can't find pod "".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That happended when I haven't add this error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the e2e-test log of the past without error adding

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.016: FAIL: http chaos doesn't work as expected

[2021-07-26T04:36:51.037Z] [3] Unexpected error:

[2021-07-26T04:36:51.037Z] [3]     <*errors.errorString | 0xc000353f00>: {

[2021-07-26T04:36:51.037Z] [3]         s: "timed out waiting for the condition",

[2021-07-26T04:36:51.037Z] [3]     }

[2021-07-26T04:36:51.037Z] [3]     timed out waiting for the condition

[2021-07-26T04:36:51.037Z] [3] occurred

[2021-07-26T04:36:51.037Z] [3] [JustAfterEach] [HTTPChaos]

[2021-07-26T04:36:51.037Z] [3]   /home/jenkins/agent/workspace/chaos-mesh-e2e/go/src/github.com/chaos-mesh/chaos-mesh/e2e-test/e2e/chaos/basic.go:251

[2021-07-26T04:36:51.037Z] [3] [AfterEach] [Basic]

[2021-07-26T04:36:51.037Z] [3]   /go/pkg/mod/k8s.io/kubernetes@v1.17.2/test/e2e/framework/framework.go:152

[2021-07-26T04:36:51.037Z] [3] STEP: Collecting events from namespace "chaos-mesh-3790".

[2021-07-26T04:36:51.037Z] [3] STEP: Found 25 events.

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:45 +0000 UTC - event for http-test: {deployment-controller } ScalingReplicaSet: Scaled up replica set http-test-6c4c75854b to 1

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:45 +0000 UTC - event for http-test-6c4c75854b: {replicaset-controller } SuccessfulCreate: Created pod: http-test-6c4c75854b-pfl7j

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:45 +0000 UTC - event for http-test-6c4c75854b-pfl7j: {default-scheduler } Scheduled: Successfully assigned chaos-mesh-3790/http-test-6c4c75854b-pfl7j to chaos-mesh-worker2

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:46 +0000 UTC - event for http-test-6c4c75854b-pfl7j: {kubelet chaos-mesh-worker2} Started: Started container http

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:46 +0000 UTC - event for http-test-6c4c75854b-pfl7j: {kubelet chaos-mesh-worker2} Created: Created container http

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:46 +0000 UTC - event for http-test-6c4c75854b-pfl7j: {kubelet chaos-mesh-worker2} Pulled: Container image "localhost:5000/pingcap/e2e-helper:latest" already present on machine

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:49 +0000 UTC - event for http-chaos: {desiredphase } Started: Experiment has started

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:49 +0000 UTC - event for http-chaos: {finalizer } FinalizerInited: Finalizer has been inited

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:50 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:50 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.037Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:50 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:50 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:50 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:50 +0000 UTC - event for http-chaos: {desiredphase } Updated: Successfully update desiredPhase of resource

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:50 +0000 UTC - event for http-chaos: {finalizer } Updated: Successfully update finalizer of resource

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:50 +0000 UTC - event for http-chaos: {records } Updated: Successfully update records of resource

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:50 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:50 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:50 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:51 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:52 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:35:55 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:36:00 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:36:10 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

[2021-07-26T04:36:51.038Z] [3] Jul 26 04:36:50.022: INFO: At 2021-07-26 04:36:31 +0000 UTC - event for http-chaos: {records } Failed: Failed to apply chaos: Pod "" not found

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many commits after that time e2e test, how about trigger a new CI test, and let's see what gonna happen.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which version of code do you referring to? The one without error throwing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean we could just return the error as I suggested, and let's see the ci test result. If there are still some errors, I would help you dive into the root cause.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still an issue.

return
}
err = d.Client.Get(ctx, podId, &pod)
if err != nil {
// TODO: organize the error in a better way
Expand Down
7 changes: 6 additions & 1 deletion controllers/common/fx.go
Expand Up @@ -94,7 +94,12 @@ func NewController(params Params) (types.Controller, error) {
for i := 0; i < items.Len(); i++ {
item := items.Index(i).Addr().Interface().(InnerObjectWithSelector)
for _, record := range item.GetStatus().Experiment.Records {
if controller.ParseNamespacedName(record.Id) == objName {
namespacedName, err := controller.ParseNamespacedName(record.Id)
if err != nil {
setupLog.Error(err, "failed to parse record", "record", record.Id)
Colstuwjx marked this conversation as resolved.
Show resolved Hide resolved
continue
}
if namespacedName == objName {
id := k8sTypes.NamespacedName{
Namespace: item.GetObjectMeta().Namespace,
Name: item.GetObjectMeta().Name,
Expand Down