Skip to content

ROX-13034: fix gRPC scanner#3469

Merged
SimonBaeumer merged 6 commits intomasterfrom
sb/rox-13034-fix-grpc-scanner
Nov 7, 2022
Merged

ROX-13034: fix gRPC scanner#3469
SimonBaeumer merged 6 commits intomasterfrom
sb/rox-13034-fix-grpc-scanner

Conversation

@SimonBaeumer
Copy link
Contributor

@SimonBaeumer SimonBaeumer commented Oct 18, 2022

Description

Add .svc endpoint to be respected by NO_PROXY env configuration.

Checklist

  • Investigated and inspected CI test results
  • Unit test and regression tests added
  • Evaluated and added CHANGELOG entry if required
  • Determined and documented upgrade steps
  • Documented user facing changes (create PR based on openshift/openshift-docs and merge into rhacs-docs)

If any of these don't apply, please comment below.

Testing Performed

  • CI
  • Deploy stack rox with global proxy

@ghost
Copy link

ghost commented Oct 18, 2022

Images are ready for the commit at a188490.

To use with deploy scripts, first export MAIN_IMAGE_TAG=3.72.x-523-ga1884901cf.

@SimonBaeumer SimonBaeumer force-pushed the sb/rox-13034-fix-grpc-scanner branch from abdc276 to ff10ff8 Compare October 24, 2022 13:24
@SimonBaeumer SimonBaeumer requested review from RTann and dhaus67 October 25, 2022 14:14
Copy link
Contributor

@dhaus67 dhaus67 left a comment

Choose a reason for hiding this comment

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

I'd like to additionally ask you to change the following:

Currently, the logic within pkg/scanners/clairify/clairify.go relies on the GetGrpcEndpoint to be unset for the default scanner that we configure. However it would be nice to set the GrpcEndpoint when creating the default integration, i.e. this part within central/imageintegration/store/default.go.

Note, however, that we do not update existing integrations when starting central. We also cannot write a migration for it, since the value for the grpc endpoint is dynamic and depends on the env.Namespace.Setting. So the code path within pkg/scanners/clarify/clairify.go is still required.

- ROX-11592: Support to Get / Update / Mutate / Remove of groups via the `props` field and without the `props.id` field
being set in the `/v1/groups` endpoint have been removed.
- The unused "ComplianceRunSchedule" resource has been removed.
- ROX-13034: Central reaches out to scanner `scanner.<namespace>.svc` now to respect OpenShift's `NO_PROXY` configuration.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should make sure this gets enough visibility for customers, as this one has impact on existing proxy settings and requires updates for them (e.g. imagine people having scanner.<namespace> in their NO_PROXY).

Copy link
Contributor

Choose a reason for hiding this comment

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

+1. Just be sure to add the training and docs labels to the Jira

Copy link
Contributor Author

@SimonBaeumer SimonBaeumer Oct 26, 2022

Choose a reason for hiding this comment

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

Good question.
I assume the changelog is published to customers and is sufficient.
+1 on the training label that support is aware.

What exactly does the docs label do?
I think mentioning it in the docs is overkill, if it adds to changelog sure, this must be there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gaurav-nelson can you share your opinion?

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 mention it in the release notes and also add a note in the proxy configuration section.

@SimonBaeumer related to @dhaus67's comment, if someone have scanner.<namespace> in their NO_PROXY settings:

  • What issues they will face if they don't change anything?
  • How can they fix those issues? I guess its by updating their NO_PROXY settings, so how to update those settings?
  • Can they run a command to fix it? or do they have to manually change things?

Copy link
Contributor Author

@SimonBaeumer SimonBaeumer Nov 2, 2022

Choose a reason for hiding this comment

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

@gaurav-nelson

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gaurav-nelson Are there any action items I should follow up with?

@porridge porridge mentioned this pull request Oct 26, 2022
5 tasks
@SimonBaeumer
Copy link
Contributor Author

I'd like to additionally ask you to change the following:

