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

Feature/dynamic upstream config for non resolveable hosts #103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hishamanver
Copy link
Contributor

@hishamanver hishamanver commented Jul 29, 2021

This PR defines a new env var 'UPSTREAM_MAPPINGS' which is used to dynamically populate the nginx config with upstream -> server definitions.

This allows hosts that are not resolveable via resolvers to be reached. SImilar to how an /etc/hosts entry works, however this includes the benefits of round-robin

  • trailing whitespaces also removed from readme (in addition to additional documentation for the new var)

@hishamanver hishamanver force-pushed the feature/dynamic-upstream-config-for-non-resolveable-hosts branch 3 times, most recently from f94acb2 to 0195edd Compare July 30, 2021 06:09
@hishamanver hishamanver force-pushed the feature/dynamic-upstream-config-for-non-resolveable-hosts branch from 0195edd to 31c7ea7 Compare July 30, 2021 06:14
@rpardini
Copy link
Owner

Interesting, apart from all the whitespace changes in the README.
Could you explain a bit what is your use case for this?

@hishamanver
Copy link
Contributor Author

Apologies for the whitespace stuff - I have 'trim trailing whitespace' enabled on my visual studio code

So the use case is this - we have a kubernetes cluster in a privately hosted cloud environment and we have the registry proxy deployed in the cluster as an image repository.

The upstream that we use is a private instance of harbor.

The DNS used by the k8s cluster does not have an entry for harbor (and it is not something we can configure without losing vendor support).

For connectivity to the instance of harbor, we have static routes enabling our k8s workers to reach the instance. and by adding an entry to our hosts file we can reach the instance via fqdn.

So in order to complete the solution for our use case, the proxy has to be able to reach the harbor similar to how a hosts file resolution takes place

@rpardini
Copy link
Owner

rpardini commented Aug 3, 2021

Thanks for the explanation. It is indeed a very specific use case. How do you handle TLS validation in this case?

@hishamanver
Copy link
Contributor Author

So the upstream (harbor) has a certificate that is trusted by our k8s workers <- harbor currently is using Let's Encrypt

But yes, we would have to have trusted certs on the workers in order for this to work, else we would have to use the toggle ssl verification using the provided ENV var in this project

@rpardini
Copy link
Owner

rpardini commented Aug 4, 2021

Sorry, I meant MITM/TLS between Docker/containerd and d-r-p.
Just wondering how you can have powers to inject a root CA but not to edit nameservers...

@hishamanver
Copy link
Contributor Author

I see what you mean. So the platform does not prohibit us from actually changing the nameservers in the code dns config. It's more a case of what the vendor will support with regards to tweaks we make on the cluster. Given that the coredns application directly impacts traffic facilitating services, tweaking this config is not supported.

Also just as an fyi we add the ca for docker by adding it to /etc/docker/certs.d on the k8s workers <- prevents the need for docker restarts (after the first instantiation, which is needed to update the docker proxy file)

@rpardini
Copy link
Owner

rpardini commented Aug 4, 2021

Ahn. So you're running d-r-p as a Pod in a k8s cluster whose nodes' Docker point to it?

@hishamanver
Copy link
Contributor Author

hishamanver commented Aug 5, 2021

exactly right :)

…ry-proxy into feature/dynamic-upstream-config-for-non-resolveable-hosts
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 this pull request may close these issues.

2 participants