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

essais de fix horizontal pod scaller #23

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 25 additions & 30 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Pipeline Prod

on:
pull_request:
branches:
on: # Triggers the workflow
pull_request: # This workflow will run only for pull requests
branches: # This workflow will run only for the main branch
- main

permissions:
Expand All @@ -17,35 +17,35 @@ jobs:
##### Check de l'image Front ######
###################################
check-front-image:
runs-on: ubuntu-latest
runs-on: ubuntu-latest # OS
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Checkout # Checkout the repository
uses: actions/checkout@v3 # Checkout the repository

- name: Extract Docker Front metadata
id: meta
uses: docker/metadata-action@v4.4.0
- name: Login to Docker Hub # Login to Docker Hub
uses: docker/login-action@v2 # Docker login action
with:
images: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ vars.DOCKER_FRONT }}
username: ${{ secrets.DOCKER_HUB_USERNAME }} # Docker Hub username
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} # Docker Hub access token

- name: Extract Docker Front metadata # Extract Docker Front metadata
id: meta # Step ID
uses: docker/metadata-action@v4.4.0 # Docker metadata action
with:
images: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ vars.DOCKER_FRONT }} # Docker Front image
labels: |
org.opencontainers.image.revision=${{ env.SHA }}
org.opencontainers.image.revision=${{ env.SHA }}
tags: |
type=edge,branch=$repo.default_branch
type=edge,branch=$repo.default_branch
type=semver,pattern=v{{version}}
type=sha,prefix=,suffix=,format=short

- name: Check Front image
uses: docker/scout-action@v0.18.1
with:
command: cves
image: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ vars.DOCKER_FRONT }}:${{ vars.DOCKER_FRONT_VERSION }}
exit-code: true
- name: Check Front image # Check Front image
uses: docker/scout-action@v0.18.1 # Docker scout action
with:
command: cves # Command to run on the image
image: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ vars.DOCKER_FRONT }}:${{ vars.DOCKER_FRONT_VERSION }} # Docker Front image version to check
exit-code: true # Exit code

##### Check de l'image Back ######
###################################
Expand Down Expand Up @@ -215,9 +215,7 @@ jobs:
run: |
gcloud auth configure-docker europe-west1-docker.pkg.dev
kubectl apply -f ./client/prod-front.yml
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT }}
BUCKET: ${{ vars.CLOUDBUILD_BUCKET }}


##### Deploy back to GKE ######
###############################
Expand Down Expand Up @@ -253,6 +251,3 @@ jobs:
run: |
gcloud auth configure-docker europe-west1-docker.pkg.dev
kubectl apply -f ./server/prod-back.yml
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT }}
BUCKET: ${{ vars.CLOUDBUILD_BUCKET }}
7 changes: 7 additions & 0 deletions client/prod-front.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ spec:
ports:
- containerPort: 80
- containerPort: 7000
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "200m"
memory: "256Mi"
---
apiVersion: "autoscaling/v2"
kind: "HorizontalPodAutoscaler"
Expand Down
175 changes: 0 additions & 175 deletions logging/fleet.yml

This file was deleted.

53 changes: 30 additions & 23 deletions server/prod-back.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: khagu-dev-back
namespace: default
labels:
app: khagu-dev
spec:
replicas: 1
selector:
matchLabels:
app: khagu-dev-back
template:
metadata:
labels:
app: khagu-dev-back
spec:
containers:
- name: khagu-dev-back
image: "europe-west1-docker.pkg.dev/khagu-devops/khagu-dev-images-registry/khagu-dev-back:1.0.9.8" # Remplacer par votre repo
ports:
- containerPort: 7000
apiVersion: apps/v1 # Version de l'API
kind: Deployment # Type de ressource
metadata: # Métadonnées
name: khagu-dev-back # Nom de la ressource
namespace: default # Espace de nom
labels: # Labels
app: khagu-dev # Nom de l'application
spec: # Spécification
replicas: 1 # Nombre de réplicas
selector: # Sélecteur
matchLabels: # Labels de correspondance
app: khagu-dev-back # Nom de l'application du pod
template: # Modèle de déploiement des pods
metadata: # Métadonnées du modèle
labels: # Labels de correspondance
app: khagu-dev-back # Nom de l'application du pod
spec: # Spécification du pod
containers: # Conteneurs du pod
- name: khagu-dev-back # Nom du conteneu
image: "europe-west1-docker.pkg.dev/khagu-devops/khagu-dev-images-registry/khagu-dev-back:1.0.9.8" # Image du conteneur
ports: # Ports du conteneur
- containerPort: 7000 # Port du conteneur
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "200m"
memory: "256Mi"
---
apiVersion: "autoscaling/v2"
kind: "HorizontalPodAutoscaler"
metadata:
name: "khagu-dev-front-hpa"
name: "khagu-dev-back-hpa"
namespace: default
labels:
app: "khagu-dev-back"
Expand Down
Loading