Currently, the logic within pkg/scanners/clairify/clairify.go relies on the GetGrpcEndpoint to be unset for the default scanner that we configure. However it would be nice to set the GrpcEndpoint when creating the default integration, i.e. this part within central/imageintegration/store/default.go.

Note, however, that we do not update existing integrations when starting central. We also cannot write a migration for it, since the value for the grpc endpoint is dynamic and depends on the env.Namespace.Setting. So the code path within pkg/scanners/clarify/clairify.go is still required.

Is my understanding correct that you are suggesting to configure the conf *storage.ClairifyConfig.GrpcEndpoint instead of hardcoding the scanner endpoint?
I never worked with any of that code, because of that I am careful to implement such changes which may impact other areas of the code.

@SimonBaeumer SimonBaeumer force-pushed the sb/rox-13034-fix-grpc-scanner branch from 3c9a2fb to 9283dfb Compare October 26, 2022 14:24
@dhaus67
Copy link
Contributor

dhaus67 commented Nov 2, 2022

@SimonBaeumer Essentially, the code would be extended to the following (code lines as reference):

		IntegrationConfig: &storage.ImageIntegration_Clairify{
			Clairify: &storage.ClairifyConfig{
				Endpoint: fmt.Sprintf("https://%s:8080", scannerEndpoint),
                                 GrpcEndpoint: fmt.Sprintf("%s:8080", scannerEndpoint),
			},
		},

It would still be "hardcoded", so no substantial changes IMO.

@SimonBaeumer
Copy link
Contributor Author

SimonBaeumer commented Nov 2, 2022

@SimonBaeumer Essentially, the code would be extended to the following (code lines as reference):

		IntegrationConfig: &storage.ImageIntegration_Clairify{
			Clairify: &storage.ClairifyConfig{
				Endpoint: fmt.Sprintf("https://%s:8080", scannerEndpoint),
                                 GrpcEndpoint: fmt.Sprintf("%s:8080", scannerEndpoint),
			},
		},

It would still be "hardcoded", so no substantial changes IMO.

@dhaus67 Documented the behaviour of the default that it is added to the image integration's database entry and loaded the namespace dynamically to setup gRPC endpoints.

I did not set the gRPC endpoint on struct creation because the call is a constructor call which sets a default gRPC endpoint automatically already.
By adding the gRPC endpoint to the parameter list we essentially only duplicate the default without providing value, instead it may confuse other engineers later who read the code because the default path may never be reached.

@openshift-ci
Copy link

openshift-ci bot commented Nov 2, 2022

@SimonBaeumer: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/gke-nongroovy-e2e-tests d317d2f link false /test gke-nongroovy-e2e-tests

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

scannerEndpoint = fmt.Sprintf("scanner.%s.svc", env.Namespace.Setting())
)

// GetScannerEndpoint returns the scanner endpoint with a configured namespace. env.ScannerGRPCEndpoint is only used by Sensor.
Copy link
Contributor

Choose a reason for hiding this comment

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

env.ScannerGRPCEndpoint should probably also be scanner.<namespace>.svc:8443, right? or perhaps we should not use that at all and just use this instead. Otherwise, wouldn't OpenShifts using non-stackrox namespaces has "local scanning" issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default for the scanner endpoint is set by Helm in Sensor's deployment spec. The ROX_NAMESPACE env var which the function depends on is never set on Sensor, thus has no effect.

https://github.com/stackrox/stackrox/blob/master/image/templates/helm/stackrox-secured-cluster/templates/sensor.yaml.htpl#L124-L129

We can align this behaviour but would prefer to do it in a different PR to merge this one first.

@SimonBaeumer SimonBaeumer force-pushed the sb/rox-13034-fix-grpc-scanner branch from d317d2f to a188490 Compare November 7, 2022 08:33
@SimonBaeumer SimonBaeumer enabled auto-merge (squash) November 7, 2022 08:33
@SimonBaeumer SimonBaeumer merged commit 44a0457 into master Nov 7, 2022
@SimonBaeumer SimonBaeumer deleted the sb/rox-13034-fix-grpc-scanner branch November 7, 2022 09:12
rhybrillou pushed a commit that referenced this pull request Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants