Skip to content

Commit 68d33be

Browse files
committed
update template service controller pkg paths
Updates the import paths in templates that refer to the service controller's separate repository package paths. Also updates the `ack-generate apis` command to respect a supplied `--output` path argument and not automatically append the service alias to the supplied output path.
1 parent 858ea76 commit 68d33be

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

cmd/ack-generate/command/apis.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func generateAPIs(cmd *cobra.Command, args []string) error {
6666
}
6767
svcAlias := strings.ToLower(args[0])
6868
if optAPIsOutputPath == "" {
69-
optAPIsOutputPath = filepath.Join(optServicesDir)
69+
optAPIsOutputPath = filepath.Join(optServicesDir, svcAlias)
7070
}
7171
if err := ensureSDKRepo(optCacheDir); err != nil {
7272
return err
@@ -98,7 +98,7 @@ func generateAPIs(cmd *cobra.Command, args []string) error {
9898
return err
9999
}
100100

101-
apisVersionPath = filepath.Join(optAPIsOutputPath, svcAlias, "apis", optGenVersion)
101+
apisVersionPath = filepath.Join(optAPIsOutputPath, "apis", optGenVersion)
102102
for path, contents := range ts.Executed() {
103103
if optDryRun {
104104
fmt.Printf("============================= %s ======================================\n", path)

templates/cmd/controller/main.go.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import (
1313
ctrlrt "sigs.k8s.io/controller-runtime"
1414
ctrlrtmetrics "sigs.k8s.io/controller-runtime/pkg/metrics"
1515

16-
svcresource "github.com/aws/aws-controllers-k8s/services/{{ .ServiceIDClean }}/pkg/resource"
17-
svctypes "github.com/aws/aws-controllers-k8s/services/{{ .ServiceIDClean }}/apis/{{ .APIVersion }}"
16+
svcresource "github.com/aws-controllers-k8s/{{ .ServiceIDClean }}-controller/pkg/resource"
17+
svctypes "github.com/aws-controllers-k8s/{{ .ServiceIDClean }}-controller/apis/{{ .APIVersion }}"
1818

19-
{{ $serviceIDClean := .ServiceIDClean }} {{range $crdName := .SnakeCasedCRDNames }}_ "github.com/aws/aws-controllers-k8s/services/{{ $serviceIDClean }}/pkg/resource/{{ $crdName }}"
19+
{{ $serviceIDClean := .ServiceIDClean }} {{range $crdName := .SnakeCasedCRDNames }}_ "github.com/aws-controllers-k8s/{{ $serviceIDClean }}-controller/pkg/resource/{{ $crdName }}"
2020
{{end}}
2121
)
2222

templates/pkg/resource/descriptor.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
k8sapirt "k8s.io/apimachinery/pkg/runtime"
1212
k8sctrlutil "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
1313

14-
svcapitypes "github.com/aws/aws-controllers-k8s/services/{{ .ServiceIDClean }}/apis/{{ .APIVersion }}"
14+
svcapitypes "github.com/aws-controllers-k8s/{{ .ServiceIDClean }}-controller/apis/{{ .APIVersion }}"
1515
)
1616

1717
const (

templates/pkg/resource/manager_factory.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/aws/aws-sdk-go/aws/session"
1414
"github.com/go-logr/logr"
1515

16-
svcresource "github.com/aws/aws-controllers-k8s/services/{{ .ServiceIDClean }}/pkg/resource"
16+
svcresource "github.com/aws-controllers-k8s/{{ .ServiceIDClean }}-controller/pkg/resource"
1717
)
1818

1919
// resourceManagerFactory produces resourceManager objects. It implements the

templates/pkg/resource/resource.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
99
k8srt "k8s.io/apimachinery/pkg/runtime"
1010

11-
svcapitypes "github.com/aws/aws-controllers-k8s/services/{{ .ServiceIDClean }}/apis/{{ .APIVersion}}"
11+
svcapitypes "github.com/aws-controllers-k8s/{{ .ServiceIDClean }}-controller/apis/{{ .APIVersion}}"
1212
)
1313

1414
// resource implements the `aws-service-operator-k8s/pkg/types.AWSResource`

templates/pkg/resource/sdk.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
corev1 "k8s.io/api/core/v1"
1515
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1616

17-
svcapitypes "github.com/aws/aws-controllers-k8s/services/{{ .ServiceIDClean }}/apis/{{ .APIVersion }}"
17+
svcapitypes "github.com/aws-controllers-k8s/{{.ServiceIDClean }}-controller/apis/{{ .APIVersion }}"
1818
)
1919

2020
// Hack to avoid import errors during build...

0 commit comments

Comments
 (0)