Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/controller/appwrapper/resource_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func (r *AppWrapperReconciler) createComponent(ctx context.Context, aw *workload
}
}

aw.Status.ComponentStatus[componentIdx].Name = obj.GetName() // Update name to support usage of GenerateName
meta.SetStatusCondition(&aw.Status.ComponentStatus[componentIdx].Conditions, metav1.Condition{
Type: string(workloadv1beta2.ResourcesDeployed),
Status: metav1.ConditionTrue,
Expand All @@ -210,7 +211,8 @@ func (r *AppWrapperReconciler) createComponents(ctx context.Context, aw *workloa
func (r *AppWrapperReconciler) deleteComponents(ctx context.Context, aw *workloadv1beta2.AppWrapper) bool {
deleteIfPresent := func(idx int, opts ...client.DeleteOption) bool {
cs := &aw.Status.ComponentStatus[idx]
if rd := meta.FindStatusCondition(cs.Conditions, string(workloadv1beta2.ResourcesDeployed)); rd == nil || rd.Status == metav1.ConditionFalse {
rd := meta.FindStatusCondition(cs.Conditions, string(workloadv1beta2.ResourcesDeployed))
if rd == nil || rd.Status == metav1.ConditionFalse || (rd.Status == metav1.ConditionUnknown && cs.Name == "") {
return false // not present
}
obj := &metav1.PartialObjectMetadata{
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/fixtures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const batchJobYAML = `
apiVersion: batch/v1
kind: Job
metadata:
name: %v
generateName: %v
spec:
template:
spec:
Expand All @@ -225,7 +225,7 @@ spec:

func batchjob(milliCPU int64) workloadv1beta2.AppWrapperComponent {
yamlString := fmt.Sprintf(batchJobYAML,
randName("batchjob"),
"batchjob-",
resource.NewMilliQuantity(milliCPU, resource.DecimalSI))

jsonBytes, err := yaml.YAMLToJSON([]byte(yamlString))
Expand Down Expand Up @@ -272,7 +272,7 @@ const succeedingBatchJobYAML = `
apiVersion: batch/v1
kind: Job
metadata:
name: %v
generateName: %v
spec:
template:
spec:
Expand All @@ -289,7 +289,7 @@ spec:

func succeedingBatchjob(milliCPU int64) workloadv1beta2.AppWrapperComponent {
yamlString := fmt.Sprintf(succeedingBatchJobYAML,
randName("batchjob"),
"batchjob-",
resource.NewMilliQuantity(milliCPU, resource.DecimalSI))

jsonBytes, err := yaml.YAMLToJSON([]byte(yamlString))
Expand Down