k8s/io/kubernetes/pkg/api/errors.IsConflict 示例代码

2022-03-03

以下示例是关于golang中包含errors.IsConflict用法的示例代码,想了解errors.IsConflict的具体用法?errors.IsConflict怎么用?errors.IsConflict使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。

示例1:
scale.go开发语言: Go项目名称: abhgupta代码行数: 611
186	if err != nil {
187		if errors.IsConflict(err) {
188			return "", ScaleError{ScaleUpdateConflictFailure, controller.ResourceVersion, err}
284	if err != nil {
285		if errors.IsConflict(err) {
286			return "", ScaleError{ScaleUpdateConflictFailure, rs.ResourceVersion, err}
358	if err != nil {
359		if errors.IsConflict(err) {
360			return "", ScaleError{ScaleUpdateConflictFailure, ss.ResourceVersion, err}
415	if err != nil {
416		if errors.IsConflict(err) {
417			return "", ScaleError{ScaleUpdateConflictFailure, job.ResourceVersion, err}
486	if err != nil {
487		if errors.IsConflict(err) {
488			return "", ScaleError{ScaleUpdateConflictFailure, deployment.ResourceVersion, err}
示例2:
scale.go开发语言: Go项目名称: ddysher代码行数: 510
181	if err != nil {
182		if errors.IsConflict(err) {
183			return "", ScaleError{ScaleUpdateConflictFailure, controller.ResourceVersion, err}
279	if err != nil {
280		if errors.IsConflict(err) {
281			return "", ScaleError{ScaleUpdateConflictFailure, rs.ResourceVersion, err}
350	if err != nil {
351		if errors.IsConflict(err) {
352			return "", ScaleError{ScaleUpdateConflictFailure, ss.ResourceVersion, err}
404	if err != nil {
405		if errors.IsConflict(err) {
406			return "", ScaleError{ScaleUpdateConflictFailure, job.ResourceVersion, err}
475	if err != nil {
476		if errors.IsConflict(err) {
477			return "", ScaleError{ScaleUpdateConflictFailure, deployment.ResourceVersion, err}
示例3:
scale.go开发语言: Go项目名称: detiber代码行数: 510
181	if err != nil {
182		if errors.IsConflict(err) {
183			return "", ScaleError{ScaleUpdateConflictFailure, controller.ResourceVersion, err}
279	if err != nil {
280		if errors.IsConflict(err) {
281			return "", ScaleError{ScaleUpdateConflictFailure, rs.ResourceVersion, err}
350	if err != nil {
351		if errors.IsConflict(err) {
352			return "", ScaleError{ScaleUpdateConflictFailure, ss.ResourceVersion, err}
404	if err != nil {
405		if errors.IsConflict(err) {
406			return "", ScaleError{ScaleUpdateConflictFailure, job.ResourceVersion, err}
475	if err != nil {
476		if errors.IsConflict(err) {
477			return "", ScaleError{ScaleUpdateConflictFailure, deployment.ResourceVersion, err}
示例4:
pv_controller_base.go开发语言: Go项目名称: cjcullen代码行数: 582
245	if err := ctrl.syncVolume(pv); err != nil {
246		if errors.IsConflict(err) {
247			// Version conflict error happens quite often and the controller
280	if err := ctrl.syncVolume(newVolume); err != nil {
281		if errors.IsConflict(err) {
282			// Version conflict error happens quite often and the controller
324			if err != nil {
325				if errors.IsConflict(err) {
326					// Version conflict error happens quite often and the
358	if err := ctrl.syncClaim(claim); err != nil {
359		if errors.IsConflict(err) {
360			// Version conflict error happens quite often and the controller
388	if err := ctrl.syncClaim(newClaim); err != nil {
389		if errors.IsConflict(err) {
390			// Version conflict error happens quite often and the controller
示例5:
controller_base.go开发语言: Go项目名称: cloud-zuiwanyuan代码行数: 614
239	if err := ctrl.syncVolume(pv); err != nil {
240		if errors.IsConflict(err) {
241			// Version conflict error happens quite often and the controller
274	if err := ctrl.syncVolume(newVolume); err != nil {
275		if errors.IsConflict(err) {
276			// Version conflict error happens quite often and the controller
318			if err != nil {
319				if errors.IsConflict(err) {
320					// Version conflict error happens quite often and the
352	if err := ctrl.syncClaim(claim); err != nil {
353		if errors.IsConflict(err) {
354			// Version conflict error happens quite often and the controller
382	if err := ctrl.syncClaim(newClaim); err != nil {
383		if errors.IsConflict(err) {
384			// Version conflict error happens quite often and the controller
示例6:
resttest.go开发语言: Go项目名称: abhgupta代码行数: 1458
507		t.Errorf("Expected an error, but we didn't get one")
508	} else if !errors.IsConflict(err) {
509		t.Errorf("Expected Conflict error, got '%v'", err)
549	}
550	if err == nil || !errors.IsConflict(err) {
551		t.Errorf("unexpected error: %v", err)
803	obj, _, err := t.storage.(rest.GracefulDeleter).Delete(ctx, objectMeta.GetName(), metav1.NewPreconditionDeleteOptions("UID1111"))
804	if err == nil || !errors.IsConflict(err) {
805		t.Errorf("unexpected error: %v", err)
示例7:
resttest.go开发语言: Go项目名称: bparees代码行数: 1614
583		t.Errorf("Expected an error, but we didn't get one")
584	} else if !errors.IsConflict(err) {
585		t.Errorf("Expected Conflict error, got '%v'", err)
626	}
627	if err == nil || !errors.IsConflict(err) {
628		t.Errorf("unexpected error: %v", err)
889	obj, _, err := t.storage.(rest.GracefulDeleter).Delete(ctx, objectMeta.GetName(), rest.ValidateAllObjectFunc, &opts)
890	if err == nil || !errors.IsConflict(err) {
891		t.Errorf("unexpected error: %v", err)
926	obj, wasDeleted, err := t.storage.(rest.GracefulDeleter).Delete(ctx, objectMeta.GetName(), rest.ValidateAllObjectFunc, &opts)
927	if err == nil || !errors.IsConflict(err) {
928		t.Errorf("unexpected error: %v", err)
示例8:
resttest.go开发语言: Go项目名称: byxorna代码行数: 1614
583		t.Errorf("Expected an error, but we didn't get one")
584	} else if !errors.IsConflict(err) {
585		t.Errorf("Expected Conflict error, got '%v'", err)
626	}
627	if err == nil || !errors.IsConflict(err) {
628		t.Errorf("unexpected error: %v", err)
889	obj, _, err := t.storage.(rest.GracefulDeleter).Delete(ctx, objectMeta.GetName(), rest.ValidateAllObjectFunc, &opts)
890	if err == nil || !errors.IsConflict(err) {
891		t.Errorf("unexpected error: %v", err)
926	obj, wasDeleted, err := t.storage.(rest.GracefulDeleter).Delete(ctx, objectMeta.GetName(), rest.ValidateAllObjectFunc, &opts)
927	if err == nil || !errors.IsConflict(err) {
928		t.Errorf("unexpected error: %v", err)
示例9:
scale.go开发语言: Go项目名称: cjcullen代码行数: 509
180	if err != nil {
181		if errors.IsConflict(err) {
182			return "", ScaleError{ScaleUpdateConflictFailure, controller.ResourceVersion, err}
278	if err != nil {
279		if errors.IsConflict(err) {
280			return "", ScaleError{ScaleUpdateConflictFailure, rs.ResourceVersion, err}
349	if err != nil {
350		if errors.IsConflict(err) {
351			return "", ScaleError{ScaleUpdateConflictFailure, ps.ResourceVersion, err}
403	if err != nil {
404		if errors.IsConflict(err) {
405			return "", ScaleError{ScaleUpdateConflictFailure, job.ResourceVersion, err}
474	if err != nil {
475		if errors.IsConflict(err) {
476			return "", ScaleError{ScaleUpdateConflictFailure, deployment.ResourceVersion, err}
示例10:
scale.go开发语言: Go项目名称: cloud-zuiwanyuan代码行数: 463
169	if _, err := scaler.c.ReplicationControllers(namespace).Update(controller); err != nil {
170		if errors.IsConflict(err) {
171			return ScaleError{ScaleUpdateConflictFailure, controller.ResourceVersion, err}
241	if _, err := scaler.c.ReplicaSets(namespace).Update(rs); err != nil {
242		if errors.IsConflict(err) {
243			return ScaleError{ScaleUpdateConflictFailure, rs.ResourceVersion, err}
308	if _, err := scaler.c.PetSets(namespace).Update(ps); err != nil {
309		if errors.IsConflict(err) {
310			return ScaleError{ScaleUpdateConflictFailure, ps.ResourceVersion, err}
360	if _, err := scaler.c.Jobs(namespace).Update(job); err != nil {
361		if errors.IsConflict(err) {
362			return ScaleError{ScaleUpdateConflictFailure, job.ResourceVersion, err}
428	if _, err := scaler.c.Deployments(namespace).Update(deployment); err != nil {
429		if errors.IsConflict(err) {
430			return ScaleError{ScaleUpdateConflictFailure, deployment.ResourceVersion, err}

本文地址:https://www.itbaoku.cn/snippets/415692.html