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 preview portfolio #592

Merged
merged 9 commits into from
Oct 18, 2024
Merged

Add preview portfolio #592

merged 9 commits into from
Oct 18, 2024

Conversation

Pugma
Copy link
Contributor

@Pugma Pugma commented Oct 17, 2024

staging 用の ghcr イメージタグが変更予定なのでその変更が済んだことを確認した状態で反映し、その後に draft を外します

tpf 側の対応が完了したので draft を外しました!
ご確認をお願いします

Copy link

github-actions bot commented Oct 17, 2024

Diff

@@ (file level) @@
! - one document removed:
- ---
- apiVersion: v1
- data:
-   static-file-provider.yaml: |
-     http:
-       middlewares:
-         compress:
-           compress:
-             # Use includedContentTypes once https://github.com/traefik/traefik/issues/9229 is resolved?
-             # Referred from https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
-             excludedContentTypes:
-               - audio/aac
-               - audio/mpeg
-               - audio/ogg
-               - audio/opus
-               - audio/wav
-               - audio/wave
-               - audio/webm
-               - audio/x-pn-wav
-               - audio/x-wav
-               - image/avif
-               - image/bmp
-               - image/gif
-               - image/jpeg
-               - image/png
-               - image/vnd.microsoft.icon
-               - image/webp
-               - font/woff
-               - font/woff2
-               - video/mpeg
-               - video/mp4
-               - video/ogg
-               - video/webm
-               - video/x-msvideo
-               - application/gzip
-               - application/octet-stream
-               - application/ogg
-               - application/pdf
-               - application/x-bzip
-               - application/x-bzip2
-               - application/x-7z-compressed
-               - application/zip
-     
-         # errors-404 middleware is referenced on catch-all routes at ../catch-all directory.
-         # Page display mechanism in detail:
-         # 1. Normal request goes to "custom-errors" service by catch-all route, because it does not have any matching
-         #    IngressRoutes configured other than the catch-all
-         # 2. "custom-errors" service returns 404 status
-         # 3. traefik "errors-404" middleware requests "custom-errors" service with "/404" path
-         # 4. Error page is returned
-         errors-404:
-           errors:
-             status:
-               - "404"
-             query: "/{status}"
-             service: custom-errors
-         # errors-5xx middleware is referenced on all routes at ./traefik.yaml.
-         # This middleware works when traefik (or upstream service) returns 502 or 503.
-         # - 502: an error happens while contacting upstream service (usually a misconfiguration)
-         # - 503: no upstream servers are configured at the moment (misconfiguration, or a short deployment downtime)
-         # https://doc.traefik.io/traefik/getting-started/faq/#502-bad-gateway
-         errors-5xx:
-           errors:
-             status:
-               - "502"
-               - "503"
-             query: "/{status}"
-             service: custom-errors
-     
-       services:
-         custom-errors:
-           loadBalancer:
-             servers:
-               - url: http://custom-errors.traefik.svc.cluster.local
-     
-         traq-prod:
-           loadBalancer:
-             passHostHeader: false
-             servers:
-               - url: https://q.trap.jp
-         traq-dev:
-           loadBalancer:
-             passHostHeader: false
-             servers:
-               - url: https://q-dev.trapti.tech
-     
-   traefik.yaml: |
-     api:
-       dashboard: true
-     
-     experimental:
-       plugins:
-         sablier:
-           moduleName: "github.com/acouvreur/sablier"
-           # renovate:general datasource=github-releases depName=acouvreur/sablier
-           version: "v1.8.0"
-     
-     ping:
-       entryPoint: traefik
-     
-     metrics:
-       prometheus:
-         entryPoint: metrics
-     
-     providers:
-       kubernetesCRD:
-         allowCrossNamespace: true
-         allowEmptyServices: true
-       kubernetesIngress: {}
-       file:
-         filename: /traefik-core-config/static-file-provider.yaml
-         # Also to avoid 'too many open files' error
-         watch: false
-     
-     entryPoints:
-       web:
-         address: :80/tcp
-         http:
-           # NOTE: cannot reference dynamic provider configurations (e.g. kubernetes crd provider) in static configuration
-           middlewares:
-             - compress@file
-             - errors-5xx@file
-         # NOTE: Setting HTTP request body read timeout from default of 60s to 300s,
-         # since our bandwidth on ConoHa is slow (100Mbps).
-         # This could affect long-lasting uploads like docker registry uploads.
-         # https://doc.traefik.io/traefik/migration/v2/#v2112
-         transport:
-           respondingTimeouts:
-             readTimeout: "300s"
-       websecure:
-         address: :443/tcp
-         http:
-           # NOTE: cannot reference dynamic provider configurations (e.g. kubernetes crd provider) in static configuration
-           middlewares:
-             - compress@file
-             - errors-5xx@file
-         http3: {}
-         # NOTE: Setting HTTP request body read timeout from default of 60s to 300s,
-         # since our bandwidth on ConoHa is slow (100Mbps).
-         # This could affect long-lasting uploads like docker registry uploads.
-         # https://doc.traefik.io/traefik/migration/v2/#v2112
-         transport:
-           respondingTimeouts:
-             readTimeout: "300s"
-       traefik:
-         address: :8080/tcp
-       metrics:
-         address: :9100/tcp
-     
- kind: ConfigMap
- metadata:
-   name: config-t4mc658b5m
-   namespace: traefik
!   ---
+   apiVersion: v1
+   kind: Service
+   metadata:
+     name: portfolio-ui-staging
+     namespace: preview-portfolio-ui
+   spec:
+     type: ClusterIP
+     selector:
+       app: portfolio-ui-staging
+     ports:
+     - name: http
+       port: 80
+       targetPort: http
+   apiVersion: apps/v1
+   kind: Deployment
+   metadata:
+     labels:
+       sablier.enable: "true"
+       sablier.group: preview-portfolio-ui-staging
+     name: portfolio-ui-staging
+     namespace: preview-portfolio-ui
+   spec:
+     revisionHistoryLimit: 0
+     selector:
+       matchLabels:
+         app: portfolio-ui-staging
+     template:
+       metadata:
+         labels:
+           app: portfolio-ui-staging
+       spec:
+         containers:
+         - image: "ghcr.io/traptitech/traportfolio-ui:main@sha256:2d1b1bb55964a5a222ace2dea6c62f509dce361d8a0a6b470058939c3188e094"
+           imagePullPolicy: Always
+           name: portfolio-ui
+           ports:
+           - containerPort: 80
+             name: http
+         enableServiceLinks: false
+   apiVersion: argoproj.io/v1alpha1
+   kind: ApplicationSet
+   metadata:
+     name: preview-portfolio
+     namespace: argocd
+   spec:
+     generators:
+     - pullRequest:
+         github:
+           owner: traPtitech
+           repo: traPortfolio-UI
+           tokenRef:
+             key: token
+             secretName: preview-pr-generator
+         requeueAfterSeconds: 1800
+     template:
+       metadata:
+         annotations:
+           notifications.argoproj.io/subscribe.on-preview-deployed.portfolio-preview: 
+           prNumber: {{number}}
+           prPreviewHeadSha: {{head_sha}}
+         labels:
+           pr-preview: "true"
+           pr-preview-type: portfolio
+           skip-default-notification: "true"
+         name: preview-portfolio-ui-{{number}}
+       spec:
+         destination:
+           namespace: preview-portfolio
+           server: "https://kubernetes.default.svc"
+         ignoreDifferences:
+         - group: apps
+           jsonPointers:
+           - /spec/replicas
+           kind: Deployment
+         project: preview
+         source:
+           helm:
+             parameters:
+             - name: number
+               value: {{number}}
+             - name: headSha
+               value: {{head_sha}}
+           path: preview-portfolio/ui/template
+           repoURL: "https://github.com/traPtitech/manifest"
+           targetRevision: main
+         syncPolicy:
+           automated:
+             prune: true
+             selfHeal: true
+   apiVersion: cert-manager.io/v1
+   kind: Certificate
+   metadata:
+     name: preview-portfolio
+     namespace: preview-portfolio-ui
+   spec:
+     dnsNames:
+     - "*.portfolio-preview.trapti.tech"
+     duration: 2160h0m0s
+     issuerRef:
+       kind: ClusterIssuer
+       name: cluster-issuer
+     renewBefore: 720h0m0s
+     secretName: preview-portfolio-ui-tls
+   apiVersion: traefik.io/v1alpha1
+   kind: IngressRoute
+   metadata:
+     name: portfolio-ui-preview-staging
+     namespace: preview-portfolio-ui
+   spec:
+     entryPoints:
+     - websecure
+     routes:
+     - kind: Rule
+       match: Host(`staging-prod.portfolio-preview.trapti.tech`)
+       middlewares:
+       - name: sablier-staging
+         namespace: preview-portfolio-ui
+       priority: -100
+       services:
+       - kind: Service
+         name: portfolio-ui-staging
+         namespace: preview-portfolio-ui
+         port: http
+         scheme: http
+         strategy: RoundRobin
+         weight: 1
+     - kind: Rule
+       match: "Host(`staging-dev.portfolio-preview.trapti.tech`) && PathPrefix(`/api`)"
+       middlewares:
+       - name: sablier-staging
+         namespace: preview-portfolio-ui
+       priority: -99
+       services:
+       - kind: TraefikService
+         name: portfolio-ui-prod@file
+     - kind: Rule
+       match: Host(`staging-dev.portfolio-preview.trapti.tech`)
+       middlewares:
+       - name: sablier-staging
+         namespace: preview-portfolio-ui
+       priority: -100
+       services:
+       - kind: Service
+         name: portfolio-ui-staging
+         namespace: preview-portfolio-ui
+         port: http
+         scheme: http
+         strategy: RoundRobin
+         weight: 1
+     - kind: Rule
+       match: "Host(`staging-dev.portfolio-preview.trapti.tech`) && PathPrefix(`/api`)"
+       middlewares:
+       - name: sablier-staging
+         namespace: preview-portfolio-ui
+       priority: -99
+       services:
+       - kind: TraefikService
+         name: portfolio-ui-dev@file
+     tls:
+       secretName: preview-portfolio-ui-tls
+   apiVersion: traefik.io/v1alpha1
+   kind: Middleware
+   metadata:
+     name: sablier-staging
+     namespace: preview-portfolio-ui
+   spec:
+     plugin:
+       sablier:
+         dynamic:
+           displayName: "traPortfolio Staging"
+           refreshFrequency: 5s
+           showDetails: "true"
+           theme: ghost
+         group: preview-portfolio-ui-staging
+         sablierUrl: "http://sablier.sablier.svc.cluster.local"
+         sessionDuration: 1m
+   apiVersion: v1
+   data:
+     static-file-provider.yaml: |
+       http:
+         middlewares:
+           compress:
+             compress:
+               # Use includedContentTypes once https://github.com/traefik/traefik/issues/9229 is resolved?
+               # Referred from https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
+               excludedContentTypes:
+                 - audio/aac
+                 - audio/mpeg
+                 - audio/ogg
+                 - audio/opus
+                 - audio/wav
+                 - audio/wave
+                 - audio/webm
+                 - audio/x-pn-wav
+                 - audio/x-wav
+                 - image/avif
+                 - image/bmp
+                 - image/gif
+                 - image/jpeg
+                 - image/png
+                 - image/vnd.microsoft.icon
+                 - image/webp
+                 - font/woff
+                 - font/woff2
+                 - video/mpeg
+                 - video/mp4
+                 - video/ogg
+                 - video/webm
+                 - video/x-msvideo
+                 - application/gzip
+                 - application/octet-stream
+                 - application/ogg
+                 - application/pdf
+                 - application/x-bzip
+                 - application/x-bzip2
+                 - application/x-7z-compressed
+                 - application/zip
+       
+           # errors-404 middleware is referenced on catch-all routes at ../catch-all directory.
+           # Page display mechanism in detail:
+           # 1. Normal request goes to "custom-errors" service by catch-all route, because it does not have any matching
+           #    IngressRoutes configured other than the catch-all
+           # 2. "custom-errors" service returns 404 status
+           # 3. traefik "errors-404" middleware requests "custom-errors" service with "/404" path
+           # 4. Error page is returned
+           errors-404:
+             errors:
+               status:
+                 - "404"
+               query: "/{status}"
+               service: custom-errors
+           # errors-5xx middleware is referenced on all routes at ./traefik.yaml.
+           # This middleware works when traefik (or upstream service) returns 502 or 503.
+           # - 502: an error happens while contacting upstream service (usually a misconfiguration)
+           # - 503: no upstream servers are configured at the moment (misconfiguration, or a short deployment downtime)
+           # https://doc.traefik.io/traefik/getting-started/faq/#502-bad-gateway
+           errors-5xx:
+             errors:
+               status:
+                 - "502"
+                 - "503"
+               query: "/{status}"
+               service: custom-errors
+       
+         services:
+           custom-errors:
+             loadBalancer:
+               servers:
+                 - url: http://custom-errors.traefik.svc.cluster.local
+       
+           traq-prod:
+             loadBalancer:
+               passHostHeader: false
+               servers:
+                 - url: https://q.trap.jp
+           traq-dev:
+             loadBalancer:
+               passHostHeader: false
+               servers:
+                 - url: https://q-dev.trapti.tech
+       
+           portfolio-ui-prod:
+             loadBalancer:
+               passHostHeader: false
+               servers:
+                 - url: https://portfolio.trap.jp
+           portfolio-ui-dev:
+             loadBalancer:
+               passHostHeader: false
+               servers:
+                 - url: https://portfolio-dev.trapti.tech
+       
+     traefik.yaml: |
+       api:
+         dashboard: true
+       
+       experimental:
+         plugins:
+           sablier:
+             moduleName: "github.com/acouvreur/sablier"
+             # renovate:general datasource=github-releases depName=acouvreur/sablier
+             version: "v1.8.0"
+       
+       ping:
+         entryPoint: traefik
+       
+       metrics:
+         prometheus:
+           entryPoint: metrics
+       
+       providers:
+         kubernetesCRD:
+           allowCrossNamespace: true
+           allowEmptyServices: true
+         kubernetesIngress: {}
+         file:
+           filename: /traefik-core-config/static-file-provider.yaml
+           # Also to avoid 'too many open files' error
+           watch: false
+       
+       entryPoints:
+         web:
+           address: :80/tcp
+           http:
+             # NOTE: cannot reference dynamic provider configurations (e.g. kubernetes crd provider) in static configuration
+             middlewares:
+               - compress@file
+               - errors-5xx@file
+           # NOTE: Setting HTTP request body read timeout from default of 60s to 300s,
+           # since our bandwidth on ConoHa is slow (100Mbps).
+           # This could affect long-lasting uploads like docker registry uploads.
+           # https://doc.traefik.io/traefik/migration/v2/#v2112
+           transport:
+             respondingTimeouts:
+               readTimeout: "300s"
+         websecure:
+           address: :443/tcp
+           http:
+             # NOTE: cannot reference dynamic provider configurations (e.g. kubernetes crd provider) in static configuration
+             middlewares:
+               - compress@file
+               - errors-5xx@file
+           http3: {}
+           # NOTE: Setting HTTP request body read timeout from default of 60s to 300s,
+           # since our bandwidth on ConoHa is slow (100Mbps).
+           # This could affect long-lasting uploads like docker registry uploads.
+           # https://doc.traefik.io/traefik/migration/v2/#v2112
+           transport:
+             respondingTimeouts:
+               readTimeout: "300s"
+         traefik:
+           address: :8080/tcp
+         metrics:
+           address: :9100/tcp
+       
+   kind: ConfigMap
+   metadata:
+     name: config-74t2ttf5b2
+     namespace: traefik

