mirror of
https://github.com/marcel-dempers/docker-development-youtube-series.git
synced 2025-06-06 17:01:30 +00:00
restructure flux folders
This commit is contained in:
parent
b898ab2bf9
commit
000a878d7b
@ -98,6 +98,12 @@ flux bootstrap github \
|
||||
--path=kubernetes/fluxcd/clusters/dev-cluster \
|
||||
--personal \
|
||||
--branch fluxcd-2022
|
||||
|
||||
flux check
|
||||
|
||||
# flux manages itself using GitOps objects:
|
||||
kubectl -n flux-system get GitRepository
|
||||
kubectl -n flux-system get Kustomization
|
||||
```
|
||||
|
||||
Check the source code that `flux bootstrap` created
|
||||
@ -105,3 +111,34 @@ Check the source code that `flux bootstrap` created
|
||||
```
|
||||
git pull origin <branch-name>
|
||||
```
|
||||
|
||||
# Repository structure
|
||||
|
||||
https://fluxcd.io/flux/guides/repository-structure/
|
||||
|
||||
* Mono Repo
|
||||
* Repo per team
|
||||
* Repo per app
|
||||
|
||||
```
|
||||
- apps
|
||||
- example-app-1
|
||||
- example-app-2
|
||||
- infrastructure
|
||||
- ingress-nginx
|
||||
- monitoring
|
||||
- clusters
|
||||
-dev-cluster
|
||||
-prod-cluster
|
||||
```
|
||||
|
||||
## build our app
|
||||
|
||||
```
|
||||
cd kubernetes\fluxcd\apps\example-app-1\src
|
||||
|
||||
docker build . -t example-app-1:0.0.1
|
||||
|
||||
#load the image to our test cluster so we dont need to push to a registry
|
||||
kind load docker-image example-app-1:0.0.1 --name fluxcd
|
||||
```
|
||||
|
@ -20,7 +20,7 @@ metadata:
|
||||
namespace: flux-system
|
||||
spec:
|
||||
interval: 10m0s
|
||||
path: ./kubernetes/fluxcd/clusters/dev-cluster
|
||||
path: ./kubernetes/fluxcd/repositories/config/clusters/dev-cluster
|
||||
prune: true
|
||||
sourceRef:
|
||||
kind: GitRepository
|
@ -0,0 +1,9 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: example-app-1
|
||||
data:
|
||||
config.json: |
|
||||
{
|
||||
"environment" : "dev"
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: example-app-1
|
||||
labels:
|
||||
app: example-app-1
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: example-app-1
|
||||
replicas: 2
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: example-app-1
|
||||
spec:
|
||||
containers:
|
||||
- name: example-app-1
|
||||
image: example-app-1:0.0.1
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
volumeMounts:
|
||||
- name: config-volume
|
||||
mountPath: /configs/
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: example-app-1
|
@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: example-app-1
|
||||
labels:
|
||||
app: example-app-1
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: example-app-1
|
||||
ports:
|
||||
- protocol: TCP
|
||||
name: http
|
||||
port: 80
|
||||
targetPort: 5000
|
6
kubernetes/fluxcd/repositories/example-app-1/src/app.py
Normal file
6
kubernetes/fluxcd/repositories/example-app-1/src/app.py
Normal file
@ -0,0 +1,6 @@
|
||||
from flask import Flask
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return "Hello World!"
|
@ -0,0 +1,8 @@
|
||||
FROM python:3.7.3-alpine3.9 as base
|
||||
|
||||
RUN pip install Flask==2.0.3
|
||||
|
||||
WORKDIR /app
|
||||
COPY app.py /app/
|
||||
ENV FLASK_APP=app.py
|
||||
CMD flask run -h 0.0.0 -p 5000
|
Loading…
x
Reference in New Issue
Block a user