Skip to content
This repository was archived by the owner on Dec 16, 2021. It is now read-only.

Invoking k8s service with proper k8s domain#23

Open
mgolovatiy-atconsulting-ru wants to merge 1 commit into
vmware-archive:masterfrom
mgolovatiy-atconsulting-ru:master
Open

Invoking k8s service with proper k8s domain#23
mgolovatiy-atconsulting-ru wants to merge 1 commit into
vmware-archive:masterfrom
mgolovatiy-atconsulting-ru:master

Conversation

@mgolovatiy-atconsulting-ru

Copy link
Copy Markdown

Issue Ref: #22

Description:

Invoking k8s service with proper k8s domain (in case kubelet runs with --cluster-domain option)

TODOs:

  • CR !
  • Tests
  • add function to Kubeless utils

@andresmgot andresmgot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for starting this PR :)

It seems that your code is failing because there is an extra dot:

pod/kafka-trigger-controller-74f96c6c8f-kxg62: time="2020-02-25T17:44:02Z" level=error msg="Failed to send message to function: Post http://pubsub-python.default.svc..cluster.local:8080: dial tcp: lookup pubsub-python.default.svc..cluster.local: no such host"

Comment thread pkg/utils/k8sutil.go

clusterDomain := "cluster.local"

cname, err := net.LookupCNAME(apiSvc)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

An issue with this solution is that this function is called every time there is a new message. This could lead to a bottleneck. You will need to move the call to getClusterDomain outside. I would put it in the init() method of kafka-consumer.go and store it as a package variable (for example) so you don't need to re-request it.

@grantallonanytable grantallonanytable force-pushed the master branch 6 times, most recently from faa78b4 to 7b7637e Compare February 26, 2020 13:04
@mgolovatiy-atconsulting-ru

Copy link
Copy Markdown
Author

What wrong with code format?

@andresmgot

Copy link
Copy Markdown
Contributor

You can try executing:

gofmt -s -w pkg/event-consumers/kafka/kafka-consumer.go
gofmt -s -w pkg/utils/event_sender_test.go

and commit the result

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants