@@ -17,7 +17,6 @@ import (
1717 patchtypes "k8s.io/apimachinery/pkg/types"
1818
1919 argorolloutv1alpha1 "github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1"
20- openshiftv1 "github.com/openshift/api/apps/v1"
2120)
2221
2322// 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
232231 return items
233232}
234233
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-
265234// GetRolloutItem returns the rollout in given namespace
266235func GetRolloutItem (clients kube.Clients , name string , namespace string ) (runtime.Object , error ) {
267236 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 {
332301 return item .(* appsv1.StatefulSet ).ObjectMeta .Annotations
333302}
334303
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-
343304// GetRolloutAnnotations returns the annotations of given rollout
344305func GetRolloutAnnotations (item runtime.Object ) map [string ]string {
345306 if item .(* argorolloutv1alpha1.Rollout ).ObjectMeta .Annotations == nil {
@@ -388,14 +349,6 @@ func GetStatefulSetPodAnnotations(item runtime.Object) map[string]string {
388349 return item .(* appsv1.StatefulSet ).Spec .Template .ObjectMeta .Annotations
389350}
390351
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-
399352// GetRolloutPodAnnotations returns the pod's annotations of given rollout
400353func GetRolloutPodAnnotations (item runtime.Object ) map [string ]string {
401354 if item .(* argorolloutv1alpha1.Rollout ).Spec .Template .ObjectMeta .Annotations == nil {
@@ -429,11 +382,6 @@ func GetStatefulSetContainers(item runtime.Object) []v1.Container {
429382 return item .(* appsv1.StatefulSet ).Spec .Template .Spec .Containers
430383}
431384
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-
437385// GetRolloutContainers returns the containers of given rollout
438386func GetRolloutContainers (item runtime.Object ) []v1.Container {
439387 return item .(* argorolloutv1alpha1.Rollout ).Spec .Template .Spec .Containers
@@ -464,11 +412,6 @@ func GetStatefulSetInitContainers(item runtime.Object) []v1.Container {
464412 return item .(* appsv1.StatefulSet ).Spec .Template .Spec .InitContainers
465413}
466414
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-
472415// GetRolloutInitContainers returns the containers of given rollout
473416func GetRolloutInitContainers (item runtime.Object ) []v1.Container {
474417 return item .(* argorolloutv1alpha1.Rollout ).Spec .Template .Spec .InitContainers
@@ -575,19 +518,6 @@ func PatchStatefulSet(clients kube.Clients, namespace string, resource runtime.O
575518 return err
576519}
577520
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-
591521// UpdateRollout performs rolling upgrade on rollout
592522func UpdateRollout (clients kube.Clients , namespace string , resource runtime.Object ) error {
593523 rollout := resource .(* argorolloutv1alpha1.Rollout )
@@ -631,11 +561,6 @@ func GetStatefulSetVolumes(item runtime.Object) []v1.Volume {
631561 return item .(* appsv1.StatefulSet ).Spec .Template .Spec .Volumes
632562}
633563
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-
639564// GetRolloutVolumes returns the Volumes of given rollout
640565func GetRolloutVolumes (item runtime.Object ) []v1.Volume {
641566 return item .(* argorolloutv1alpha1.Rollout ).Spec .Template .Spec .Volumes
0 commit comments