Skip to content

Commit b3f6a18

Browse files
committed
Basic ServiceExport controller life-cycle + Cloud Map client interface
1 parent 3928004 commit b3f6a18

16 files changed

+356
-247
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ RUN go mod download
1111

1212
# Copy the go source
1313
COPY main.go main.go
14-
COPY api/ api/
15-
COPY controllers/ controllers/
14+
COPY pkg/api api/
15+
COPY pkg/controllers controllers/
1616

1717
# Build
1818
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ kubectl apply -f my-export.yaml
4141
Check running controller if it correctly detects newly created resource
4242

4343
```
44-
2021-04-16T14:41:01.686-0700 INFO controllers.ServiceExport ServiceExport detected: demo/my-service-name
44+
2021-05-10T18:23:28.674-0700 ERROR controllers.ServiceExport no service found for ServiceExport {"serviceexport": "demo/my-service-name", "Namespace": "demo", "Name": "my-service-name", "error": "Service \"my-service-name\" not found"}
4545
```

config/rbac/role.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ rules:
1111
resources:
1212
- serviceexports
1313
verbs:
14-
- create
15-
- delete
1614
- get
1715
- list
1816
- patch
@@ -21,10 +19,9 @@ rules:
2119
- apiGroups:
2220
- multicluster.k8s.aws
2321
resources:
24-
- serviceexports/status
22+
- serviceexports/finalizers
2523
verbs:
2624
- get
27-
- patch
2825
- update
2926
- apiGroups:
3027
- multicluster.k8s.aws

controllers/serviceexport_controller.go

Lines changed: 0 additions & 61 deletions
This file was deleted.

go.sum

Lines changed: 0 additions & 170 deletions
Large diffs are not rendered by default.

main.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package main
1818

1919
import (
2020
"flag"
21+
"github.com/aws/aws-k8s-mcs-controller/pkg/cloudmap"
2122
"os"
2223

2324
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
@@ -31,9 +32,9 @@ import (
3132
"sigs.k8s.io/controller-runtime/pkg/healthz"
3233
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3334

34-
multiclusterv1alpha1 "github.com/aws/aws-k8s-mcs-controller/api/v1alpha1"
35-
"github.com/aws/aws-k8s-mcs-controller/controllers"
36-
//+kubebuilder:scaffold:imports
35+
multiclusterv1alpha1 "github.com/aws/aws-k8s-mcs-controller/pkg/api/v1alpha1"
36+
"github.com/aws/aws-k8s-mcs-controller/pkg/controllers"
37+
// +kubebuilder:scaffold:imports
3738
)
3839

3940
var (
@@ -79,13 +80,15 @@ func main() {
7980
}
8081

8182
if err = (&controllers.ServiceExportReconciler{
82-
Client: mgr.GetClient(),
83-
Log: ctrl.Log.WithName("controllers").WithName("ServiceExport"),
84-
Scheme: mgr.GetScheme(),
83+
Client: mgr.GetClient(),
84+
Log: ctrl.Log.WithName("controllers").WithName("ServiceExport"),
85+
Scheme: mgr.GetScheme(),
86+
Cloudmap: &cloudmap.ClientMock{Log: ctrl.Log.WithName("cloudmap")},
8587
}).SetupWithManager(mgr); err != nil {
8688
setupLog.Error(err, "unable to create controller", "controller", "ServiceExport")
8789
os.Exit(1)
8890
}
91+
8992
if err = (&controllers.ServiceImportReconciler{
9093
Client: mgr.GetClient(),
9194
Log: ctrl.Log.WithName("controllers").WithName("ServiceImport"),

0 commit comments

Comments
 (0)