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

Add ability to exclude endpoints from basic auth #42

Open
JeremyGibson opened this issue Apr 2, 2021 · 0 comments
Open

Add ability to exclude endpoints from basic auth #42

JeremyGibson opened this issue Apr 2, 2021 · 0 comments

Comments

@JeremyGibson
Copy link
Contributor

Tequila provides the ability to configure ngnix to exclude defined paths when basic auth is enabled. We need something like this in django-k8s.

The solution below uses an additional ingress controller to allow in the traffic

AC:

  • add a list var k8s_container_htpasswd_ignore_paths
  • Update web.yaml with code similar to the below example.

The additional ingress controller configured with a list of ignore_paths

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: "ingress-{{ container["name"] }}-htpasswd-ignore-paths"
  namespace: "{{ k8s_namespace }}"
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.org/mergeable-ingress-type: minion
    nginx.ingress.kubernetes.io/backend-protocol: "{{ container["protocol"] }}"
    nginx.ingress.kubernetes.io/auth-type: ""
{% for key, value in container["ingress_annotations"].items() %}
    {{ key }}: "{{ value }}"
{% endfor %}
{% if k8s_container_htpasswd_ignore_paths | length > 0 %}
spec:
  rules:
{% for domain in k8s_domain_names %}
  - host: "{{ domain }}"
    http:
      paths:
{% for ingress_path in k8s_container_htpasswd_ignore_paths %}
      - path: "{{ ingress_path }}"
        backend:
          serviceName: "{{ container["name"] }}"
          servicePort: {{ container["port"] }}
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

No branches or pull requests

1 participant