forked from reallyreally/docker-snmpd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added chart, auto-build and updated dockerfile
- Loading branch information
1 parent
dbd7d60
commit cd89b1c
Showing
8 changed files
with
208 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * 0' # Runs every Sunday at midnight | ||
workflow_dispatch: # Allows manual trigger | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Get latest snmpd version | ||
id: get-version | ||
run: | | ||
latest_version=$(curl -s "https://sourceforge.net/projects/net-snmp/files/net-snmp/" | grep -Po 'href="\/projects\/net-snmp\/files\/net-snmp\/\K[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -1) | ||
echo "latest_version=${latest_version}" >> $GITHUB_ENV | ||
major_version=$(echo $latest_version | cut -d'.' -f1) | ||
minor_version=$(echo $latest_version | cut -d'.' -f1-2) | ||
echo "major_version=${major_version}" >> $GITHUB_ENV | ||
echo "minor_version=${minor_version}" >> $GITHUB_ENV | ||
- name: Build Docker image | ||
run: | | ||
docker build --build-arg SNMPD_VERSION=${{ env.latest_version }} -t ghcr.io/${{ github.repository_owner }}/snmpd:${{ env.latest_version }} . | ||
- name: Tag Docker image | ||
run: | | ||
docker tag ghcr.io/${{ github.repository_owner }}/snmpd:${{ env.latest_version }} ghcr.io/${{ github.repository_owner }}/snmpd:latest | ||
docker tag ghcr.io/${{ github.repository_owner }}/snmpd:${{ env.latest_version }} ghcr.io/${{ github.repository_owner }}/snmpd:${{ env.major_version }} | ||
docker tag ghcr.io/${{ github.repository_owner }}/snmpd:${{ env.latest_version }} ghcr.io/${{ github.repository_owner }}/snmpd:${{ env.minor_version }} | ||
- name: Push Docker image | ||
run: | | ||
docker push ghcr.io/${{ github.repository_owner }}/snmpd:${{ env.latest_version }} | ||
docker push ghcr.io/${{ github.repository_owner }}/snmpd:latest | ||
docker push ghcr.io/${{ github.repository_owner }}/snmpd:${{ env.major_version }} | ||
docker push ghcr.io/${{ github.repository_owner }}/snmpd:${{ env.minor_version }} | ||
- name: Tag the repository with the latest version | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git tag ${latest_version} | ||
git push origin ${latest_version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: snmpd | ||
appVersion: "5.9.4" | ||
version: "1.0.0" | ||
type: application | ||
description: A Helm chart for deploying snmpd as a DaemonSet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: snmpd-config | ||
data: | ||
snmpd.conf: |- | ||
{{ .Values.config.snmpdConfig | indent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: snmpd-daemonset | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: snmpd | ||
template: | ||
metadata: | ||
labels: | ||
app: snmpd | ||
spec: | ||
nodeSelector: | ||
{{- toYaml .Values.nodeSelector | nindent 8 }} | ||
containers: | ||
- name: snmpd | ||
image: {{ .Values.image.repository }}:{{ .Values.image.tag }} | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
{{- range .Values.ports }} | ||
- name: {{ .name }} | ||
containerPort: {{ .containerPort }} | ||
hostPort: {{ .hostPort }} | ||
protocol: {{ .protocol }} | ||
{{- end }} | ||
volumeMounts: | ||
- name: snmpd-config | ||
mountPath: /etc/snmp/snmpd.conf | ||
subPath: snmpd.conf | ||
securityContext: | ||
runAsUser: 0 | ||
runAsGroup: 0 | ||
allowPrivilegeEscalation: true | ||
volumes: | ||
- name: snmpd-config | ||
configMap: | ||
name: snmpd-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: snmpd-service | ||
spec: | ||
selector: | ||
app: snmpd | ||
ports: | ||
- name: snmp-tcp | ||
port: 161 | ||
protocol: TCP | ||
nodePort: 3161 | ||
- name: snmp-trap-tcp | ||
port: 162 | ||
protocol: TCP | ||
nodePort: 3162 | ||
- name: snmp-udp | ||
port: 161 | ||
protocol: UDP | ||
nodePort: 3161 | ||
- name: snmp-trap-udp | ||
port: 162 | ||
protocol: UDP | ||
nodePort: 3162 | ||
type: NodePort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
image: | ||
repository: ghcr.io/inputobject2/snmpd:latest | ||
tag: latest | ||
pullPolicy: IfNotPresent | ||
|
||
config: | ||
snmpdConfig: | | ||
# Change "public" on the line below to your preferred SNMP community string | ||
com2sec readonly default public | ||
group MyROGroup v2c readonly | ||
view all included .1 80 | ||
access MyROGroup "" any noauth exact all none none | ||
syslocation Rack, Room, Building, City, Country [GPSX,Y] | ||
syscontact Your Name <your@email.address> | ||
ports: | ||
- name: snmp-tcp | ||
containerPort: 161 | ||
hostPort: 161 | ||
protocol: TCP | ||
- name: snmp-trap-tcp | ||
containerPort: 162 | ||
hostPort: 162 | ||
protocol: TCP | ||
- name: snmp-udp | ||
containerPort: 161 | ||
hostPort: 161 | ||
protocol: UDP | ||
- name: snmp-trap-udp | ||
containerPort: 162 | ||
hostPort: 162 | ||
protocol: UDP | ||
|
||
nodeSelector: {} |
This file was deleted.
Oops, something went wrong.