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

Invalid address error in googlepubsub-provider #680

Closed
Tracked by #4473
manhvo opened this issue Dec 11, 2023 · 7 comments · Fixed by #682
Closed
Tracked by #4473

Invalid address error in googlepubsub-provider #680

manhvo opened this issue Dec 11, 2023 · 7 comments · Fixed by #682

Comments

@manhvo
Copy link

manhvo commented Dec 11, 2023

When trying to create a Provider resource as below:

apiVersion: notification.toolkit.fluxcd.io/v1beta2
kind: Provider
metadata:
  name: googlepubsub-provider
spec:
  type: googlepubsub
  address: myprojectid
  channel: flux-notification

I keep getting this error:

NAME                    AGE     READY   STATUS
googlepubsub-provider   2d20h   False   invalid address myprojectid parse "myprojectid": invalid URI for request

This is debug logs from notification-controller pod:

{"level":"error","ts":"2023-12-11T21:13:00.099Z","msg":"Reconciliation has stalled","controller":"provider","controllerGroup":"notification.toolkit.fluxcd.io","controllerKind":"Provider","Provider":{"name":"googlepubsub-provider","namespace":"flux-system"},"namespace":"flux-system","name":"googlepubsub-provider","reconcileID":"5f6f438d-78f8-4113-8de5-d1ee18dc8052","error":"invalid address myprojectid: parse \"myprojectid\": invalid URI for request","stacktrace":"github.com/fluxcd/notification-controller/internal/controller.(*ProviderReconciler).Reconcile.func1\n\tgithub.com/fluxcd/notification-controller/internal/controller/provider_controller.go:115\ngithub.com/fluxcd/notification-controller/internal/controller.(*ProviderReconciler).Reconcile\n\tgithub.com/fluxcd/notification-controller/internal/controller/provider_controller.go:147\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\tsigs.k8s.io/controller-runtime@v0.15.0/pkg/internal/controller/controller.go:118\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\tsigs.k8s.io/controller-runtime@v0.15.0/pkg/internal/controller/controller.go:314\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\tsigs.k8s.io/controller-runtime@v0.15.0/pkg/internal/controller/controller.go:265\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/controller-runtime@v0.15.0/pkg/internal/controller/controller.go:226"}
{"level":"debug","ts":"2023-12-11T21:13:00.099Z","logger":"events","msg":"invalid address myprojectid: parse \"myprojectid\": invalid URI for request","type":"Warning","object":{"kind":"Provider","namespace":"flux-system","name":"googlepubsub-provider","uid":"3628d627-de61-45c5-b3e8-09e4110aaee3","apiVersion":"notification.toolkit.fluxcd.io/v1beta2","resourceVersion":"1397382868"},"reason":"Failed"}

Can someone let me know what is the valid value for spec.address?

This document shows I should put project id, but it is not working.
https://fluxcd.io/flux/components/notification/providers/#google-pubsub

@darkowlzz
Copy link
Contributor

darkowlzz commented Dec 12, 2023

Hi, assuming that you're using the latest stable version of notification-controller v1.1.0, google pubsub and azure event hub are the only providers that don't have a URL for address. Looking at the code https://github.com/fluxcd/notification-controller/blob/v1.1.0/internal/controller/provider_controller.go#L181 and the examples in the docs, these two providers are expected to have secret refs which are required for the providers to work. Without secret refs, they are validated like other providers and are expected to have valid URL as address.

Notification-controller v1.2 is available which changes some of these validations and you may not see this same error anymore. But this version will be usable only with Flux v2.2, which is planned to release this week.

Hope this helps.

@manhvo
Copy link
Author

manhvo commented Dec 12, 2023

Thanks for your response @darkowlzz .

We are using notification-controller v1.0.0.

Regarding the secret, we are using GCP Workload Identity so I don't think we need to specify the secret.

https://fluxcd.io/flux/components/notification/providers/#google-pubsub

If no JSON credentials are specified, then the automatic authentication methods of the Google libraries will take place, and therefore methods like Workload Identity will be automatically attempted.

For now, looks like we need to upgrade notification-controller to v1.1.0, and then v1.2 later.

@darkowlzz
Copy link
Contributor

Seems like that may have missed during testing. Flux v2.2.0 was just released today. If you update you'll get notification-controller v1.2 which should no longer have the URL validation. Can you give it a try?

@darkowlzz
Copy link
Contributor

Maybe @matheuscscp can also provide some information on this topic.

@matheuscscp
Copy link
Member

Looks like in this pull request https://github.com/fluxcd/notification-controller/pull/565/files I forgot to remove the URL validation in some places. @darkowlzz after the googlepubsub Provider was published we decided to lift this URL syntax validation for the address. I'm filing a hotfix PR here.

@manhvo
Copy link
Author

manhvo commented Dec 20, 2023

I upgraded to 2.2.2 and it works well.
However there isn't a status column as before:

NAME                    AGE
googlepubsub-provider   23h

Same thing with kubectl describe

$ kubectl describe providers.notification.toolkit.fluxcd.io googlepubsub-provider 
Name:         googlepubsub-provider
Namespace:    flux-system
Labels:       kustomize.toolkit.fluxcd.io/name=flux-system
              kustomize.toolkit.fluxcd.io/namespace=flux-system
Annotations:  <none>
API Version:  notification.toolkit.fluxcd.io/v1beta3
Kind:         Provider
Metadata:
  Creation Timestamp:  2023-12-20T00:08:38Z
  Generation:          1
  Resource Version:    1410010580
  UID:                 227c1212-4dac-4f06-a137-74aa0b79fcfb
Spec:
  Address:  myprojectid
  Channel:  flux-notification
  Type:     googlepubsub
Events:     <none>

Are these expected behavior?

@darkowlzz
Copy link
Contributor

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 a pull request may close this issue.

3 participants