diff --git a/stx-snmp-helm/centos/docker/stx-fm-subagent/Dockerfile b/stx-snmp-helm/centos/docker/stx-fm-subagent/Dockerfile index 3d5ca8a..386ea74 100644 --- a/stx-snmp-helm/centos/docker/stx-fm-subagent/Dockerfile +++ b/stx-snmp-helm/centos/docker/stx-fm-subagent/Dockerfile @@ -6,7 +6,6 @@ RUN yum -y install\ fm-common-dev FROM centos:7 AS base - RUN yum -y install\ net-snmp \ net-snmp-utils \ @@ -38,7 +37,6 @@ RUN make FROM base AS deployment-env - COPY --from=builder /home/sub-agent/snmpSubAgent . COPY bootstrap.sh . RUN chmod 755 bootstrap.sh diff --git a/stx-snmp-helm/centos/docker/stx-fm-subagent/bootstrap.sh b/stx-snmp-helm/centos/docker/stx-fm-subagent/bootstrap.sh index ac771e6..e62e107 100755 --- a/stx-snmp-helm/centos/docker/stx-fm-subagent/bootstrap.sh +++ b/stx-snmp-helm/centos/docker/stx-fm-subagent/bootstrap.sh @@ -1,9 +1,22 @@ #!/bin/bash set -u +# Option handling in sh +if [ "$OPTIONDEBUG" != "" ]; then + case "$OPTIONDEBUG" in + -DALL) echo "-DALL - debug option enable" + ;; + -*) echo "Unrecognized option $OPTIONDEBUG" + OPTIONDEBUG="" + ;; + *) echo "Bad argument $OPTIONDEBUG" + OPTIONDEBUG="" + ;; + esac +fi + # Internal params -RUN_CMD="./snmpSubAgent -f -x tcp:localhost:705" +RUN_CMD="./snmpSubAgent ${OPTIONDEBUG} -f -x tcp:localhost:705" # Launch $RUN_CMD - diff --git a/stx-snmp-helm/centos/docker/stx-fm-trap-subagent/Dockerfile b/stx-snmp-helm/centos/docker/stx-fm-trap-subagent/Dockerfile index d2daefa..26df7ab 100644 --- a/stx-snmp-helm/centos/docker/stx-fm-trap-subagent/Dockerfile +++ b/stx-snmp-helm/centos/docker/stx-fm-trap-subagent/Dockerfile @@ -23,4 +23,3 @@ COPY --from=builder /home/trapagent/wrsAlarmMIB . COPY bootstrap.sh . RUN chmod 755 ./bootstrap.sh ENTRYPOINT ["./bootstrap.sh"] - diff --git a/stx-snmp-helm/centos/docker/stx-fm-trap-subagent/bootstrap.sh b/stx-snmp-helm/centos/docker/stx-fm-trap-subagent/bootstrap.sh index 62de88d..9c27470 100644 --- a/stx-snmp-helm/centos/docker/stx-fm-trap-subagent/bootstrap.sh +++ b/stx-snmp-helm/centos/docker/stx-fm-trap-subagent/bootstrap.sh @@ -1,8 +1,22 @@ #!/bin/bash set -u +# Option handling in sh +if [ "$OPTIONDEBUG" != "" ]; then + case "$OPTIONDEBUG" in + -DALL) echo "-DALL - debug option enable" + ;; + -*) echo "Unrecognized option $OPTIONDEBUG" + OPTIONDEBUG="" + ;; + *) echo "Bad argument $OPTIONDEBUG" + OPTIONDEBUG="" + ;; + esac +fi + # Internal params -RUN_CMD="./wrsAlarmMIB -f -x tcp:localhost:705" +RUN_CMD="./wrsAlarmMIB ${OPTIONDEBUG} -f -x tcp:localhost:705" # Launch $RUN_CMD diff --git a/stx-snmp-helm/centos/docker/stx-snmp/Dockerfile b/stx-snmp-helm/centos/docker/stx-snmp/Dockerfile index 549eb24..97ebf99 100755 --- a/stx-snmp-helm/centos/docker/stx-snmp/Dockerfile +++ b/stx-snmp-helm/centos/docker/stx-snmp/Dockerfile @@ -5,8 +5,8 @@ RUN yum -y install \ net-snmp-libs \ net-snmp-devel \ libuuid\ - gcc\ - make + gcc\ + make RUN ln -s /usr/lib64/libuuid.so.1.3.0 /usr/lib64/libuuid.so WORKDIR /home COPY ./src/* /home/src/ @@ -17,13 +17,13 @@ FROM centos:8 RUN yum -y update RUN yum -y upgrade RUN yum -y install\ - net-snmp \ - net-snmp-utils \ - net-snmp-libs + net-snmp \ + net-snmp-utils \ + net-snmp-libs COPY ./mibs/* /usr/share/snmp/mibs/ COPY --from=builder /home/src/libsnmpAuditPlugin.so /usr/lib64/ EXPOSE 161/udp EXPOSE 162/udp EXPOSE 705/tcp -CMD [ "/usr/sbin/snmpd", "-f"] +CMD /usr/sbin/snmpd $OPTIONDEBUG -f diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml index 2487d26..c1215d7 100755 --- a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml @@ -34,6 +34,9 @@ spec: protocol: UDP - containerPort: 705 protocol: TCP + env: + - name: "OPTIONDEBUG" + value: {{ .Values.image.debug }} # Issues with liveness and readiness: https://bit.ly/3nVRQrL # K8s issue related: https://github.com/kubernetes/kubernetes/issues/81713 # @@ -62,6 +65,9 @@ spec: volumeMounts: - name: snmpd-fm-volume mountPath: /etc/fm/ + env: + - name: "OPTIONDEBUG" + value: {{ .Values.image.debug }} # Fail on liveness and readiness as here: https://bit.ly/3nVRQrL # K8s issue related: https://github.com/kubernetes/kubernetes/issues/81713 # @@ -95,6 +101,9 @@ spec: ports: - containerPort: 162 protocol: TCP + env: + - name: "OPTIONDEBUG" + value: {{ .Values.image.debug }} # Fail on liveness and readiness as here: https://bit.ly/3nVRQrL # K8s issue related: https://github.com/kubernetes/kubernetes/issues/81713 # diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml index a7645e6..eeecc93 100755 --- a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml @@ -6,16 +6,17 @@ replicaCount: 1 image: repository: registry.local:9001/docker.io/starlingx/stx-snmp - tag: stx.5.0-1.0.0 + tag: stx.5.0-1.0.1 pullPolicy: IfNotPresent subagent_name: sub-agent repository_subagent: registry.local:9001/docker.io/starlingx/stx-fm-subagent - tag_subagent: stx.5.0-1.0.0 + tag_subagent: stx.5.0-1.0.1 pullPolicy_subagent: IfNotPresent trap_subagent_name: trap-subagent repository_trap_subagent: registry.local:9001/docker.io/starlingx/stx-fm-trap-subagent - tag_trap_subagent: stx.5.0-1.0.0 + tag_trap_subagent: stx.5.0-1.0.1 pullPolicy_trap_subagent: IfNotPresent + debug: '' nameOverride: "" fullnameOverride: ""