From c8ad88b31b550696c5bc9b2e80755859910338aa Mon Sep 17 00:00:00 2001 From: dvirlabs <114520947+dvirlabs@users.noreply.github.com> Date: Tue, 23 Dec 2025 21:04:21 +0200 Subject: [PATCH] ipify --- argocd-apps/ipify.yaml | 21 ++++++ charts/ipify-chart/Chart.yaml | 6 ++ charts/ipify-chart/templates/_helpers.tpl | 20 ++++++ .../templates/backend-deployment.yaml | 41 +++++++++++ .../templates/backend-service.yaml | 17 +++++ .../templates/frontend-deployment.yaml | 41 +++++++++++ .../templates/frontend-service.yaml | 17 +++++ charts/ipify-chart/templates/ingress.yaml | 43 +++++++++++ charts/ipify-chart/values.yaml | 61 ++++++++++++++++ manifests/ipify/cname.yaml | 2 + manifests/ipify/values.yaml | 72 +++++++++++++++++++ 11 files changed, 341 insertions(+) create mode 100644 argocd-apps/ipify.yaml create mode 100644 charts/ipify-chart/Chart.yaml create mode 100644 charts/ipify-chart/templates/_helpers.tpl create mode 100644 charts/ipify-chart/templates/backend-deployment.yaml create mode 100644 charts/ipify-chart/templates/backend-service.yaml create mode 100644 charts/ipify-chart/templates/frontend-deployment.yaml create mode 100644 charts/ipify-chart/templates/frontend-service.yaml create mode 100644 charts/ipify-chart/templates/ingress.yaml create mode 100644 charts/ipify-chart/values.yaml create mode 100644 manifests/ipify/cname.yaml create mode 100644 manifests/ipify/values.yaml diff --git a/argocd-apps/ipify.yaml b/argocd-apps/ipify.yaml new file mode 100644 index 0000000..c6e3a04 --- /dev/null +++ b/argocd-apps/ipify.yaml @@ -0,0 +1,21 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: ipify + namespace: argocd +spec: + project: my-apps + source: + repoURL: https://git.dvirlabs.com/dvirlabs/my-apps.git + targetRevision: HEAD + path: charts/ipify-chart + helm: + valueFiles: + - ../../manifests/ipify/values.yaml + destination: + server: https://kubernetes.default.svc + namespace: my-apps + syncPolicy: + automated: + prune: true + selfHeal: true diff --git a/charts/ipify-chart/Chart.yaml b/charts/ipify-chart/Chart.yaml new file mode 100644 index 0000000..81baaf1 --- /dev/null +++ b/charts/ipify-chart/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: ipify +description: A Helm chart for IP Subnet Calculator application +type: application +version: 1.0.0 +appVersion: "1.0.0" diff --git a/charts/ipify-chart/templates/_helpers.tpl b/charts/ipify-chart/templates/_helpers.tpl new file mode 100644 index 0000000..f7beb33 --- /dev/null +++ b/charts/ipify-chart/templates/_helpers.tpl @@ -0,0 +1,20 @@ +{{- define "ipify.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{- define "ipify.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{- define "ipify.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} diff --git a/charts/ipify-chart/templates/backend-deployment.yaml b/charts/ipify-chart/templates/backend-deployment.yaml new file mode 100644 index 0000000..76b3b03 --- /dev/null +++ b/charts/ipify-chart/templates/backend-deployment.yaml @@ -0,0 +1,41 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.backend.name }} + labels: + app: {{ .Values.backend.name }} + component: backend +spec: + replicas: {{ .Values.backend.replicaCount }} + selector: + matchLabels: + app: {{ .Values.backend.name }} + component: backend + template: + metadata: + labels: + app: {{ .Values.backend.name }} + component: backend + spec: + containers: + - name: backend + image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }}" + imagePullPolicy: {{ .Values.backend.image.pullPolicy }} + ports: + - containerPort: {{ .Values.backend.service.targetPort }} + name: http + protocol: TCP + resources: + {{- toYaml .Values.backend.resources | nindent 10 }} + livenessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 30 + periodSeconds: 10 + readinessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 10 + periodSeconds: 5 diff --git a/charts/ipify-chart/templates/backend-service.yaml b/charts/ipify-chart/templates/backend-service.yaml new file mode 100644 index 0000000..f29d72f --- /dev/null +++ b/charts/ipify-chart/templates/backend-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.backend.name }} + labels: + app: {{ .Values.backend.name }} + component: backend +spec: + type: {{ .Values.backend.service.type }} + ports: + - port: {{ .Values.backend.service.port }} + targetPort: {{ .Values.backend.service.targetPort }} + protocol: TCP + name: http + selector: + app: {{ .Values.backend.name }} + component: backend diff --git a/charts/ipify-chart/templates/frontend-deployment.yaml b/charts/ipify-chart/templates/frontend-deployment.yaml new file mode 100644 index 0000000..99a1967 --- /dev/null +++ b/charts/ipify-chart/templates/frontend-deployment.yaml @@ -0,0 +1,41 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.frontend.name }} + labels: + app: {{ .Values.frontend.name }} + component: frontend +spec: + replicas: {{ .Values.frontend.replicaCount }} + selector: + matchLabels: + app: {{ .Values.frontend.name }} + component: frontend + template: + metadata: + labels: + app: {{ .Values.frontend.name }} + component: frontend + spec: + containers: + - name: frontend + image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}" + imagePullPolicy: {{ .Values.frontend.image.pullPolicy }} + ports: + - containerPort: {{ .Values.frontend.service.targetPort }} + name: http + protocol: TCP + resources: + {{- toYaml .Values.frontend.resources | nindent 10 }} + livenessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 30 + periodSeconds: 10 + readinessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 10 + periodSeconds: 5 diff --git a/charts/ipify-chart/templates/frontend-service.yaml b/charts/ipify-chart/templates/frontend-service.yaml new file mode 100644 index 0000000..97637fe --- /dev/null +++ b/charts/ipify-chart/templates/frontend-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.frontend.name }} + labels: + app: {{ .Values.frontend.name }} + component: frontend +spec: + type: {{ .Values.frontend.service.type }} + ports: + - port: {{ .Values.frontend.service.port }} + targetPort: {{ .Values.frontend.service.targetPort }} + protocol: TCP + name: http + selector: + app: {{ .Values.frontend.name }} + component: frontend diff --git a/charts/ipify-chart/templates/ingress.yaml b/charts/ipify-chart/templates/ingress.yaml new file mode 100644 index 0000000..47799cf --- /dev/null +++ b/charts/ipify-chart/templates/ingress.yaml @@ -0,0 +1,43 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: ipify-ingress + annotations: + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + ingressClassName: {{ .Values.ingress.className }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + pathType: {{ .pathType }} + backend: + service: + {{- if eq .backend "backend" }} + name: {{ $.Values.backend.name }} + port: + number: {{ $.Values.backend.service.port }} + {{- else }} + name: {{ $.Values.frontend.name }} + port: + number: {{ $.Values.frontend.service.port }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/ipify-chart/values.yaml b/charts/ipify-chart/values.yaml new file mode 100644 index 0000000..a5bbbaf --- /dev/null +++ b/charts/ipify-chart/values.yaml @@ -0,0 +1,61 @@ +# Default values for ipify + +# Backend configuration +backend: + name: ipify-backend + replicaCount: 1 + image: + repository: ipify-backend + tag: latest + pullPolicy: IfNotPresent + service: + type: ClusterIP + port: 8000 + targetPort: 8000 + resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 250m + memory: 256Mi + +# Frontend configuration +frontend: + name: ipify-frontend + replicaCount: 1 + image: + repository: ipify-frontend + tag: latest + pullPolicy: IfNotPresent + service: + type: ClusterIP + port: 80 + targetPort: 80 + resources: + limits: + cpu: 200m + memory: 256Mi + requests: + cpu: 100m + memory: 128Mi + +# Ingress configuration +ingress: + enabled: true + className: nginx + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-prod" + hosts: + - host: ipify.example.com + paths: + - path: /api + pathType: Prefix + backend: backend + - path: / + pathType: Prefix + backend: frontend + tls: + - secretName: ipify-tls + hosts: + - ipify.example.com diff --git a/manifests/ipify/cname.yaml b/manifests/ipify/cname.yaml new file mode 100644 index 0000000..bb333be --- /dev/null +++ b/manifests/ipify/cname.yaml @@ -0,0 +1,2 @@ +enabled: true +hostname: ipify.dvirlabs.com \ No newline at end of file diff --git a/manifests/ipify/values.yaml b/manifests/ipify/values.yaml new file mode 100644 index 0000000..d8d5082 --- /dev/null +++ b/manifests/ipify/values.yaml @@ -0,0 +1,72 @@ +# Basic configuration values for IP Calculator application + +# Application metadata +app: + name: ipify + version: "1.0.0" + description: "IP Subnet Calculator with React + Vite frontend and FastAPI backend" + +# Backend configuration +backend: + port: 8000 + host: "0.0.0.0" + apiUrl: "http://localhost:8000" + cors: + enabled: true + origins: + - "http://localhost:3000" + - "http://localhost:5173" + +# Frontend configuration +frontend: + port: 3000 + apiUrl: "http://localhost:8000" + +# Development settings +development: + hotReload: true + debug: true + +# Production settings +production: + debug: false + minify: true + +# Docker configuration +docker: + backend: + image: "ipify-backend" + tag: "latest" + frontend: + image: "ipify-frontend" + tag: "latest" + +# Kubernetes/Helm configuration (for helm chart) +kubernetes: + namespace: "default" + replicas: + backend: 1 + frontend: 1 + resources: + backend: + limits: + cpu: "500m" + memory: "512Mi" + requests: + cpu: "250m" + memory: "256Mi" + frontend: + limits: + cpu: "200m" + memory: "256Mi" + requests: + cpu: "100m" + memory: "128Mi" + +# Ingress configuration +ingress: + enabled: false + host: "ipify.example.com" + tls: + enabled: false + secretName: "ipify-tls"