Skip to content

Commit

Permalink
Added err validations
Browse files Browse the repository at this point in the history
  • Loading branch information
share2kanna committed May 3, 2024
1 parent 96f4285 commit 6255396
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions capten/agent/gin-api-server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"github.com/kube-tarian/kad/capten/agent/internal/config"
)

func StartRestServer(rpcapi api.ServerInterface, cfg *config.SericeConfig, certFileName, keyFileName string) {
func StartRestServer(rpcapi api.ServerInterface, cfg *config.SericeConfig, certFileName, keyFileName string) error {
r := gin.Default()
api.RegisterHandlers(r, rpcapi)

r.RunTLS(fmt.Sprintf("%s:%d", cfg.Host, cfg.RestPort), certFileName, keyFileName)
return r.RunTLS(fmt.Sprintf("%s:%d", cfg.Host, cfg.RestPort), certFileName, keyFileName)
}
8 changes: 7 additions & 1 deletion capten/agent/internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ func Start() {
if err != nil {
log.Fatalf("Failed to setupt CA Cert Issuer in cert-manager %v", err)
}
go ginapiserver.StartRestServer(rpcapi, cfg, certFileName, keyFileName)

go func() {
err := ginapiserver.StartRestServer(rpcapi, cfg, certFileName, keyFileName)
if err != nil {
log.Errorf("Failed to start REST server, %v", err)
}
}()

err = registerK8SWatcher(as)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions capten/agent/internal/app/ca_cert_issuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
)

const (
certFileName = "server.cert"
keyFileName = "server.key"
certFileName = "/tmp/server.cert"
keyFileName = "/tmp/server.key"
namespace = "capten"
serverCertSecretName = "agent-server-mtls"
)
Expand Down

0 comments on commit 6255396

Please sign in to comment.