@@ spec.template.spec.volumes.config.configMap.name @@
# apps/v1/DaemonSet/traefik/traefik
! ± value change
- config-t4mc658b5m
+ config-74t2ttf5b2

@Pugma Pugma marked this pull request as ready for review October 18, 2024 07:36
@Pugma Pugma requested a review from motoki317 October 18, 2024 07:36
Comment on lines +32 to +34
services:
- kind: TraefikService
name: portfolio-ui-prod@file
Copy link
Member

Choose a reason for hiding this comment

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

このService定義がないと思います
file providerから定義してください
https://traefik.ns.trap.jp/

priority: -99
middlewares:
- name: sablier-staging
namespace: preview--portfolio-ui
Copy link
Member

Choose a reason for hiding this comment

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

typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

typo でした
見つけてくださってありがとうございます

@Pugma Pugma requested a review from motoki317 October 18, 2024 07:57
Copy link
Member

@motoki317 motoki317 left a comment

Choose a reason for hiding this comment

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

あとはやってみて動かなかったら修正してみてください(開発環境に関することで、細かい修正ならいちいちレビューは挟まなくても良いです)

@Pugma
Copy link
Contributor Author

Pugma commented Oct 18, 2024

ありがとうございます
:haakusimasita:

@Pugma Pugma merged commit 19660a5 into main Oct 18, 2024
4 checks passed
@Pugma Pugma deleted the addPreviewPortfolio branch October 18, 2024 08:05
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