@@ -24,9 +24,6 @@ import (
24
24
"time"
25
25
26
26
apps "k8s.io/api/apps/v1"
27
- batch "k8s.io/api/batch/v1"
28
- storage "k8s.io/api/storage/v1"
29
-
30
27
v1 "k8s.io/api/core/v1"
31
28
apierrors "k8s.io/apimachinery/pkg/api/errors"
32
29
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -121,74 +118,6 @@ func CreateDeploymentWithRetries(c clientset.Interface, namespace string, obj *a
121
118
return RetryWithExponentialBackOff (createFunc )
122
119
}
123
120
124
- func CreateDaemonSetWithRetries (c clientset.Interface , namespace string , obj * apps.DaemonSet ) error {
125
- if obj == nil {
126
- return fmt .Errorf ("object provided to create is empty" )
127
- }
128
- createFunc := func () (bool , error ) {
129
- _ , err := c .AppsV1 ().DaemonSets (namespace ).Create (context .TODO (), obj , metav1.CreateOptions {})
130
- if isGenerateNameConflict (obj .ObjectMeta , err ) {
131
- return false , nil
132
- }
133
- if err == nil || apierrors .IsAlreadyExists (err ) {
134
- return true , nil
135
- }
136
- return false , fmt .Errorf ("failed to create object with non-retriable error: %v" , err )
137
- }
138
- return RetryWithExponentialBackOff (createFunc )
139
- }
140
-
141
- func CreateJobWithRetries (c clientset.Interface , namespace string , obj * batch.Job ) error {
142
- if obj == nil {
143
- return fmt .Errorf ("object provided to create is empty" )
144
- }
145
- createFunc := func () (bool , error ) {
146
- _ , err := c .BatchV1 ().Jobs (namespace ).Create (context .TODO (), obj , metav1.CreateOptions {})
147
- if isGenerateNameConflict (obj .ObjectMeta , err ) {
148
- return false , nil
149
- }
150
- if err == nil || apierrors .IsAlreadyExists (err ) {
151
- return true , nil
152
- }
153
- return false , fmt .Errorf ("failed to create object with non-retriable error: %v" , err )
154
- }
155
- return RetryWithExponentialBackOff (createFunc )
156
- }
157
-
158
- func CreateSecretWithRetries (c clientset.Interface , namespace string , obj * v1.Secret ) error {
159
- if obj == nil {
160
- return fmt .Errorf ("object provided to create is empty" )
161
- }
162
- createFunc := func () (bool , error ) {
163
- _ , err := c .CoreV1 ().Secrets (namespace ).Create (context .TODO (), obj , metav1.CreateOptions {})
164
- if isGenerateNameConflict (obj .ObjectMeta , err ) {
165
- return false , nil
166
- }
167
- if err == nil || apierrors .IsAlreadyExists (err ) {
168
- return true , nil
169
- }
170
- return false , fmt .Errorf ("failed to create object with non-retriable error: %v" , err )
171
- }
172
- return RetryWithExponentialBackOff (createFunc )
173
- }
174
-
175
- func CreateConfigMapWithRetries (c clientset.Interface , namespace string , obj * v1.ConfigMap ) error {
176
- if obj == nil {
177
- return fmt .Errorf ("object provided to create is empty" )
178
- }
179
- createFunc := func () (bool , error ) {
180
- _ , err := c .CoreV1 ().ConfigMaps (namespace ).Create (context .TODO (), obj , metav1.CreateOptions {})
181
- if isGenerateNameConflict (obj .ObjectMeta , err ) {
182
- return false , nil
183
- }
184
- if err == nil || apierrors .IsAlreadyExists (err ) {
185
- return true , nil
186
- }
187
- return false , fmt .Errorf ("failed to create object with non-retriable error: %v" , err )
188
- }
189
- return RetryWithExponentialBackOff (createFunc )
190
- }
191
-
192
121
func CreateServiceWithRetries (c clientset.Interface , namespace string , obj * v1.Service ) error {
193
122
if obj == nil {
194
123
return fmt .Errorf ("object provided to create is empty" )
@@ -206,40 +135,6 @@ func CreateServiceWithRetries(c clientset.Interface, namespace string, obj *v1.S
206
135
return RetryWithExponentialBackOff (createFunc )
207
136
}
208
137
209
- func CreateStorageClassWithRetries (c clientset.Interface , obj * storage.StorageClass ) error {
210
- if obj == nil {
211
- return fmt .Errorf ("object provided to create is empty" )
212
- }
213
- createFunc := func () (bool , error ) {
214
- _ , err := c .StorageV1 ().StorageClasses ().Create (context .TODO (), obj , metav1.CreateOptions {})
215
- if isGenerateNameConflict (obj .ObjectMeta , err ) {
216
- return false , nil
217
- }
218
- if err == nil || apierrors .IsAlreadyExists (err ) {
219
- return true , nil
220
- }
221
- return false , fmt .Errorf ("failed to create object with non-retriable error: %v" , err )
222
- }
223
- return RetryWithExponentialBackOff (createFunc )
224
- }
225
-
226
- func CreateResourceQuotaWithRetries (c clientset.Interface , namespace string , obj * v1.ResourceQuota ) error {
227
- if obj == nil {
228
- return fmt .Errorf ("object provided to create is empty" )
229
- }
230
- createFunc := func () (bool , error ) {
231
- _ , err := c .CoreV1 ().ResourceQuotas (namespace ).Create (context .TODO (), obj , metav1.CreateOptions {})
232
- if isGenerateNameConflict (obj .ObjectMeta , err ) {
233
- return false , nil
234
- }
235
- if err == nil || apierrors .IsAlreadyExists (err ) {
236
- return true , nil
237
- }
238
- return false , fmt .Errorf ("failed to create object with non-retriable error: %v" , err )
239
- }
240
- return RetryWithExponentialBackOff (createFunc )
241
- }
242
-
243
138
func CreatePersistentVolumeWithRetries (c clientset.Interface , obj * v1.PersistentVolume ) error {
244
139
if obj == nil {
245
140
return fmt .Errorf ("object provided to create is empty" )
0 commit comments