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

NETOBSERV-1087: Added fields for ca certificate configuration #379

Merged
merged 2 commits into from Sep 8, 2023

Conversation

OlivierCazade
Copy link
Contributor

No description provided.

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Jun 20, 2023

@OlivierCazade: This pull request references NETOBSERV-1087 which is a valid jira issue.

In response to this:

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.

@codecov
Copy link

codecov bot commented Jun 21, 2023

Codecov Report

Patch coverage: 46.39% and project coverage change: +1.98% 🎉

Comparison is base (0d6ebe8) 53.67% compared to head (2824d27) 55.66%.
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #379      +/-   ##
==========================================
+ Coverage   53.67%   55.66%   +1.98%     
==========================================
  Files          44       46       +2     
  Lines        5559     5954     +395     
==========================================
+ Hits         2984     3314     +330     
- Misses       2359     2412      +53     
- Partials      216      228      +12     
Flag Coverage Δ
unittests 55.66% <46.39%> (+1.98%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
api/v1alpha1/flowcollector_webhook.go 0.00% <0.00%> (ø)
api/v1alpha1/zz_generated.conversion.go 0.25% <0.00%> (-0.01%) ⬇️
api/v1beta1/flowcollector_types.go 100.00% <ø> (ø)
controllers/flowlogspipeline/flp_common_objects.go 80.66% <28.57%> (-1.11%) ⬇️
api/v1beta1/zz_generated.deepcopy.go 52.21% <64.51%> (-1.57%) ⬇️
controllers/consoleplugin/consoleplugin_objects.go 94.61% <100.00%> (-0.82%) ⬇️
pkg/helper/helpers.go 100.00% <100.00%> (ø)
pkg/helper/monitoring.go 100.00% <100.00%> (ø)

... and 12 files with indirect coverage changes

☔ View full report in Codecov by Sentry.

📢 Have feedback on the report? Share it here.

Comment on lines 748 to 815
if b.desired.Processor.Metrics.Server.TLS.Provided.CaFile != "" {
if b.desired.Processor.Metrics.Server.TLS.Provided.Type == flowslatest.RefTypeConfigMap {
flpServiceMonitorObject.Spec.Endpoints[0].TLSConfig.SafeTLSConfig.CA = monitoringv1.SecretOrConfigMap{
ConfigMap: &corev1.ConfigMapKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: b.desired.Processor.Metrics.Server.TLS.Provided.Name,
},
Key: b.desired.Processor.Metrics.Server.TLS.Provided.CaFile,
},
}
} else if b.desired.Processor.Metrics.Server.TLS.Provided.Type == flowslatest.RefTypeSecret {
flpServiceMonitorObject.Spec.Endpoints[0].TLSConfig.SafeTLSConfig.CA = monitoringv1.SecretOrConfigMap{
Secret: &corev1.SecretKeySelector{
LocalObjectReference: corev1.LocalObjectReference{
Name: b.desired.Processor.Metrics.Server.TLS.Provided.Name,
},
Key: b.desired.Processor.Metrics.Server.TLS.Provided.CaFile,
},
}
}
}
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 to provide ConfigMap or Secret if InsecureSkipVerify is true ?

I would suggest to create an helper to check both b.desired.Processor.Metrics.Server.TLS.Provided.Type and b.desired.Processor.Metrics.Server.TLS.Provided.InsecureSkipVerify

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks!

@@ -678,6 +678,16 @@ type CertificateReference struct {
// certKey defines the path to the certificate private key file name within the config map or secret. Omit when the key is not necessary.
// +optional
CertKey string `json:"certKey,omitempty"`

Copy link
Member

Choose a reason for hiding this comment

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

These added fields are confusing when CertificateReference is used from ClientTLS, as it also contains a reference for caCert and insecureSkipVerify.

I think we need an intermediate struct between ServerTLS and CertificateReference, and move these fields in that new struct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the field directly to the ServerTLS.

@jotak jotak added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jul 31, 2023
@github-actions
Copy link

New images:

  • quay.io/netobserv/network-observability-operator:0c381db
  • quay.io/netobserv/network-observability-operator-bundle:v0.0.0-0c381db
  • quay.io/netobserv/network-observability-operator-catalog:v0.0.0-0c381db

They will expire after two weeks.

To deploy this build:

# Direct deployment, from operator repo
IMAGE=quay.io/netobserv/network-observability-operator:0c381db make deploy

# Or using operator-sdk
operator-sdk run bundle quay.io/netobserv/network-observability-operator-bundle:v0.0.0-0c381db

Or as a Catalog Source:

apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: netobserv-dev
  namespace: openshift-marketplace
spec:
  sourceType: grpc
  image: quay.io/netobserv/network-observability-operator-catalog:v0.0.0-0c381db
  displayName: NetObserv development catalog
  publisher: Me
  updateStrategy:
    registryPoll:
      interval: 1m

@github-actions github-actions bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jul 31, 2023
@jotak jotak added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jul 31, 2023
@github-actions
Copy link

New images:

  • quay.io/netobserv/network-observability-operator:a7d07d9
  • quay.io/netobserv/network-observability-operator-bundle:v0.0.0-a7d07d9
  • quay.io/netobserv/network-observability-operator-catalog:v0.0.0-a7d07d9

They will expire after two weeks.

To deploy this build:

# Direct deployment, from operator repo
IMAGE=quay.io/netobserv/network-observability-operator:a7d07d9 make deploy

# Or using operator-sdk
operator-sdk run bundle quay.io/netobserv/network-observability-operator-bundle:v0.0.0-a7d07d9

Or as a Catalog Source:

apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: netobserv-dev
  namespace: openshift-marketplace
spec:
  sourceType: grpc
  image: quay.io/netobserv/network-observability-operator-catalog:v0.0.0-a7d07d9
  displayName: NetObserv development catalog
  publisher: Me
  updateStrategy:
    registryPoll:
      interval: 1m

@jotak jotak self-requested a review September 7, 2023 07:59
Comment on lines 169 to 172
// // This function need to be manually created because conversion-gen not able to create it intentionally because
// // we have new defined fields in v1beta1 not in v1alpha1
// // nolint:golint,stylecheck,revive
// func Convert_v1beta1_CertificateReference_To_v1alpha1_CertificateReference(in *v1beta1.CertificateReference, out *CertificateReference, s apiconversion.Scope) error {
Copy link
Member

Choose a reason for hiding this comment

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

nit: looks like some garbage commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, removed, thank you!

@github-actions github-actions bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Sep 8, 2023
@jotak
Copy link
Member

jotak commented Sep 8, 2023

/lgtm
thanks @OlivierCazade !
I will do a follow-up PR to remove the ConfigOrSecret api that was introduced with sasl (unsupported), since it overlaps with the new FileReference (which is actually better)

@openshift-ci openshift-ci bot added the lgtm label Sep 8, 2023
@jotak jotak self-requested a review September 8, 2023 09:30
@jotak
Copy link
Member

jotak commented Sep 8, 2023

I'm merging for the branch cut, so this must be verified post-merge

@jotak
Copy link
Member

jotak commented Sep 8, 2023

/approve

@openshift-ci
Copy link

openshift-ci bot commented Sep 8, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jotak

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Sep 8, 2023
@openshift-merge-robot openshift-merge-robot merged commit 7aa9ff7 into netobserv:main Sep 8, 2023
9 checks passed
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.

None yet

5 participants