2 Commits

Author SHA1 Message Date
aaaf6fa29f building an debian-stable image 2021-02-22 13:08:48 +01:00
3538f407e8 mariadb and postgres and all of that 2021-02-20 22:40:49 +01:00
11 changed files with 167 additions and 44 deletions

View File

@@ -0,0 +1,9 @@
FROM debian:stable-slim
RUN sed -i 's@deb.debian.org@apt-cache.lan/deb.debian.org@g' /etc/apt/sources.list && \
sed -i 's@security.debian.org@apt-cache.lan/security.debian.org@g' /etc/apt/sources.list && \
apt-get update && apt-get install -y \
dig procps nmap bash iputils-ping && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/apt/*

View File

@@ -0,0 +1,84 @@
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: chaos-kubernetes-git
spec:
type: git
params:
- name: revision
value: master
- name: url
value: http://git-ui.lan/chaos/kubernetes.git
- name: submodules
value: "false"
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: img-debian-stable
spec:
type: image
params:
- name: url
value: cr.lan/debian-stable
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: build-debian-stable
spec:
params:
- name: pathToContainerFile
type: string
default: $(resources.inputs.source.path)/_CI-CD/debian-stable/Dockerfile
- name: pathToContext
type: string
default: $(resources.inputs.source.path)/_CI-CD/debian-stable
resources:
inputs:
- name: source
type: git
outputs:
- name: builtImage
type: image
steps:
- name: build-and-push
image: gcr.io/kaniko-project/executor:arm64
command:
- /kaniko/executor
args:
- --dockerfile=$(params.pathToContainerFile)
- --destination=$(resources.outputs.builtImage.url)
- --context=$(params.pathToContext)
- --skip-tls-verify
#workspaces:
# - name: workspace
# mountPath: /workspace
---
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: img-debian-stable
spec:
taskRef:
name: build-debian-stable
params:
- name: pathToContainerFile
value: Dockerfile
resources:
inputs:
- name: source
resourceRef:
name: chaos-kubernetes-git
outputs:
- name: builtImage
resourceRef:
name: img-debian-stable
# workspaces:
# - name: workspace
# persistentVolumeClaim:
# claimName: tektoncd-workspaces
# subPath: workspaces

View File

@@ -5,7 +5,7 @@ metadata:
name: descheduler-cronjob name: descheduler-cronjob
namespace: kube-system namespace: kube-system
spec: spec:
schedule: "*/2 * * * *" schedule: "40 */1 * * *"
concurrencyPolicy: "Forbid" concurrencyPolicy: "Forbid"
jobTemplate: jobTemplate:
spec: spec:

View File

@@ -5,9 +5,8 @@ metadata:
app: distcc app: distcc
release: stable release: stable
name: distcc name: distcc
namespace: default
spec: spec:
replicas: 5 replicas: 4
selector: selector:
matchLabels: matchLabels:
app: distcc app: distcc
@@ -21,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: distcc - name: distcc
image: cr.lan/distcc:aarch64 image: cr.lan/distcc
imagePullPolicy: Always imagePullPolicy: Always
#env: #env:
#- name: OPTIONS #- name: OPTIONS
@@ -35,10 +34,10 @@ spec:
protocol: TCP protocol: TCP
resources: resources:
limits: limits:
cpu: 1 cpu: 4
memory: 128Mi memory: 128Mi
requests: requests:
cpu: 1 cpu: 50m
memory: 64Mi memory: 64Mi
dnsPolicy: ClusterFirst dnsPolicy: ClusterFirst
restartPolicy: Always restartPolicy: Always
@@ -55,26 +54,25 @@ spec:
values: values:
- distcc - distcc
topologyKey: kubernetes.io/hostname topologyKey: kubernetes.io/hostname
--- #---
apiVersion: v1 #apiVersion: v1
kind: Service #kind: Service
metadata: #metadata:
labels: # labels:
app: distcc # app: distcc
release: stable # release: stable
namespace: default # name: distcc
name: distcc #spec:
spec: # externalTrafficPolicy: Cluster
externalTrafficPolicy: Cluster # ports:
ports: # - name: distcc-data
- name: distcc-data # port: 3632
port: 3632 # targetPort: 3632
targetPort: 3632 # protocol: TCP
protocol: TCP # - name: distcc-stats
- name: distcc-stats # port: 3633
port: 3633 # targetPort: 3633
targetPort: 3633 # protocol: TCP
protocol: TCP # selector:
selector: # app: distcc
app: distcc # type: LoadBalancer
type: LoadBalancer

View File

@@ -32,6 +32,16 @@ spec:
value: "1000" value: "1000"
- name: TZ - name: TZ
value: "Europe/Berlin" value: "Europe/Berlin"
- name: DB_TYPE
value: postgres
- name: DB_HOST
value: postgres.live-env.svc.cluster.local:5432
- name: DB_NAME
value: gitea
- name: DB_USER
value: gitea
- name: DB_PASSWD
value: giteaEu94XSS4gKpheSBoMsIs
volumeMounts: volumeMounts:
- name: gitea - name: gitea
mountPath: /data mountPath: /data
@@ -84,6 +94,7 @@ metadata:
app: gitea app: gitea
spec: spec:
type: LoadBalancer type: LoadBalancer
loadBalancerIP: 172.23.255.2
ports: ports:
- port: 3000 - port: 3000
targetPort: http targetPort: http

View File

@@ -98,4 +98,4 @@ spec:
claimRef: claimRef:
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
name: mariadb-data name: mariadb-data
namespace: default namspace: live-env

View File

