@@ -17,7 +17,6 @@ import (
17
17
patchtypes "k8s.io/apimachinery/pkg/types"
18
18
19
19
argorolloutv1alpha1 "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1"
20
- openshiftv1 "github.com/openshift/api/apps/v1"
21
20
)
22
21
23
22
// ItemFunc is a generic function to return a specific resource in given namespace
@@ -232,36 +231,6 @@ func GetStatefulSetItems(clients kube.Clients, namespace string) []runtime.Objec
232
231
return items
233
232
}
234
233
235
- // GetDeploymentConfigItem returns the deploymentConfig in given namespace
236
- func GetDeploymentConfigItem (clients kube.Clients , name string , namespace string ) (runtime.Object , error ) {
237
- deploymentConfig , err := clients .OpenshiftAppsClient .AppsV1 ().DeploymentConfigs (namespace ).Get (context .TODO (), name , meta_v1.GetOptions {})
238
- if err != nil {
239
- logrus .Errorf ("Failed to get deploymentConfig %v" , err )
240
- return nil , err
241
- }
242
-
243
- return deploymentConfig , nil
244
- }
245
-
246
- // GetDeploymentConfigItems returns the deploymentConfigs in given namespace
247
- func GetDeploymentConfigItems (clients kube.Clients , namespace string ) []runtime.Object {
248
- deploymentConfigs , err := clients .OpenshiftAppsClient .AppsV1 ().DeploymentConfigs (namespace ).List (context .TODO (), meta_v1.ListOptions {})
249
- if err != nil {
250
- logrus .Errorf ("Failed to list deploymentConfigs %v" , err )
251
- }
252
-
253
- items := make ([]runtime.Object , len (deploymentConfigs .Items ))
254
- // Ensure we always have pod annotations to add to
255
- for i , v := range deploymentConfigs .Items {
256
- if v .Spec .Template .ObjectMeta .Annotations == nil {
257
- deploymentConfigs .Items [i ].Spec .Template .ObjectMeta .Annotations = make (map [string ]string )
258
- }
259
- items [i ] = & deploymentConfigs .Items [i ]
260
- }
261
-
262
- return items
263
- }
264
-
265
234
// GetRolloutItem returns the rollout in given namespace
266
235
func GetRolloutItem (clients kube.Clients , name string , namespace string ) (runtime.Object , error ) {
267
236
rollout , err := clients .ArgoRolloutClient .ArgoprojV1alpha1 ().Rollouts (namespace ).Get (context .TODO (), name , meta_v1.GetOptions {})
@@ -332,14 +301,6 @@ func GetStatefulSetAnnotations(item runtime.Object) map[string]string {
332
301
return item .(* appsv1.StatefulSet ).ObjectMeta .Annotations
333
302
}
334
303
335
- // GetDeploymentConfigAnnotations returns the annotations of given deploymentConfig
336
- func GetDeploymentConfigAnnotations (item runtime.Object ) map [string ]string {
337
- if item .(* openshiftv1.DeploymentConfig ).ObjectMeta .Annotations == nil {
338
- item .(* openshiftv1.DeploymentConfig ).ObjectMeta .Annotations = make (map [string ]string )
339
- }
340
- return item .(* openshiftv1.DeploymentConfig ).ObjectMeta .Annotations
341
- }
342
-
343
304
// GetRolloutAnnotations returns the annotations of given rollout
344
305
func GetRolloutAnnotations (item runtime.Object ) map [string ]string {
345
306
if item .(* argorolloutv1alpha1.Rollout ).ObjectMeta .Annotations == nil {
@@ -388,14 +349,6 @@ func GetStatefulSetPodAnnotations(item runtime.Object) map[string]string {
388
349
return item .(* appsv1.StatefulSet ).Spec .Template .ObjectMeta .Annotations
389
350
}
390
351
391
- // GetDeploymentConfigPodAnnotations returns the pod's annotations of given deploymentConfig
392
- func GetDeploymentConfigPodAnnotations (item runtime.Object ) map [string ]string {
393
- if item .(* openshiftv1.DeploymentConfig ).Spec .Template .ObjectMeta .Annotations == nil {
394
- item .(* openshiftv1.DeploymentConfig ).Spec .Template .ObjectMeta .Annotations = make (map [string ]string )
395
- }
396
- return item .(* openshiftv1.DeploymentConfig ).Spec .Template .ObjectMeta .Annotations
397
- }
398
-
399
352
// GetRolloutPodAnnotations returns the pod's annotations of given rollout
400
353
func GetRolloutPodAnnotations (item runtime.Object ) map [string ]string {
401
354
if item .(* argorolloutv1alpha1.Rollout ).Spec .Template .ObjectMeta .Annotations == nil {
@@ -429,11 +382,6 @@ func GetStatefulSetContainers(item runtime.Object) []v1.Container {
429
382
return item .(* appsv1.StatefulSet ).Spec .Template .Spec .Containers
430
383
}
431
384
432
- // GetDeploymentConfigContainers returns the containers of given deploymentConfig
433
- func GetDeploymentConfigContainers (item runtime.Object ) []v1.Container {
434
- return item .(* openshiftv1.DeploymentConfig ).Spec .Template .Spec .Containers
435
- }
436
-
437
385
// GetRolloutContainers returns the containers of given rollout
438
386
func GetRolloutContainers (item runtime.Object ) []v1.Container {
439
387
return item .(* argorolloutv1alpha1.Rollout ).Spec .Template .Spec .Containers
@@ -464,11 +412,6 @@ func GetStatefulSetInitContainers(item runtime.Object) []v1.Container {
464
412
return item .(* appsv1.StatefulSet ).Spec .Template .Spec .InitContainers
465
413
}
466
414
467
- // GetDeploymentConfigInitContainers returns the containers of given deploymentConfig
468
- func GetDeploymentConfigInitContainers (item runtime.Object ) []v1.Container {
469
- return item .(* openshiftv1.DeploymentConfig ).Spec .Template .Spec .InitContainers
470
- }
471
-
472
415
// GetRolloutInitContainers returns the containers of given rollout
473
416
func GetRolloutInitContainers (item runtime.Object ) []v1.Container {
474
417
return item .(* argorolloutv1alpha1.Rollout ).Spec .Template .Spec .InitContainers
@@ -575,19 +518,6 @@ func PatchStatefulSet(clients kube.Clients, namespace string, resource runtime.O
575
518
return err
576
519
}
577
520
578
- // UpdateDeploymentConfig performs rolling upgrade on deploymentConfig
579
- func UpdateDeploymentConfig (clients kube.Clients , namespace string , resource runtime.Object ) error {
580
- deploymentConfig := resource .(* openshiftv1.DeploymentConfig )
581
- _ , err := clients .OpenshiftAppsClient .AppsV1 ().DeploymentConfigs (namespace ).Update (context .TODO (), deploymentConfig , meta_v1.UpdateOptions {FieldManager : "Reloader" })
582
- return err
583
- }
584
-
585
- func PatchDeploymentConfig (clients kube.Clients , namespace string , resource runtime.Object , patchType patchtypes.PatchType , bytes []byte ) error {
586
- deploymentConfig := resource .(* openshiftv1.DeploymentConfig )
587
- _ , err := clients .OpenshiftAppsClient .AppsV1 ().DeploymentConfigs (namespace ).Patch (context .TODO (), deploymentConfig .Name , patchType , bytes , meta_v1.PatchOptions {FieldManager : "Reloader" })
588
- return err
589
- }
590
-
591
521
// UpdateRollout performs rolling upgrade on rollout
592
522
func UpdateRollout (clients kube.Clients , namespace string , resource runtime.Object ) error {
593
523
rollout := resource .(* argorolloutv1alpha1.Rollout )
@@ -631,11 +561,6 @@ func GetStatefulSetVolumes(item runtime.Object) []v1.Volume {
631
561
return item .(* appsv1.StatefulSet ).Spec .Template .Spec .Volumes
632
562
}
633
563
634
- // GetDeploymentConfigVolumes returns the Volumes of given deploymentConfig
635
- func GetDeploymentConfigVolumes (item runtime.Object ) []v1.Volume {
636
- return item .(* openshiftv1.DeploymentConfig ).Spec .Template .Spec .Volumes
637
- }
638
-
639
564
// GetRolloutVolumes returns the Volumes of given rollout
640
565
func GetRolloutVolumes (item runtime.Object ) []v1.Volume {
641
566
return item .(* argorolloutv1alpha1.Rollout ).Spec .Template .Spec .Volumes
0 commit comments