Create creates object in the Kubernetes cluster
( ctx context.Context, crudClient client.Client, object client.Object, opts ...client.CreateOption, )
| 39 | |
| 40 | // Create creates object in the Kubernetes cluster |
| 41 | func Create( |
| 42 | ctx context.Context, |
| 43 | crudClient client.Client, |
| 44 | object client.Object, |
| 45 | opts ...client.CreateOption, |
| 46 | ) (client.Object, error) { |
| 47 | err := retry.New( |
| 48 | retry.Delay(PollingTime*time.Second), |
| 49 | retry.Attempts(RetryAttempts), |
| 50 | retry.DelayType(retry.FixedDelay), |
| 51 | retry.RetryIf(func(err error) bool { return !errors.IsAlreadyExists(err) })). |
| 52 | Do( |
| 53 | func() error { |
| 54 | return crudClient.Create(ctx, object, opts...) |
| 55 | }, |
| 56 | ) |
| 57 | return object, err |
| 58 | } |
| 59 | |
| 60 | // Delete deletes an object in the Kubernetes cluster |
| 61 | func Delete( |
no test coverage detected