@@ -6,6 +6,8 @@ RUN groupadd -r mysql && useradd -r -g mysql mysql
# https://bugs.debian.org/830696 (apt uses gpgv by default in newer releases, rather than gpg) # https://bugs.debian.org/830696 (apt uses gpgv by default in newer releases, rather than gpg)
RUN set -ex; \ RUN set -ex; \
sed -i 's@deb.debian.org@apt-cache.lan/deb.debian.org@g' /etc/apt/sources.list; \
sed -i 's@security.debian.org@apt-cache.lan/security.debian.org@g' /etc/apt/sources.list; \
apt-get update; \ apt-get update; \
if ! which gpg; then \ if ! which gpg; then \
apt-get install -y --no-install-recommends gnupg; \ apt-get install -y --no-install-recommends gnupg; \
@@ -93,6 +95,7 @@ RUN set -ex; \
| xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/'; \ | xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/'; \
# don't reverse lookup hostnames, they are usually another container # don't reverse lookup hostnames, they are usually another container
echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf; \ echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf; \
mkdir -p /run/mysqld; \
apt-get clean -y; apt-get clean -y;
VOLUME /var/lib/mysql VOLUME /var/lib/mysql

View File

@@ -6,7 +6,6 @@ metadata:
app: mosquitto app: mosquitto
release: mqtt release: mqtt
name: mqtt-mosquitto name: mqtt-mosquitto
namespace: default
spec: spec:
replicas: 1 replicas: 1
selector: selector:
@@ -63,7 +62,7 @@ spec:
name: mosquitto-data name: mosquitto-data
subPath: mosquitto/data subPath: mosquitto/data
- name: mosquitto-exporter - name: mosquitto-exporter
image: cr.lan/mosquitto-exporter image: cr.lan/mosquitto-exporter:arm64
imagePullPolicy: Always imagePullPolicy: Always
ports: ports:
- containerPort: 9234 - containerPort: 9234
@@ -96,7 +95,6 @@ metadata:
labels: labels:
app: mosquitto app: mosquitto
release: mqtt release: mqtt
namespace: default
name: mqtt-mosquitto name: mqtt-mosquitto
spec: spec:
externalTrafficPolicy: Cluster externalTrafficPolicy: Cluster
@@ -121,7 +119,6 @@ metadata:
app: mosquitto app: mosquitto
release: mqtt release: mqtt
name: mqtt-mosquitto name: mqtt-mosquitto
namespace: default
spec: spec:
accessModes: accessModes:
- ReadWriteOnce - ReadWriteOnce
@@ -135,7 +132,6 @@ apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: mqtt-mosquitto name: mqtt-mosquitto
namespace: default
labels: labels:
app: mosquitto app: mosquitto
release: mqtt release: mqtt

View File

@@ -45,12 +45,13 @@ spec:
script: | script: |
#!/usr/bin/env bash #!/usr/bin/env bash
cd $(resources.inputs.source.path) cd $(resources.inputs.source.path)
ls -al
export GOARCH=arm64 export GOARCH=arm64
export GOPATH=/usr/src/gopath export GOPATH=/usr/src/gopath
export GOCACHE=/usr/src/gocache export GOCACHE=/usr/src/gocache
go env go env
go get go get github.com/sapcc/mosquitto-exporter
make -j4 build CGO_ENABLED=1 make -j4 build CGO_ENABLED=0
- name: build-and-push - name: build-and-push
image: gcr.io/kaniko-project/executor:arm64 image: gcr.io/kaniko-project/executor:arm64
command: command:

View File

@@ -3,7 +3,7 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: pihole-password name: pihole-password
namespace: default namespace: live-env
type: Opaque type: Opaque
data: data:
password: YWRtaW4yMDIw password: YWRtaW4yMDIw
@@ -172,7 +172,7 @@ metadata:
labels: labels:
app: pihole app: pihole
name: pihole-tcp name: pihole-tcp
namespace: default namespace: live-env
spec: spec:
type: LoadBalancer type: LoadBalancer
loadBalancerIP: 172.23.255.253 loadBalancerIP: 172.23.255.253
@@ -204,7 +204,7 @@ metadata:
labels: labels:
app: pihole app: pihole
name: pihole-udp name: pihole-udp
namespace: default namespace: live-env
spec: spec:
type: LoadBalancer type: LoadBalancer
loadBalancerIP: 172.23.255.253 loadBalancerIP: 172.23.255.253

View File

@@ -40,7 +40,7 @@ spec:
volumes: volumes:
- name: postgres-disk - name: postgres-disk
persistentVolumeClaim: persistentVolumeClaim:
claimName: postgres claimName: postgres-data
# volumeClaimTemplates: # volumeClaimTemplates:
# - metadata: # - metadata:
# name: postgres-disk # name: postgres-disk
@@ -54,17 +54,37 @@ spec:
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata: metadata:
name: postgres name: postgres-data
labels: labels:
app: postgres app: postgres
spec: spec:
storageClassName: nfs-ssd storageClassName: nfs-ssd
volumeName: postgres-data
accessModes: accessModes:
- ReadWriteOnce - ReadWriteOnce
resources: resources:
requests: requests:
storage: 20Mi storage: 40Gi
# service.yml ---
apiVersion: v1
kind: PersistentVolume
metadata:
name: postgres-data
spec:
storageClassName: "nfs-ssd"
nfs:
path: /data/raid1-ssd/k8s-data/postgres-data
server: ebin01
capacity:
storage: 40Gi
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
persistentVolumeReclaimPolicy: Retain
claimRef:
kind: PersistentVolumeClaim
name: postgres-data
namespace: live-env
--- ---
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
@@ -77,6 +97,7 @@ spec:
selector: selector:
env: live env: live
type: LoadBalancer type: LoadBalancer
loadBalancerIP: 172.23.255.4
ports: ports:
- port: 5432 - port: 5432
targetPort: 5432 targetPort: 5432