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-844 Unable to have a working statusUrl in FlowCollector with Loki Operator 5.6 #307

Merged
merged 4 commits into from Mar 30, 2023

Conversation

jpinsonneau
Copy link
Contributor

@jpinsonneau jpinsonneau commented Mar 24, 2023

Added statusTls option in CRD for status URL

Check example yaml:

    # Uncomment lines below for typical installation with loki-operator (5.6+ needed)
    # url: 'https://loki-gateway-http.netobserv.svc:8080/api/logs/v1/network/'
    # statusUrl: 'https://loki-query-frontend-http.netobserv.svc:3100/'
    # authToken: FORWARD
    # statusTls:
    #   enable: true
    #   caCert:
    #     certFile: service-ca.crt
    #     name: loki-ca-bundle
    #     type: configmap
    #   userCert:
    #     certFile: tls.crt
    #     certKey: tls.key
    #     name: loki-query-frontend-http
    #     type: secret

@codecov
Copy link

codecov bot commented Mar 24, 2023

Codecov Report

Merging #307 (9fb3657) into main (3130154) will increase coverage by 0.73%.
The diff coverage is 56.66%.

@@            Coverage Diff             @@
##             main     #307      +/-   ##
==========================================
+ Coverage   49.67%   50.41%   +0.73%     
==========================================
  Files          43       43              
  Lines        5075     5096      +21     
==========================================
+ Hits         2521     2569      +48     
+ Misses       2343     2318      -25     
+ Partials      211      209       -2     
Flag Coverage Δ
unittests 50.41% <56.66%> (+0.73%) ⬆️

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

Impacted Files Coverage Δ
api/v1alpha1/flowcollector_webhook.go 0.00% <0.00%> (ø)
api/v1alpha1/zz_generated.conversion.go 0.27% <0.00%> (+<0.01%) ⬆️
api/v1beta1/flowcollector_types.go 100.00% <ø> (ø)
...trollers/consoleplugin/consoleplugin_reconciler.go 62.17% <0.00%> (+1.55%) ⬆️
controllers/consoleplugin/consoleplugin_objects.go 92.76% <78.57%> (+0.30%) ⬆️
api/v1beta1/zz_generated.deepcopy.go 42.50% <100.00%> (+0.16%) ⬆️
pkg/helper/flowcollector.go 65.38% <100.00%> (+3.68%) ⬆️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -68,7 +68,18 @@ spec:
# Uncomment lines below for typical installation with loki-operator (5.6+ needed)
# url: 'https://loki-gateway-http.netobserv.svc:8080/api/logs/v1/network/'
# statusUrl: 'https://loki-query-frontend-http.netobserv.svc:3100/'
# authToken: HOST
# authToken: FORWARD
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FORWARD is recommended in the doc; we should also recommend it in the sample

Comment on lines 72 to 82
# statusTls:
# enable: true
# caCert:
# certFile: service-ca.crt
# name: loki-ca-bundle
# type: configmap
# userCert:
# certFile: tls.crt
# certKey: tls.key
# name: loki-query-frontend-http
# type: secret
Copy link
Contributor Author

Choose a reason for hiding this comment

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

statusTls needs both loki-ca-bundle and loki-query-frontend-http crt and key files for mTLS

args = append(args, "--loki-status-user-key-path", helper.GetUserKeyPath(&statusTLS, lokiStatusCerts))
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

can we extend unit-test to cover this newly added field ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

statusTLS := helper.LokiStatusTLS(&desired.Loki)
if statusTLS.Enable {
if statusTLS.InsecureSkipVerify {
args = append(args, "-loki-status-skip-tls")
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a typo it should be --loki-status-skip-tls ?

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 think we should harmonize everything with a single minus character as it's already the case for most of these args. I will also fix the existing --loki-ca-path

Thanks for pointing that !

@@ -42,6 +42,13 @@ func LokiForwardUserToken(spec *flowslatest.FlowCollectorLoki) bool {
return spec.AuthToken == flowslatest.LokiAuthForwardUserToken
}

func LokiStatusTLS(spec *flowslatest.FlowCollectorLoki) flowslatest.ClientTLS {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: GetLokiStatusTLS ?

@Amoghrd
Copy link
Contributor

Amoghrd commented Mar 27, 2023

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 27, 2023
@github-actions
Copy link

New images:

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

They will expire after two weeks.

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-1b8fdb7
  displayName: NetObserv development catalog
  publisher: Me
  updateStrategy:
    registryPoll:
      interval: 1m

Comment on lines 46 to 49
if spec.StatusTLS != nil {
return *spec.StatusTLS
}
return spec.TLS
Copy link
Member

@jotak jotak Mar 27, 2023

Choose a reason for hiding this comment

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

Rather than having a pointer and allowing nil to switch to using global TLS , wouldn't it be better to rely on whether the status URL is set, to look at StatusTLS or just TLS ?

  • If we use main URL as the status URL, then we use also main TLS as the TLS config - StatusTLS is unused in that case
  • If statusURL is set, look at StatusTLS (which can still be disabled if not wanted)

IMO it makes things more explicit so less surprising (?)

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'm fine with that 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@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 Mar 28, 2023
@msherif1234
Copy link
Contributor

/lgtm

@Amoghrd
Copy link
Contributor

Amoghrd commented Mar 28, 2023

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 28, 2023
@github-actions
Copy link

New images:

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

They will expire after two weeks.

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-f80106b
  displayName: NetObserv development catalog
  publisher: Me
  updateStrategy:
    registryPoll:
      interval: 1m

@openshift-ci openshift-ci bot removed the lgtm label Mar 28, 2023
@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 Mar 28, 2023
@jpinsonneau
Copy link
Contributor Author

@Amoghrd I've restored the default values as we discussed together 467289f

              "statusTls": {
                "caCert": {
                  "certFile": "service-ca.crt",
                  "name": "loki-ca-bundle",
                  "type": "configmap"
                },
                "userCert": {
                  "certFile": "tls.crt",
                  "certKey": "tls.key",
                  "name": "loki-query-frontend-http",
                  "type": "secret"
                },
                "enable": false,
                "insecureSkipVerify": false
              },

@Amoghrd
Copy link
Contributor

Amoghrd commented Mar 28, 2023

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 28, 2023
@Amoghrd
Copy link
Contributor

Amoghrd commented Mar 28, 2023

/rm ok-to-test

@jpinsonneau jpinsonneau removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 28, 2023
@jpinsonneau
Copy link
Contributor Author

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 28, 2023
@github-actions
Copy link

New images:

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

They will expire after two weeks.

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-56e777e
  displayName: NetObserv development catalog
  publisher: Me
  updateStrategy:
    registryPoll:
      interval: 1m

@jpinsonneau jpinsonneau removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 28, 2023
@jpinsonneau
Copy link
Contributor Author

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 28, 2023
@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 Mar 28, 2023
@github-actions
Copy link

New images:

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

They will expire after two weeks.

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-9f45e7d
  displayName: NetObserv development catalog
  publisher: Me
  updateStrategy:
    registryPoll:
      interval: 1m

@Amoghrd
Copy link
Contributor

Amoghrd commented Mar 28, 2023

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved QE has approved this pull request label Mar 28, 2023
@jotak
Copy link
Member

jotak commented Mar 30, 2023

/lgtm

@jpinsonneau
Copy link
Contributor Author

/approve

@openshift-ci
Copy link

openshift-ci bot commented Mar 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jpinsonneau

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-merge-robot openshift-merge-robot merged commit 55f6bd7 into netobserv:main Mar 30, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm qe-approved QE has approved this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants