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

Create new project: pr-test1 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 17 additions & 0 deletions mypath/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM alpine:latest

RUN apk update && \
apk add python3

# We copy just the requirements.txt first to leverage Docker cache
COPY ./requirements.txt /app/requirements.txt

WORKDIR /app

RUN pip3 install -r requirements.txt

COPY . /app

ENTRYPOINT [ "python3" ]

CMD [ "app.py" ]
42 changes: 42 additions & 0 deletions mypath/K8s/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: v1
kind: Service
metadata:
name: flask-http
spec:
selector:
k8s-app: flask-http
ports:
- port: 80
targetPort: 5000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: flask-http
namespace: default
labels:
k8s-app: flask-http
spec:
replicas: 1
selector:
matchLabels:
k8s-app: flask-http
template:
metadata:
labels:
k8s-app: flask-http
spec:
containers:
- name: flask-http
image: tduek/flask-http:m-0.1
imagePullPolicy: Always
ports:
- containerPort: 5000
protocol: TCP
resources:
requests:
cpu: 500m
memory: 128Mi
limits:
cpu: 1000m
memory: 128Mi
24 changes: 24 additions & 0 deletions mypath/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
REPO?=tduek
IMAGE?=flask-http
TAG?=0.1
MULTIARCH_TAG?=m-0.1
PLATFORMS?=linux/amd64,linux/arm64

all: build build-multiarch

.PHONY: build
build: ## Build and
docker build -t $(REPO)/$(IMAGE):$(TAG) .

.PHONY: push
push: ##
docker push $(REPO)/$(IMAGE):$(TAG)

.PHONY: build-multiarch
build-multiarch: ##
docker buildx build --platform $(PLATFORMS) -t $(REPO)/$(IMAGE):$(MULTIARCH_TAG) --push .

.PHONY: deploy-k8s
deploy-k8s: ##
docker buildx build --platform $(PLATFORMS) -t $(REPO)/$(IMAGE):$(MULTIARCH_TAG) --push .

18 changes: 18 additions & 0 deletions mypath/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# flask_web/app.py

from flask import Flask
app = Flask(__name__)


@app.route('/')
def hello_world():
return 'Hey, we have Flask in a Docker container!'


@app.route('/goaway')
def goaway():
return 'GO AWAY!'


if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')
8 changes: 8 additions & 0 deletions mypath/catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: "pr-test1"
spec:
type: website
lifecycle: experimental
owner: user:guest
23 changes: 23 additions & 0 deletions mypath/helm/.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/
23 changes: 23 additions & 0 deletions mypath/helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v2
name: mychart
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: 0.1.0

# 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.
appVersion: 1.16.0
27 changes: 27 additions & 0 deletions mypath/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{.Values.name}}-deployment
spec:
replicas: {{int .Values.replicas}}
selector:
matchLabels:
app: {{.Values.name}}
template:
metadata:
labels:
app: {{.Values.name}}
spec:
containers:
- name: {{.Values.name}}
image: {{.Values.image}}
ports:
- containerPort: 5000
protocol: TCP
resources:
requests:
cpu: {{.Values.resources.requests.cpu}}
memory: {{.Values.resources.requests.memory}}
limits:
cpu: {{.Values.resources.limits.cpu}}
memory: {{.Values.resources.limits.memory}}
6 changes: 6 additions & 0 deletions mypath/helm/templates/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{- if .Values.createNamespace}}
apiVersion: v1
kind: Namespace
metadata:
name: {{.Values.namespace}}
{{- end}}
12 changes: 12 additions & 0 deletions mypath/helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: {{.Values.name}}-svc
spec:
type: {{.Values.serviceType}}
ports:
- port: {{.Values.servicePort}}
targetPort: {{.Values.serviceTargetPort}}
protocol: TCP
selector:
app: {{.Values.name}}
34 changes: 34 additions & 0 deletions mypath/helm/values-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: flask-http
replicas: 1

image: tduek/flask-http:m-0.1

createNamespace: false
namespace: flask-http-prod

# Service Type allow you to specify what kind of service you want.
# Possible values for ServiceType are:
# ClusterIP | NodePort | LoadBalancer | ExternalName
serviceType: ClusterIP

# A Service can map an incoming port to any targetPort.
# targetPort is where application is listening on inside the container.
servicePort: 80
serviceTargetPort: 5000

resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi
# Specify all environment variables to be added to the container.
# The following two maps, config and secrets, are put into a ConfigMap
# and a Secret, respectively.
# Both are added to the container environment in podSpec as envFrom source.
# env:
# config:
# key1: value1
# secrets:
# key2: value2
34 changes: 34 additions & 0 deletions mypath/helm/values-staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: flask-http
replicas: 1

image: tduek/flask-http:m-0.1

createNamespace: false
namespace: flask-http-staging

# Service Type allow you to specify what kind of service you want.
# Possible values for ServiceType are:
# ClusterIP | NodePort | LoadBalancer | ExternalName
serviceType: ClusterIP

# A Service can map an incoming port to any targetPort.
# targetPort is where application is listening on inside the container.
servicePort: 80
serviceTargetPort: 5000

resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi
# Specify all environment variables to be added to the container.
# The following two maps, config and secrets, are put into a ConfigMap
# and a Secret, respectively.
# Both are added to the container environment in podSpec as envFrom source.
# env:
# config:
# key1: value1
# secrets:
# key2: value2
35 changes: 35 additions & 0 deletions mypath/helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: flask-http
replicas: 1

image: tduek/flask-http:m-0.1

createNamespace: false
namespace: flask-http

# Service Type allow you to specify what kind of service you want.
# Possible values for ServiceType are:
# ClusterIP | NodePort | LoadBalancer | ExternalName
serviceType: ClusterIP

# A Service can map an incoming port to any targetPort.
# targetPort is where application is listening on inside the container.
servicePort: 80
serviceTargetPort: 5000

resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 200m
memory: 256Mi

# Specify all environment variables to be added to the container.
# The following two maps, config and secrets, are put into a ConfigMap
# and a Secret, respectively.
# Both are added to the container environment in podSpec as envFrom source.
# env:
# config:
# key1: value1
# secrets:
# key2: value2
6 changes: 6 additions & 0 deletions mypath/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Click==7.0
Flask==1.0.2
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.1
Werkzeug==0.15.3