From a0e0afff1fe0c67536a694c0843d260d7c8b99c0 Mon Sep 17 00:00:00 2001 From: ducoterra Date: Thu, 7 May 2020 12:39:27 -0400 Subject: [PATCH] switch to new ingress --- k8s/prod/ingress.yaml | 77 ++++++++++++++++++++++++------------- k8s/test/ingress.yaml | 49 ++++++++++++++++------- ui/static/ui/smooth.css | 23 +++++++++++ ui/static/ui/smooth.js | 39 +++++++++++++++++++ ui/templates/ui/smooth.html | 31 +++++++++++++++ ui/urls.py | 1 + ui/views.py | 5 ++- 7 files changed, 184 insertions(+), 41 deletions(-) create mode 100644 ui/static/ui/smooth.css create mode 100644 ui/static/ui/smooth.js create mode 100644 ui/templates/ui/smooth.html diff --git a/k8s/prod/ingress.yaml b/k8s/prod/ingress.yaml index 401565a..df2e03a 100644 --- a/k8s/prod/ingress.yaml +++ b/k8s/prod/ingress.yaml @@ -1,46 +1,31 @@ -apiVersion: networking.k8s.io/v1beta1 -kind: Ingress -metadata: - annotations: - ingress.kubernetes.io/ssl-redirect: "true" - name: $DEPLOY -spec: - tls: - - hosts: - - $DEPLOY.ducoterra.net - secretName: letsencrypt - rules: - - host: $DEPLOY.ducoterra.net - http: - paths: - - backend: - serviceName: $DEPLOY - servicePort: 8000 - ---- - apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: $DEPLOY-external-tls + name: $DEPLOY-internal-tls + annotations: + kubernetes.io/ingress.class: traefik-internal spec: entryPoints: - websecure tls: - secretName: letsencrypt + certResolver: myresolver + domains: + - main: "*.ducoterra.net" routes: - match: Host(`$DEPLOY.ducoterra.net`) kind: Rule services: - name: $DEPLOY - port: 8000 + port: 80 --- apiVersion: traefik.containo.us/v1alpha1 kind: IngressRoute metadata: - name: $DEPLOY-external-web + name: $DEPLOY-internal-web + annotations: + kubernetes.io/ingress.class: traefik-internal spec: entryPoints: - web @@ -49,6 +34,46 @@ spec: kind: Rule services: - name: $DEPLOY - port: 8000 + port: 80 + middlewares: + - name: httpsredirect + +--- + +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: $DEPLOY-external-tls + annotations: + kubernetes.io/ingress.class: traefik-external +spec: + entryPoints: + - websecure + tls: + certResolver: myresolver + routes: + - match: Host(`$DEPLOY.ducoterra.net`) + kind: Rule + services: + - name: $DEPLOY + port: 80 + +--- + +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: $DEPLOY-external-web + annotations: + kubernetes.io/ingress.class: traefik-external +spec: + entryPoints: + - web + routes: + - match: Host(`$DEPLOY.ducoterra.net`) + kind: Rule + services: + - name: $DEPLOY + port: 80 middlewares: - name: httpsredirect \ No newline at end of file diff --git a/k8s/test/ingress.yaml b/k8s/test/ingress.yaml index 5b29257..9d411a1 100644 --- a/k8s/test/ingress.yaml +++ b/k8s/test/ingress.yaml @@ -1,18 +1,39 @@ -apiVersion: networking.k8s.io/v1beta1 -kind: Ingress +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute metadata: + name: $DEPLOY-internal-tls annotations: - ingress.kubernetes.io/ssl-redirect: "true" - name: $DEPLOY + kubernetes.io/ingress.class: traefik-internal spec: + entryPoints: + - websecure tls: - - hosts: - - $DEPLOY.ducoterra.net - secretName: letsencrypt - rules: - - host: $DEPLOY.ducoterra.net - http: - paths: - - backend: - serviceName: $DEPLOY - servicePort: 8000 \ No newline at end of file + certResolver: myresolver + domains: + - main: "*.ducoterra.net" + routes: + - match: Host(`$DEPLOY.ducoterra.net`) + kind: Rule + services: + - name: $DEPLOY + port: 80 + +--- + +apiVersion: traefik.containo.us/v1alpha1 +kind: IngressRoute +metadata: + name: $DEPLOY-internal-web + annotations: + kubernetes.io/ingress.class: traefik-internal +spec: + entryPoints: + - web + routes: + - match: Host(`$DEPLOY.ducoterra.net`) + kind: Rule + services: + - name: $DEPLOY + port: 80 + middlewares: + - name: httpsredirect \ No newline at end of file diff --git a/ui/static/ui/smooth.css b/ui/static/ui/smooth.css new file mode 100644 index 0000000..72b1c52 --- /dev/null +++ b/ui/static/ui/smooth.css @@ -0,0 +1,23 @@ +html, body, .section, .container { + height: 100%; +} + +.container { + overflow-y: hidden; +} + +.element::-webkit-scrollbar { width: 0 !important } +.element { overflow: -moz-scrollbars-none; } +.element { -ms-overflow-style: none; } + +.hide-overflow { + overflow: hidden; +} + +.h-100 { + height: 100%; +} + +.w-100 { + width: 100%; +} \ No newline at end of file diff --git a/ui/static/ui/smooth.js b/ui/static/ui/smooth.js new file mode 100644 index 0000000..a4d126b --- /dev/null +++ b/ui/static/ui/smooth.js @@ -0,0 +1,39 @@ +// temp0.scrollIntoView({behavior: "smooth"}); +const scroll0 = document.getElementById("scroll-0"); +const scroll1 = document.getElementById("scroll-1"); +const scroll2 = document.getElementById("scroll-2"); +const scroll3 = document.getElementById("scroll-3"); + +window.addEventListener("scroll", function(event) { + window.addEventListener("mouseup", event => { + console.log("hello"); + }); + event.preventDefault(); + document.querySelector("html").classList.add("hide-overflow"); + if (scroll0.dataset.isScrolling != "true") { + scroll0.dataset.isScrolling = 'true'; + + if (scroll1.dataset.seen != "true") { + scroll1.dataset.seen = "true"; + scroll1.scrollIntoView({behavior: "smooth"}); + } + else if (scroll2.dataset.seen != "true") { + scroll2.dataset.seen = "true"; + scroll2.scrollIntoView({behavior: "smooth"}); + } + else if (scroll3.dataset.seen != "true") { + scroll3.dataset.seen = "true"; + scroll3.scrollIntoView({behavior: "smooth"}); + } + else { + scroll1.dataset.seen = "false"; + scroll2.dataset.seen = "false"; + scroll3.dataset.seen = "false"; + scroll0.scrollIntoView({behavior: "smooth"}); + } + setTimeout(() => { + scroll0.dataset.isScrolling = false; + document.querySelector("html").classList.remove("hide-overflow"); + }, 1000) + } +}); \ No newline at end of file diff --git a/ui/templates/ui/smooth.html b/ui/templates/ui/smooth.html new file mode 100644 index 0000000..70179ed --- /dev/null +++ b/ui/templates/ui/smooth.html @@ -0,0 +1,31 @@ +{% extends 'ui/base.html' %} + +{% load static %} + +{% block css %} + +{% endblock %} + +{% block js %} + +{% endblock %} + +{% block body %} +
+
+

Hello There

+
+ +
+

I'm an Apple Ad

+
+ +
+

See me scroll

+
+ +
+

You owe me $3,000 dollars for this

+
+
+{% endblock %} \ No newline at end of file diff --git a/ui/urls.py b/ui/urls.py index 9002eca..5f8f493 100644 --- a/ui/urls.py +++ b/ui/urls.py @@ -3,4 +3,5 @@ from . import views urlpatterns = [ path('button/', views.button, name = 'button'), + path('smooth/', views.smooth, name = 'smooth'), ] \ No newline at end of file diff --git a/ui/views.py b/ui/views.py index 985ed0b..6e60782 100644 --- a/ui/views.py +++ b/ui/views.py @@ -73,4 +73,7 @@ def button(request): response = {PRESSED: pressed} achieved = {k:v for k,v in achievements.items() if k <= pressed} response.update({ACHIEVE: achieved}) - return render(request, "ui/button.html", response) \ No newline at end of file + return render(request, "ui/button.html", response) + +def smooth(request): + return render(request, "ui/smooth.html") \ No newline at end of file