Skip to content

Commit

Permalink
don't exit if grpc server doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
troy0820 committed Sep 20, 2023
1 parent d771ea3 commit 27bee7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 0 additions & 3 deletions controllers/installation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ func (r *InstallationReconciler) Reconcile(ctx context.Context, req ctrl.Request
}

log.V(Log4Debug).Info("Reconciliation complete: A porter agent has been dispatched to apply changes to the installation.")
// TODO: make this one function (not a fan of doing this) and call when
// connection has been established. Add annotation about installation output
// being true.
if r.PorterGRPCClient != nil {
return r.CheckOrCreateInstallationOutputsCR(ctx, log, inst)
}
Expand Down
10 changes: 6 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,19 @@ func main() {
setupLog.Error(err, "unable to start manager")
os.Exit(1)
}
// TODO: Set this with credentials on the server side
// TODO: This needs to be set so we don't fail when instantiating client
// NOTE: Pass in nil client if connection isn't established
var client controllers.PorterClient
conn, err := grpc.DialContext(context.Background(), "porter-grpc-service:3001", grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
setupLog.Error(err, "unable to set up listener")
os.Exit(1)
}
defer conn.Close()
if conn != nil {
client = porterv1alpha1.NewPorterClient(conn)
}
if err = (&controllers.InstallationReconciler{
Client: mgr.GetClient(),
PorterGRPCClient: porterv1alpha1.NewPorterClient(conn),
PorterGRPCClient: client,
Log: ctrl.Log.WithName("controllers").WithName("Installation"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
Expand Down

0 comments on commit 27bee7a

Please sign in to comment.