This commit is contained in:
29
.woodpecker.yml
Normal file
29
.woodpecker.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
steps:
|
||||
build:
|
||||
image: plugins/kaniko
|
||||
settings:
|
||||
repo: ${FORGE_NAME}/${CI_REPO}
|
||||
registry:
|
||||
from_secret: container_registry
|
||||
tags: latest,${CI_COMMIT_SHA},${CI_COMMIT_TAG}
|
||||
username:
|
||||
from_secret: container_registry_username
|
||||
password:
|
||||
from_secret: container_registry_password
|
||||
dockerfile: Dockerfile
|
||||
when:
|
||||
- event: tag
|
||||
|
||||
deploy:
|
||||
image: quay.io/wollud1969/k8s-admin-helper:0.3.4
|
||||
environment:
|
||||
KUBE_CONFIG_CONTENT:
|
||||
from_secret: kube_config
|
||||
commands:
|
||||
- export IMAGE_TAG=$CI_COMMIT_SHA
|
||||
- printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig
|
||||
- export KUBECONFIG=/tmp/kubeconfig
|
||||
- ./deployment/deploy.sh
|
||||
when:
|
||||
- event: tag
|
||||
|
||||
13
Dockerfile
13
Dockerfile
@@ -4,15 +4,14 @@ LABEL Maintainer="Wolfgang Hottgenroth <woho@hottis.de>"
|
||||
LABEL ImageName=""
|
||||
|
||||
RUN \
|
||||
apk add --no-cache exim
|
||||
apk add --no-cache syslog-ng
|
||||
|
||||
COPY exim.conf /etc/exim
|
||||
RUN chmod 644 /etc/exim/exim.conf
|
||||
COPY syslog-ng.conf /etc/syslog-ng
|
||||
RUN mkdir -p /var/log/remote
|
||||
|
||||
WORKDIR /etc/exim
|
||||
VOLUME /var/log/remote
|
||||
EXPOSE 514/UDP
|
||||
|
||||
EXPOSE 25
|
||||
|
||||
CMD [ "/usr/sbin/exim", "-bdf", "-q15m", "-v" ]
|
||||
CMD [ "/usr/sbin/syslog-ng", "-f", "/etc/syslog-ng/syslog-ng.conf", "-F" ]
|
||||
|
||||
|
||||
|
||||
56
deploy-yml.tmpl
Normal file
56
deploy-yml.tmpl
Normal file
@@ -0,0 +1,56 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: syslog-ng-data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
storageClassName: nfs-client
|
||||
resources:
|
||||
requests:
|
||||
storage: 1000Mi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: syslog-ng
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: syslog-ng
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: syslog-ng
|
||||
spec:
|
||||
containers:
|
||||
- name: syslog-ng
|
||||
image: %IMAGE%
|
||||
ports:
|
||||
- name: syslog
|
||||
containerPort: 514
|
||||
protocol: UDP
|
||||
volumeMounts:
|
||||
- name: syslog-ng-data
|
||||
mountPath: /var/log/remote
|
||||
readOnly: false
|
||||
volumes:
|
||||
- name: syslog-ng-data
|
||||
persistentVolumeClaim:
|
||||
claimName: syslog-ng-data
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: syslog
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
app: syslog-ng
|
||||
ports:
|
||||
- name: syslog
|
||||
port: 514
|
||||
targetPort: 514
|
||||
protocol: UDP
|
||||
|
||||
26
deploy.sh
Executable file
26
deploy.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$IMAGE_TAG" == "" ]; then
|
||||
echo "Make sure IMAGE_TAG is set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
IMAGE_NAME=gitea.hottis.de/deployments/syslog-ng-server
|
||||
NAMESPACE=syslog-ng
|
||||
DEPLOYMENT_DIR=$PWD/deployment
|
||||
|
||||
pushd $DEPLOYMENT_DIR > /dev/null
|
||||
|
||||
kubectl create namespace $NAMESPACE \
|
||||
--dry-run=client \
|
||||
-o yaml | \
|
||||
kubectl -f - apply
|
||||
|
||||
|
||||
cat $DEPLOYMENT_DIR/deploy-yml.tmpl | \
|
||||
sed -e 's,%IMAGE%,'$IMAGE_NAME':'$IMAGE_TAG','g | \
|
||||
kubectl apply -f - -n $NAMESPACE
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
Reference in New Issue
Block a user