Refactor code generator for deepcopy files (#2580)

* Refactor code generator for deep copy files
* Add timeout to push PR workflow
* Add timeout for the fission-dump command
* Update helm and kind versions

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2022-10-27 16:24:59 +05:30
committed by GitHub
parent 3a9e5ab65d
commit 2bd005c387
31 changed files with 368 additions and 351 deletions
+13 -6
View File
@@ -25,6 +25,8 @@ import (
"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
fv1 "github.com/fission/fission/pkg/apis/core/v1"
"github.com/fission/fission/pkg/controller/client"
@@ -200,15 +202,20 @@ func resourceConflictCheck(c client.Interface, fr *FissionResources, specAllowCo
return result.ErrorOrNil()
}
func isResourceConflicts(deployUID string, specObj fv1.MetadataAccessor, clusterObj fv1.MetadataAccessor, specAllowConflicts bool) error {
if specObj.GetObjectMeta().GetName() == clusterObj.GetObjectMeta().GetName() &&
specObj.GetObjectMeta().GetNamespace() == clusterObj.GetObjectMeta().GetNamespace() &&
deployUID != clusterObj.GetObjectMeta().GetAnnotations()[FISSION_DEPLOYMENT_UID_KEY] {
type objectWithKind interface {
schema.ObjectKind
metav1.Object
}
func isResourceConflicts(deployUID string, specObj objectWithKind, clusterObj objectWithKind, specAllowConflicts bool) error {
if specObj.GetName() == clusterObj.GetName() &&
specObj.GetNamespace() == clusterObj.GetNamespace() &&
deployUID != clusterObj.GetAnnotations()[FISSION_DEPLOYMENT_UID_KEY] {
if specAllowConflicts {
return nil
}
return fmt.Errorf("%v: '%v/%v' with different deploy uid already exists",
clusterObj.GetObjectKind().GroupVersionKind().Kind, clusterObj.GetObjectMeta().GetName(), clusterObj.GetObjectMeta().GetNamespace())
return fmt.Errorf("%s: '%s/%s' with different deploy uid already exists",
clusterObj.GroupVersionKind().Kind, clusterObj.GetName(), clusterObj.GetNamespace())
}
return nil
}