Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Neo2308 <[email protected]>
  • Loading branch information
Neo2308 committed Oct 29, 2024
1 parent e7ceea1 commit f41f82d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
16 changes: 3 additions & 13 deletions internal/cmd/operator-sdk/generate/internal/genutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
apiextv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
cfgv3 "sigs.k8s.io/kubebuilder/v4/pkg/config/v3"
"sigs.k8s.io/yaml"
)

Expand Down Expand Up @@ -182,18 +181,9 @@ func GetPackageNameAndLayout(defaultPackageName string) (packageName string, lay
return "", "", err
}
if packageName == "" {
switch {
case cfg.GetVersion().Compare(cfgv3.Version) == 0:
wd, err := os.Getwd()
if err != nil {
return "", "", err
}
packageName = strings.ToLower(filepath.Base(wd))
default:
packageName = cfg.GetProjectName()
if packageName == "" {
return "", "", errors.New("--package <name> must be set if \"projectName\" is not set in the PROJECT config file")
}
packageName = cfg.GetProjectName()
if packageName == "" {
return "", "", errors.New("--package <name> must be set if \"projectName\" is not set in the PROJECT config file")
}
}
layout = projutil.GetProjectLayout(cfg)
Expand Down
6 changes: 0 additions & 6 deletions internal/cmd/operator-sdk/generate/kustomize/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation"
"sigs.k8s.io/kubebuilder/v4/pkg/config"
cfgv3 "sigs.k8s.io/kubebuilder/v4/pkg/config/v3"
"sigs.k8s.io/kubebuilder/v4/pkg/machinery"
"sigs.k8s.io/yaml"

Expand Down Expand Up @@ -257,11 +256,6 @@ func getGVKs(cfg config.Config) ([]schema.GroupVersionKind, error) {
}
gvks := make([]schema.GroupVersionKind, len(resources))
for i, gvk := range resources {
// check if the resource has an specific domain
// otherwise use the config.Domain.
if cfg.GetVersion().Compare(cfgv3.Version) == 0 {
gvk.Domain = cfg.GetDomain()
}
gvks[i].Group = gvk.QualifiedGroup()
gvks[i].Version = gvk.Version
gvks[i].Kind = gvk.Kind
Expand Down

0 comments on commit f41f82d

Please sign in to comment.