Skip to content

Commit

Permalink
Prepended colon in the ports env (#4760)
Browse files Browse the repository at this point in the history
* Prepended colon in the ports env

Signed-off-by: Saranya-jena <[email protected]>

* Prepended colon in the ports env

Signed-off-by: Saranya-jena <[email protected]>

* updated manifest

Signed-off-by: Saranya-jena <[email protected]>

* updated manifest

Signed-off-by: Saranya-jena <[email protected]>

---------

Signed-off-by: Saranya-jena <[email protected]>
  • Loading branch information
Saranya-jena authored Jul 15, 2024
1 parent 33ad308 commit 462fd1f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 19 deletions.
18 changes: 8 additions & 10 deletions chaoscenter/authentication/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,15 @@ func runRestServer(applicationService services.ApplicationService) {
routes.UserRouter(app, applicationService)
routes.ProjectRouter(app, applicationService)

log.Infof("Listening and serving HTTP on %s", utils.RestPort)

if utils.EnableInternalTls {
if utils.TlsCertPath != "" && utils.TlSKeyPath != "" {
conf := utils.GetTlsConfig()
server := http.Server{
Addr: utils.RestPort,
Addr: ":" + utils.RestPort,
Handler: app,
TLSConfig: conf,
}
log.Infof("Listening and serving HTTPS on %s", utils.RestPort)
log.Infof("Listening and serving HTTPS on :%s", utils.RestPort)
err := server.ListenAndServeTLS("", "")
if err != nil {
log.Fatalf("Failure to start litmus-portal authentication REST server due to %v", err)
Expand All @@ -216,8 +214,8 @@ func runRestServer(applicationService services.ApplicationService) {
log.Fatalf("Failure to start chaoscenter authentication REST server due to empty TLS cert file path and TLS key path")
}
} else {
log.Infof("Listening and serving HTTP on %s", utils.RestPort)
err := app.Run(utils.RestPort)
log.Infof("Listening and serving HTTP on :%s", utils.RestPort)
err := app.Run(":" + utils.RestPort)
if err != nil {
log.Fatalf("Failure to start litmus-portal authentication REST server due to %v", err)
}
Expand All @@ -226,15 +224,15 @@ func runRestServer(applicationService services.ApplicationService) {

func runGrpcServer(applicationService services.ApplicationService) {
// Starting gRPC server
lis, err := net.Listen("tcp", utils.GrpcPort)
lis, err := net.Listen("tcp", ":"+utils.GrpcPort)
if err != nil {
log.Fatalf("Failure to start litmus-portal authentication server due"+
" to %s", err)
}
grpcApplicationServer := grpcHandler.ServerGrpc{ApplicationService: applicationService}
grpcServer := grpc.NewServer()
grpcPresenter.RegisterAuthRpcServiceServer(grpcServer, &grpcApplicationServer)
log.Infof("Listening and serving gRPC on %s", utils.GrpcPort)
log.Infof("Listening and serving gRPC on :%s", utils.GrpcPort)
err = grpcServer.Serve(lis)
if err != nil {
log.Fatalf("Failure to start chaoscenter authentication GRPC server due to %v", err)
Expand All @@ -244,7 +242,7 @@ func runGrpcServer(applicationService services.ApplicationService) {
func runGrpcServerWithTLS(applicationService services.ApplicationService) {

// Starting gRPC server
lis, err := net.Listen("tcp", utils.GrpcPort)
lis, err := net.Listen("tcp", ":"+utils.GrpcPort)
if err != nil {
log.Fatalf("Failure to start litmus-portal authentication server due to %s", err)
}
Expand All @@ -262,7 +260,7 @@ func runGrpcServerWithTLS(applicationService services.ApplicationService) {

grpcPresenter.RegisterAuthRpcServiceServer(grpcServer, &grpcApplicationServer)

log.Infof("Listening and serving gRPC on %s with TLS", utils.GrpcPort)
log.Infof("Listening and serving gRPC on :%s with TLS", utils.GrpcPort)
err = grpcServer.Serve(lis)
if err != nil {
log.Fatalf("Failure to start chaoscenter authentication GRPC server due to %v", err)
Expand Down
4 changes: 2 additions & 2 deletions chaoscenter/graphql/server/pkg/grpc/auth_grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ func GetAuthGRPCSvcClient(conn *grpc.ClientConn) (protos.AuthRpcServiceClient, *
tlsCredential := credentials.NewTLS(conf)

// Set up a connection to the server.
conn, err = grpc.NewClient(utils.Config.LitmusAuthGrpcEndpoint+utils.Config.LitmusAuthGrpcPort, grpc.WithTransportCredentials(tlsCredential))
conn, err = grpc.NewClient(utils.Config.LitmusAuthGrpcEndpoint+":"+utils.Config.LitmusAuthGrpcPort, grpc.WithTransportCredentials(tlsCredential))
if err != nil {
logrus.Fatalf("did not connect: %v", err)
}
} else {
logrus.Fatalf("Failure to start chaoscenter authentication REST server due to empty TLS cert file path and TLS key path")
}
} else {
conn, err = grpc.Dial(utils.Config.LitmusAuthGrpcEndpoint+utils.Config.LitmusAuthGrpcPort, grpc.WithBlock(), grpc.WithInsecure())
conn, err = grpc.Dial(utils.Config.LitmusAuthGrpcEndpoint+":"+utils.Config.LitmusAuthGrpcPort, grpc.WithBlock(), grpc.WithInsecure())
if err != nil {
logrus.Fatalf("did not connect: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion chaoscenter/graphql/server/utils/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Configuration struct {
ChaosCenterUiEndpoint string `split_words:"true" default:"https://localhost:8080"`
TlsCertB64 string `split_words:"true"`
LitmusAuthGrpcEndpoint string `split_words:"true" default:"localhost"`
LitmusAuthGrpcPort string `split_words:"true" default:":3030"`
LitmusAuthGrpcPort string `split_words:"true" default:"3030"`
KubeConfigFilePath string `split_words:"true"`
RemoteHubMaxSize string `split_words:"true"`
SkipSslVerify string `split_words:"true"`
Expand Down
4 changes: 2 additions & 2 deletions chaoscenter/manifests/litmus-getting-started.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ spec:
- name: LITMUS_AUTH_GRPC_ENDPOINT
value: "litmusportal-auth-server-service"
- name: LITMUS_AUTH_GRPC_PORT
value: ":3030"
value: "3030"
- name: WORKFLOW_HELPER_IMAGE_VERSION
value: "ci"
- name: REMOTE_HUB_MAX_SIZE
Expand Down Expand Up @@ -346,7 +346,7 @@ spec:
- name: LITMUS_GQL_GRPC_ENDPOINT
value: "litmusportal-server-service"
- name: LITMUS_GQL_GRPC_PORT
value: ":8000"
value: "8000"
- name: ALLOWED_ORIGINS
value: ".*" #eg: ^(http://|https://|)litmuschaos.io(:[0-9]+|)?,^(http://|https://|)litmusportal-server-service(:[0-9]+|)?
- name: ENABLE_INTERNAL_TLS
Expand Down
4 changes: 2 additions & 2 deletions chaoscenter/manifests/litmus-installation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ spec:
- name: LITMUS_AUTH_GRPC_ENDPOINT
value: "litmusportal-auth-server-service"
- name: LITMUS_AUTH_GRPC_PORT
value: ":3030"
value: "3030"
- name: WORKFLOW_HELPER_IMAGE_VERSION
value: "ci"
- name: REMOTE_HUB_MAX_SIZE
Expand Down Expand Up @@ -379,7 +379,7 @@ spec:
- name: LITMUS_GQL_GRPC_ENDPOINT
value: "litmusportal-server-service"
- name: LITMUS_GQL_GRPC_PORT
value: ":8000"
value: "8000"
- name: ALLOWED_ORIGINS
value: "^(http://|https://|)litmuschaos.io(:[0-9]+|)?,^(http://|https://|)litmusportal-server-service(:[0-9]+|)?" #ip needs to added here
- name: ENABLE_INTERNAL_TLS
Expand Down
4 changes: 2 additions & 2 deletions chaoscenter/manifests/litmus-without-resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ spec:
- name: LITMUS_AUTH_GRPC_ENDPOINT
value: "litmusportal-auth-server-service"
- name: LITMUS_AUTH_GRPC_PORT
value: ":3030"
value: "3030"
- name: WORKFLOW_HELPER_IMAGE_VERSION
value: "ci"
- name: REMOTE_HUB_MAX_SIZE
Expand Down Expand Up @@ -361,7 +361,7 @@ spec:
- name: LITMUS_GQL_GRPC_ENDPOINT
value: "litmusportal-server-service"
- name: LITMUS_GQL_GRPC_PORT
value: ":8000"
value: "8000"
- name: ALLOWED_ORIGINS
value: "^(http://|https://|)litmuschaos.io(:[0-9]+|)?,^(http://|https://|)litmusportal-server-service(:[0-9]+|)?" #ip needs to added here
- name: ENABLE_INTERNAL_TLS
Expand Down

0 comments on commit 462fd1f

Please sign in to comment.