Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added env based support for HTTPS connection #4706

Merged
merged 25 commits into from
Jul 8, 2024

Conversation

Saranya-jena
Copy link
Contributor

@Saranya-jena Saranya-jena commented Jun 13, 2024

Proposed changes

Enhanced auth and the graphql server to support both http and https and allow users to leverage either option using env.

Types of changes

What types of changes does your code introduce to Litmus? Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices applies)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have signed the commit for DCO to be passed.
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added necessary documentation (if appropriate)

Dependency

  • Please add the links to the dependent PR need to be merged before this (if any).

Special notes for your reviewer:

Signed-off-by: Saranya-jena <saranya.jena@harness.io>
if utils.CustomTlsCert != "" && utils.TlSKey != "" {
go runGrpcServerWithTLS(applicationService)
} else {
log.Fatalf("Failure to start chaoscenter authentication REST server due to empty TLS cert file path and TLS key path")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Fatalf("Failure to start chaoscenter authentication REST server due to empty TLS cert file path and TLS key path")
log.Fatalf("Failure to start chaoscenter authentication GRPC server due to empty TLS cert file path and TLS key path")

Signed-off-by: Saranya-jena <saranya.jena@harness.io>
@Saranya-jena Saranya-jena marked this pull request as ready for review June 21, 2024 05:17
}

if enableHTTPSConnection {
if utils.CustomTlsCert != "" && utils.TlSKey != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can rename it wrt paths

Copy link
Member

@namkyu1999 namkyu1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you check build-pipeline / backend-checks (pull_request) ?

Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
log.Infof("Listening and serving gRPC on %s with TLS", utils.GrpcPort)
err = grpcServer.Serve(lis)
if err != nil {
log.Fatalf("Failure to start litmus-portal authentication GRPC server due to %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Fatalf("Failure to start litmus-portal authentication GRPC server due to %v", err)
log.Fatalf("Failure to start chaos-center authentication GRPC server due to %v", err)

log.Fatalf("Failure to start litmus-portal authentication server due to %s", err)
}

// configuration of the certificate what we want
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// configuration of the certificate what we want
// configuring TLS config based on provided certificates & keys

@@ -20,6 +21,7 @@ func ValidateRole(ctx context.Context, projectID string,
requiredRoles,
invitation)
if err != nil {
fmt.Println("errrrrrrrrrrrr ", err)
Copy link
Contributor

@Jonsy13 Jonsy13 Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed or print it with logrus and make it error level?

go startGRPCServer(utils.Config.RpcPort, mongodbOperator) // start GRPC serve
if enableHTTPSConnection {
if utils.Config.ServerTlsCertPath != "" && utils.Config.ServerTlsKeyPath != "" {
go startGRPCServerWithTLS("8001", mongodbOperator) // start GRPC serve
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Port is hardcoded

}
}()
if enableHTTPSConnection {
// configuration of the certificate what we want
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need log here as well same as above

log.Infof("graphql server running at https://localhost:%s", utils.Config.HttpsPort)

Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Signed-off-by: Saranya-jena <saranya.jena@harness.io>
@Saranya-jena Saranya-jena merged commit 9f4fe25 into litmuschaos:master Jul 8, 2024
18 of 19 checks passed
@Saranya-jena Saranya-jena mentioned this pull request Jul 11, 2024
9 tasks
andoriyaprashant pushed a commit to andoriyaprashant/litmus that referenced this pull request Sep 7, 2024
* Added env based support for HTTPS connection

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* resolved review comments

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* updated logic

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* fixed importd

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* added helper files

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* resolved comments

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* resolved comments

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* Update push.yml

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* Update push.yml

* updated oush.yam

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* updated manifest

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

---------

Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Co-authored-by: Namkyu Park <53862866+namkyu1999@users.noreply.github.com>
Signed-off-by: andoriyaprashant <prashantandoriya@gmail.com>
andoriyaprashant pushed a commit to andoriyaprashant/litmus that referenced this pull request Sep 7, 2024
* Added env based support for HTTPS connection

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* resolved review comments

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* updated logic

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* fixed importd

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* added helper files

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* resolved comments

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* resolved comments

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* Update push.yml

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* Update push.yml

* updated oush.yam

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* updated manifest

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

---------

Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Co-authored-by: Namkyu Park <53862866+namkyu1999@users.noreply.github.com>
Signed-off-by: andoriyaprashant <prashantandoriya@gmail.com>
sagnik3788 pushed a commit to sagnik3788/litmus that referenced this pull request Oct 5, 2024
* Added env based support for HTTPS connection

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* resolved review comments

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* updated logic

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* fixed importd

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* added helper files

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* resolved comments

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* resolved comments

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* Update push.yml

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* minor changes

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* Update push.yml

* updated oush.yam

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* updated manifest

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

---------

Signed-off-by: Saranya-jena <saranya.jena@harness.io>
Co-authored-by: Namkyu Park <53862866+namkyu1999@users.noreply.github.com>
Signed-off-by: sagnik3788 <116512372+sagnik3788@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants