Skip to content

Commit

Permalink
no crd dependency on host
Browse files Browse the repository at this point in the history
  • Loading branch information
isaaguilar committed Aug 11, 2023
1 parent 22a9465 commit d5c0c56
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions internal/qworker/qworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,21 @@ func worker(queue *deque.Deque[tfv1beta1.Terraform]) {
continue
}

// Get this cluster's tf resources to check if we accidentally queued it up
resourceClient := dynamicClient.Resource(terraformResource)
unstructedTerraformList, err := resourceClient.List(ctx, metav1.ListOptions{})
if err != nil {
requeue(queue, tf, fmt.Sprintf("An error occurred listing tf objects: %s", err))
continue
}
terraformList := convertTo[tfv1beta1.TerraformList](unstructedTerraformList)
isUUIDBelongToThisCluster := false
for _, terraform := range terraformList.Items {
if terraform.UID == tf.UID {
isUUIDBelongToThisCluster = true
break
// Get the host cluster's tf resources to check if we accidentally queued it up
if unstructedTerraformList, err := dynamicClient.Resource(terraformResource).List(ctx, metav1.ListOptions{}); err == nil {
terraformList := convertTo[tfv1beta1.TerraformList](unstructedTerraformList)
isUUIDBelongToThisCluster := false
for _, terraform := range terraformList.Items {
if terraform.UID == tf.UID {
isUUIDBelongToThisCluster = true
break
}
}
if isUUIDBelongToThisCluster {
// The UUID matches another UUID which only happens for resources creatd for this cluster
log.Println("This resource is not managed by the API")
continue
}
}
if isUUIDBelongToThisCluster {
// The UUID matches another UUID which only happens for resources creatd for this cluster
log.Println("This resource is not managed by the API")
continue
}

// With the clusterName, check out the vcluster config
Expand Down

0 comments on commit d5c0c56

Please sign in to comment.