EUGENIO SOUZA CARVALHO 4 years ago
parent
commit
d43b841db5
2 changed files with 65 additions and 72 deletions
  1. 0 70
      traefik/020-deployment.yaml
  2. 65 2
      traefik/030-ingress.yaml

+ 0 - 70
traefik/020-deployment.yaml

@@ -199,73 +199,3 @@ spec:
   type: LoadBalancer
 status:
   loadBalancer: {}
-
-#########################################################
-# The Middleware configuration contains middleware componenst
-# for a HTTP->HTTS redirection and a BasicAuth example.
-#########################################################
-
-###############################
-# Middleware for basicAuth
-###############################
----
-apiVersion: traefik.containo.us/v1alpha1
-kind: Middleware
-metadata:
-  name: basic-auth
-spec:
-  basicAuth:
-    secret: authsecret
-
----
-apiVersion: v1
-kind: Secret
-metadata:
-  name: authsecret
-  namespace: default
-
-#------------ Paste your own password file content here (default user/password=admin/adminadmin)--------------
-data:
-  users: |2
-    ZXVnZW5pdWNhcnZhbGhvOiRhcHIxJFlmT1Y5YlE4JGJNOHRvOTcxQ1NMYkxmRS9T
-    V1BzNTEKCg==
-
-###############################
-# Middleware for HTTP->HTTPS
-# This middleware is not needed in case of:
-#      entrypoints.web.http.redirections.entryPoint.to=websecure
-###############################
-#---
-#apiVersion: traefik.containo.us/v1alpha1
-#kind: Middleware
-#metadata:
-#  name: https-redirect
-#spec:
-#  redirectScheme:
-#    scheme: https
-#    permanent: true
-#    #port: 443
-
-###############################
-# Middleware for CORS
-###############################
----
-apiVersion: traefik.containo.us/v1alpha1
-kind: Middleware
-metadata:
-  name: cors-all
-spec:
-  headers:
-    accessControlAllowMethods:
-      - "GET"
-      - "OPTIONS"
-      - "PUT"
-      - "POST"
-    accessControlAllowOriginList:
-      - "origin-list-or-null"
-    accessControlMaxAge: 100
-    accessControlAllowHeaders:
-      - "Content-Type"
-    addVaryHeader: true
-    customRequestHeaders:
-      X-Forwarded-Proto: "https"

+ 65 - 2
traefik/030-ingress.yaml

@@ -13,7 +13,70 @@ spec:
       services:
         - name: api@internal
           kind: TraefikService
+      middlewares:
+        - name: basic-auth
   tls:
     secretName: monteasua-com-br-tls
-    middlewares:
-    - name: basic-auth
+
+###############################
+# Middleware for basicAuth
+###############################
+---
+apiVersion: traefik.containo.us/v1alpha1
+kind: Middleware
+metadata:
+  name: basic-auth
+spec:
+  basicAuth:
+    secret: authsecret
+
+---
+apiVersion: v1
+kind: Secret
+metadata:
+  name: authsecret
+  namespace: default
+data:
+  users: |2
+    ZXVnZW5pdWNhcnZhbGhvOiRhcHIxJFlmT1Y5YlE4JGJNOHRvOTcxQ1NMYkxmRS9T
+    V1BzNTEKCg==
+
+
+###############################
+# Middleware for HTTP->HTTPS
+# This middleware is not needed in case of:
+#      entrypoints.web.http.redirections.entryPoint.to=websecure
+###############################
+---
+apiVersion: traefik.containo.us/v1alpha1
+kind: Middleware
+metadata:
+  name: https-redirect
+spec:
+  redirectScheme:
+    scheme: https
+    permanent: true
+    #port: 443
+###############################
+# Middleware for CORS
+###############################
+---
+apiVersion: traefik.containo.us/v1alpha1
+kind: Middleware
+metadata:
+  name: cors-all
+spec:
+  headers:
+    accessControlAllowMethods:
+      - "GET"
+      - "OPTIONS"
+      - "PUT"
+      - "POST"
+    accessControlAllowOriginList:
+      - "origin-list-or-null"
+    accessControlMaxAge: 100
+    accessControlAllowHeaders:
+      - "Content-Type"
+    addVaryHeader: true
+    customRequestHeaders:
+      X-Forwarded-Proto: "https"