Skip to content

Commit 66be880

Browse files
committed
fix running with an AEES ref
On-behalf-of: @SAP [email protected]
1 parent 96b22f7 commit 66be880

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

cmd/api-syncagent/main.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,15 @@ func main() {
8585

8686
func run(ctx context.Context, log *zap.SugaredLogger, opts *Options) error {
8787
v := version.NewAppVersion()
88-
log.With(
89-
"version", v.GitVersion,
90-
"name", opts.AgentName,
91-
"apiexport", opts.APIExportRef,
92-
).Info("Moin, I'm the kcp Sync Agent")
88+
hello := log.With("version", v.GitVersion, "name", opts.AgentName)
89+
90+
if opts.APIExportEndpointSliceRef != "" {
91+
hello = hello.With("apiexportendpointslice", opts.APIExportEndpointSliceRef)
92+
} else {
93+
hello = hello.With("apiexport", opts.APIExportRef)
94+
}
95+
96+
hello.Info("Moin, I'm the kcp Sync Agent")
9397

9498
// create the ctrl-runtime manager
9599
mgr, err := setupLocalManager(ctx, opts)
@@ -114,10 +118,10 @@ func run(ctx context.Context, log *zap.SugaredLogger, opts *Options) error {
114118
return fmt.Errorf("failed to resolve APIExport/EndpointSlice: %w", err)
115119
}
116120

117-
log.Infow("Resolved APIExport", "workspace", endpoint.APIExport.Path, "logicalcluster", endpoint.APIExport.Cluster)
121+
log.Infow("Resolved APIExport", "name", endpoint.APIExport.Name, "workspace", endpoint.APIExport.Path, "logicalcluster", endpoint.APIExport.Cluster)
118122

119123
if s := endpoint.EndpointSlice; s != nil {
120-
log.Infow("Using APIExportEndpointSlice", "workspace", s.Path, "logicalcluster", s.Cluster)
124+
log.Infow("Using APIExportEndpointSlice", "name", endpoint.EndpointSlice.Name, "workspace", s.Path, "logicalcluster", s.Cluster)
121125
}
122126

123127
// init the "permanent" kcp cluster connections
@@ -166,7 +170,7 @@ func run(ctx context.Context, log *zap.SugaredLogger, opts *Options) error {
166170
}
167171

168172
if err := startController("apiexport", func() error {
169-
return apiexport.Add(mgr, managedKcpCluster, endpoint.APIExport.Cluster, log, opts.APIExportRef, opts.AgentName, opts.PublishedResourceSelector)
173+
return apiexport.Add(mgr, managedKcpCluster, endpoint.APIExport.Cluster, log, endpoint.APIExport.Name, opts.AgentName, opts.PublishedResourceSelector)
170174
}); err != nil {
171175
return err
172176
}

0 commit comments

Comments
 (0)