@@ -22,7 +22,7 @@ import (
2222 "fmt"
2323 "time"
2424
25- workloadv1beta2 "github.com/project-codeflare/appwrapper/api/v1beta2"
25+ awv1beta2 "github.com/project-codeflare/appwrapper/api/v1beta2"
2626 "github.com/project-codeflare/appwrapper/pkg/utils"
2727 v1 "k8s.io/api/core/v1"
2828 apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -188,7 +188,7 @@ func addNodeSelectorsToAffinity(spec map[string]interface{}, exprsToAdd []v1.Nod
188188}
189189
190190//gocyclo:ignore
191- func (r * AppWrapperReconciler ) createComponent (ctx context.Context , aw * workloadv1beta2 .AppWrapper , componentIdx int ) (error , bool ) {
191+ func (r * AppWrapperReconciler ) createComponent (ctx context.Context , aw * awv1beta2 .AppWrapper , componentIdx int ) (error , bool ) {
192192 component := aw .Spec .Components [componentIdx ]
193193 componentStatus := aw .Status .ComponentStatus [componentIdx ]
194194 toMap := func (x interface {}) map [string ]string {
@@ -218,11 +218,11 @@ func (r *AppWrapperReconciler) createComponent(ctx context.Context, aw *workload
218218 if err != nil {
219219 return err , true
220220 }
221- awLabels := map [string ]string {workloadv1beta2 .AppWrapperLabel : aw .Name }
221+ awLabels := map [string ]string {awv1beta2 .AppWrapperLabel : aw .Name }
222222 obj .SetLabels (utilmaps .MergeKeepFirst (obj .GetLabels (), awLabels ))
223223
224224 for podSetsIdx , podSet := range componentStatus .PodSets {
225- toInject := & workloadv1beta2 .AppWrapperPodSetInfo {}
225+ toInject := & awv1beta2 .AppWrapperPodSetInfo {}
226226 if r .Config .EnableKueueIntegrations {
227227 if podSetsIdx < len (component .PodSetInfos ) {
228228 toInject = & component .PodSetInfos [podSetsIdx ]
@@ -354,12 +354,12 @@ func (r *AppWrapperReconciler) createComponent(ctx context.Context, aw *workload
354354 log .FromContext (ctx ).Info ("After injection" , "obj" , obj )
355355
356356 orig := copyForStatusPatch (aw )
357- if meta .FindStatusCondition (aw .Status .ComponentStatus [componentIdx ].Conditions , string (workloadv1beta2 .ResourcesDeployed )) == nil {
357+ if meta .FindStatusCondition (aw .Status .ComponentStatus [componentIdx ].Conditions , string (awv1beta2 .ResourcesDeployed )) == nil {
358358 aw .Status .ComponentStatus [componentIdx ].Name = obj .GetName ()
359359 aw .Status .ComponentStatus [componentIdx ].Kind = obj .GetKind ()
360360 aw .Status .ComponentStatus [componentIdx ].APIVersion = obj .GetAPIVersion ()
361361 meta .SetStatusCondition (& aw .Status .ComponentStatus [componentIdx ].Conditions , metav1.Condition {
362- Type : string (workloadv1beta2 .ResourcesDeployed ),
362+ Type : string (awv1beta2 .ResourcesDeployed ),
363363 Status : metav1 .ConditionUnknown ,
364364 Reason : "ComponentCreationInitiated" ,
365365 })
@@ -383,7 +383,7 @@ func (r *AppWrapperReconciler) createComponent(ctx context.Context, aw *workload
383383 // resource not actually created; patch status to reflect that
384384 orig := copyForStatusPatch (aw )
385385 meta .SetStatusCondition (& aw .Status .ComponentStatus [componentIdx ].Conditions , metav1.Condition {
386- Type : string (workloadv1beta2 .ResourcesDeployed ),
386+ Type : string (awv1beta2 .ResourcesDeployed ),
387387 Status : metav1 .ConditionFalse ,
388388 Reason : "ComponentCreationErrored" ,
389389 })
@@ -399,7 +399,7 @@ func (r *AppWrapperReconciler) createComponent(ctx context.Context, aw *workload
399399 orig = copyForStatusPatch (aw )
400400 aw .Status .ComponentStatus [componentIdx ].Name = obj .GetName () // Update name to support usage of GenerateName
401401 meta .SetStatusCondition (& aw .Status .ComponentStatus [componentIdx ].Conditions , metav1.Condition {
402- Type : string (workloadv1beta2 .ResourcesDeployed ),
402+ Type : string (awv1beta2 .ResourcesDeployed ),
403403 Status : metav1 .ConditionTrue ,
404404 Reason : "ComponentCreatedSuccessfully" ,
405405 })
@@ -411,9 +411,9 @@ func (r *AppWrapperReconciler) createComponent(ctx context.Context, aw *workload
411411}
412412
413413// createComponents incrementally patches aw.Status -- MUST NOT CARRY STATUS PATCHES ACROSS INVOCATIONS
414- func (r * AppWrapperReconciler ) createComponents (ctx context.Context , aw * workloadv1beta2 .AppWrapper ) (error , bool ) {
414+ func (r * AppWrapperReconciler ) createComponents (ctx context.Context , aw * awv1beta2 .AppWrapper ) (error , bool ) {
415415 for componentIdx := range aw .Spec .Components {
416- if ! meta .IsStatusConditionTrue (aw .Status .ComponentStatus [componentIdx ].Conditions , string (workloadv1beta2 .ResourcesDeployed )) {
416+ if ! meta .IsStatusConditionTrue (aw .Status .ComponentStatus [componentIdx ].Conditions , string (awv1beta2 .ResourcesDeployed )) {
417417 if err , fatal := r .createComponent (ctx , aw , componentIdx ); err != nil {
418418 return err , fatal
419419 }
@@ -422,10 +422,10 @@ func (r *AppWrapperReconciler) createComponents(ctx context.Context, aw *workloa
422422 return nil , false
423423}
424424
425- func (r * AppWrapperReconciler ) deleteComponents (ctx context.Context , aw * workloadv1beta2 .AppWrapper ) bool {
425+ func (r * AppWrapperReconciler ) deleteComponents (ctx context.Context , aw * awv1beta2 .AppWrapper ) bool {
426426 deleteIfPresent := func (idx int , opts ... client.DeleteOption ) bool {
427427 cs := & aw .Status .ComponentStatus [idx ]
428- rd := meta .FindStatusCondition (cs .Conditions , string (workloadv1beta2 .ResourcesDeployed ))
428+ rd := meta .FindStatusCondition (cs .Conditions , string (awv1beta2 .ResourcesDeployed ))
429429 if rd == nil || rd .Status == metav1 .ConditionFalse || (rd .Status == metav1 .ConditionUnknown && cs .Name == "" ) {
430430 return false // not present
431431 }
@@ -437,7 +437,7 @@ func (r *AppWrapperReconciler) deleteComponents(ctx context.Context, aw *workloa
437437 if apierrors .IsNotFound (err ) {
438438 // Has already been undeployed; update componentStatus and return not present
439439 meta .SetStatusCondition (& cs .Conditions , metav1.Condition {
440- Type : string (workloadv1beta2 .ResourcesDeployed ),
440+ Type : string (awv1beta2 .ResourcesDeployed ),
441441 Status : metav1 .ConditionFalse ,
442442 Reason : "CompononetDeleted" ,
443443 })
@@ -451,7 +451,7 @@ func (r *AppWrapperReconciler) deleteComponents(ctx context.Context, aw *workloa
451451 }
452452
453453 meta .SetStatusCondition (& aw .Status .Conditions , metav1.Condition {
454- Type : string (workloadv1beta2 .DeletingResources ),
454+ Type : string (awv1beta2 .DeletingResources ),
455455 Status : metav1 .ConditionTrue ,
456456 Reason : "DeletionInitiated" ,
457457 })
@@ -462,7 +462,7 @@ func (r *AppWrapperReconciler) deleteComponents(ctx context.Context, aw *workloa
462462 }
463463
464464 deletionGracePeriod := r .forcefulDeletionGraceDuration (ctx , aw )
465- whenInitiated := meta .FindStatusCondition (aw .Status .Conditions , string (workloadv1beta2 .DeletingResources )).LastTransitionTime
465+ whenInitiated := meta .FindStatusCondition (aw .Status .Conditions , string (awv1beta2 .DeletingResources )).LastTransitionTime
466466 gracePeriodExpired := time .Now ().After (whenInitiated .Time .Add (deletionGracePeriod ))
467467
468468 if componentsRemaining && ! gracePeriodExpired {
@@ -474,13 +474,13 @@ func (r *AppWrapperReconciler) deleteComponents(ctx context.Context, aw *workloa
474474 if err := r .List (ctx , pods ,
475475 client .UnsafeDisableDeepCopy ,
476476 client .InNamespace (aw .Namespace ),
477- client.MatchingLabels {workloadv1beta2 .AppWrapperLabel : aw .Name }); err != nil {
477+ client.MatchingLabels {awv1beta2 .AppWrapperLabel : aw .Name }); err != nil {
478478 log .FromContext (ctx ).Error (err , "Pod list error" )
479479 }
480480
481481 if ! componentsRemaining && len (pods .Items ) == 0 {
482482 // no resources or pods left; deletion is complete
483- clearCondition (aw , workloadv1beta2 .DeletingResources , "DeletionComplete" , "" )
483+ clearCondition (aw , awv1beta2 .DeletingResources , "DeletionComplete" , "" )
484484 return true
485485 }
486486
0 commit comments