Skip to content

Commit

Permalink
Added mandatory Microtica files
Browse files Browse the repository at this point in the history
  • Loading branch information
Microtica committed Dec 24, 2022
1 parent b47f379 commit c658773
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 0 deletions.
122 changes: 122 additions & 0 deletions .microtica/kube.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: "{{MIC_NAMESPACE}}"
name: "{{MIC_NAME}}"
labels:
app: "{{MIC_NAME}}"
microticaService: "{{MIC_NAME}}"
spec:
replicas: 1
selector:
matchLabels:
app: "{{MIC_NAME}}"
template:
metadata:
labels:
app: "{{MIC_NAME}}"
spec:
imagePullSecrets:
- name: {{MIC_REGISTRY}}
containers:
- name: "{{MIC_NAME}}"
image: "{{MIC_IMAGE}}"
env:
- name: "PORT"
value: "{{MIC_CONTAINER_PORT}}"
ports:
- name: http
containerPort: {{MIC_CONTAINER_PORT}}
resources:
requests:
memory: "{{MIC_AS_MEMORY}}Mi"
cpu: "{{MIC_AS_CPU}}m"
limits:
memory: "{{MIC_AS_MAX_MEMORY}}Mi"
cpu: "{{MIC_AS_MAX_CPU}}m"
---
apiVersion: v1
kind: Service
metadata:
namespace: "{{MIC_NAMESPACE}}"
name: "{{MIC_NAME}}"
labels:
microticaService: "{{MIC_NAME}}"
annotations:
app: "{{MIC_NAME}}"
spec:
ports:
- port: 443
targetPort: http
protocol: TCP
type: NodePort
selector:
app: "{{MIC_NAME}}"
---
kind: HorizontalPodAutoscaler
apiVersion: autoscaling/v2beta2
metadata:
namespace: "{{MIC_NAMESPACE}}"
name: "{{MIC_NAME}}"
labels:
microticaService: "{{MIC_NAME}}"
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: "{{MIC_NAME}}"
minReplicas: {{MIC_AS_MIN_REPLICAS}}
maxReplicas: {{MIC_AS_MAX_REPLICAS}}
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{MIC_AS_MEMORY_UTILIZATION}}
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{MIC_AS_CPU_UTILIZATION}}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: "{{MIC_DOMAIN_NAME}}"
namespace: "{{MIC_NAMESPACE}}"
labels:
microticaService: "{{MIC_NAME}}"
spec:
secretName: "{{MIC_DOMAIN_TLS}}"
dnsNames:
- "{{MIC_DOMAIN_NAME}}"
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
name: "{{MIC_NAME}}"
namespace: "{{MIC_NAMESPACE}}"
spec:
ingressClassName: nginx
rules:
- host: "{{MIC_DOMAIN_NAME}}"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: "{{MIC_NAME}}"
port:
number: 443
tls:
- hosts:
- "{{MIC_DOMAIN_NAME}}"
secretName: "{{MIC_DOMAIN_TLS}}"
19 changes: 19 additions & 0 deletions .microtica/microtica.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
steps:
Clone:
type: git-clone

PushContainerImage:
type: docker-push
image_name: "{{MIC_PIPELINE_NAME}}"
dockerfile: ./.microtica/Dockerfile
registry: "{{CONTAINER_REGISTRY_ID}}"
tag: "{{MIC_PIPELINE_EXECUTION_ID}}"

DeployApplication:
type: deploy
target: kubernetes
cluster: "{{CLUSTER_ID}}"
service: "{{SERVICE_NAME}}"
namespace: "{{CLUSTER_NAMESPACE}}"
branch_filter: "{{MIC_BRANCH_FILTER}}"
tag: "{{MIC_PIPELINE_EXECUTION_ID}}"
14 changes: 14 additions & 0 deletions .microtica/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "schema://microtica/nextjs.json",
"title": "NextJS service schema",
"type": "object",
"properties": {
"inputs": {
"type": "object",
"properties": {},
"required": []
}
},
"additionalProperties": false
}
27 changes: 27 additions & 0 deletions .microtica/template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Import an existing app
description: Import an existing app from your Git repository and deploy it on your Kubernetes cluster.
logo: https://microtica.s3.eu-central-1.amazonaws.com/assets/templates/logos/import-app.svg
repo: https://github.com/microtica/templates/tree/master/import-app

inputs:
properties:
AppName:
type: string
description: The name of the application. The name will be shown in the portal.
maxLength: 23
pattern: ^[a-z]*$
patternErrorMessage: "The app name can contain only lowercase letters."
required:
- AppName

service:
"{{AppName}}":
source: git
containerPort: "{{CONTAINER_PORT}}"
autoScaling:
minReplicas: 1
maxReplicas: 1
cpu: 10
maxCpu: 100
memory: 64
maxMemory: 300

0 comments on commit c658773

Please sign in to comment.