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

SS 693 ingress does not care if app is public or private #101

Conversation

sandstromviktor
Copy link
Contributor

Description

Bug description:

Creating a public app means that Django makes it public in the UI, but accessing the app without being logged in is blocked by ingress.

Fix

There are probably a better permanent solution, but me and Hamza thought that this will do for now.
This is how the fix works.

  1. Creating or changing app status sets a parameter {"permission": "public"}
  2. The ingress yaml file has an if statement, so if permission is public, then we do not require login.

In order to fix this, i have

  1. Added this if statement to all apps that can be made public (Shiny, dash, custom app etc)
  2. Changed the update-functionality to actually change the app parameters and update the helm installation (thus updating ingress by adding/removing login requirement)

In addition to this, i have removed a bunch of unnecessary v1beta statements in ingress. These are never used.

Checklist

If you're unsure about any of the items below, don't hesitate to ask. We're here to help!
This is simply a reminder of what we are going to look for before merging your code.

  • This pull request is against develop branch (not applicable for hotfixes)
  • I have included a link to the issue on GitHub or JIRA (if any)
  • I have included migration files (if there are changes to the model classes)
  • I have included, reviewed and executed tests (unit and end2end) to complement my changes
  • I have updated the related documentation (if necessary)
  • I have updated the release notes (releasenotes.md)
  • I have added a reviewer for this pull request
  • I have added myself as an author for this pull request
  • In the case I have modified settings.py, then I have also updated the studio-settings-configmap.yaml file in serve-charts

@sandstromviktor sandstromviktor added the bug Something isn't working label Nov 16, 2023
@sandstromviktor sandstromviktor requested a review from a team November 16, 2023 08:41
@sandstromviktor sandstromviktor self-assigned this Nov 16, 2023
Comment on lines -214 to -218
try:
print("Ingress v1beta1: {}".format(settings.INGRESS_V1BETA1))
parameters["ingress"]["v1beta1"] = settings.INGRESS_V1BETA1
except: # noqa E722 TODO: Add exception
pass
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fails always, so i've removed it.

@@ -203,19 +203,14 @@ def deploy_resource(instance_pk, action="create"):
app_instance = AppInstance.objects.select_for_update().get(pk=instance_pk)
status = AppStatus(appinstance=app_instance)

if action == "create":
if (action == "create") or (action == "update"):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding update action that actually updates the app parameters. This was not done before some some odd reason.

Comment on lines +9 to +12
{{ if ne .Values.permission "public" }}
nginx.ingress.kubernetes.io/auth-url: "{{ .Values.global.protocol }}://{{ .Values.global.auth_domain }}:8080/auth/?release={{ .Values.release }}"
nginx.ingress.kubernetes.io/auth-signin: "https://{{ .Values.global.domain }}/accounts/login/?next=$scheme%3A%2F%2F$host"
#nginx.ingress.kubernetes.io/auth-response-headers: X-Forwarded-Host
{{- end }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is added to ingress files for dash, shiny, custom app etc.

Copy link
Contributor

@churnikov churnikov left a comment

Choose a reason for hiding this comment

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

I feel like I'm not the one to approve, but I did something similar for making mlflow public. So I feel like it's okay.

I hope you've tried accessing apps via incognito with this

@sandstromviktor
Copy link
Contributor Author

I feel like I'm not the one to approve, but I did something similar for making mlflow public. So I feel like it's okay.

I hope you've tried accessing apps via incognito with this

Yes i've tried that, using multiple browsers and even curl

@sandstromviktor sandstromviktor merged commit ee73507 into develop Nov 16, 2023
2 checks passed
@sandstromviktor sandstromviktor deleted the SS-693-ingress-does-not-care-if-app-is-public-or-private branch November 16, 2023 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants