Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-rc1 config file loading error #89

Closed
rolinux opened this issue Aug 24, 2022 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@rolinux
Copy link

rolinux commented Aug 24, 2022

Looks like ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-rc1 triggers the following error:

2022-08-24T12:06:46Z	fatal	cmd/mqtt2prometheus.go:80	Could not load config	{"error": "open config.yaml: no such file or directory"}
main.main
	/home/runner/work/mqtt2prometheus/mqtt2prometheus/cmd/mqtt2prometheus.go:80
runtime.main
	/opt/hostedtoolcache/go/1.19.0/x64/src/runtime/proc.go:250

Moving from latest to v0.1.6 image tag solved the problem.

I can help with further debug but the config file should be there as the helm chart didn't change.

Thank you,
Radu

@hikhvar
Copy link
Owner

hikhvar commented Aug 25, 2022

Hey,
thank you for this bug report. Since the 0.1.7-RC1 release is rather small, I think this problem is either caused by #88 or #84. Can you give me some more details how your deployment in the helm chart looks like?

@hikhvar hikhvar added the bug Something isn't working label Aug 25, 2022
@rolinux
Copy link
Author

rolinux commented Aug 26, 2022

# Source: mqtt2prom/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: release-name-mqtt2prom
  labels:
    helm.sh/chart: mqtt2prom-0.1.0
    app.kubernetes.io/name: mqtt2prom
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "0.1.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: mqtt2prom
      app.kubernetes.io/instance: release-name
  template:
    metadata:
      labels:
        app.kubernetes.io/name: mqtt2prom
        app.kubernetes.io/instance: release-name
    spec:
      securityContext:
        {}
      containers:
        - args:
          - /mqtt2prometheus
          - -config
          - /data/config.yaml
          - -log-level
          - debug
          name: mqtt2prom
          image: "ghcr.io/hikhvar/mqtt2prometheus:v0.1.6"
          imagePullPolicy: Always
          ports:
            - name: http
              containerPort: 9641
              protocol: TCP
          # livenessProbe:
          #   httpGet:
          #     path: 
          #     port: http
          #   initialDelaySeconds: 45
          #   periodSeconds: 30
          # readinessProbe:
          #   httpGet:
          #     path: 
          #     port: http
          #   initialDelaySeconds: 45
          #   periodSeconds: 10
          resources:
            limits:
              cpu: 100m
              memory: 128Mi
            requests:
              cpu: 100m
              memory: 128Mi
          volumeMounts:
          - name: mqtt2prom-config-secret-volume
            mountPath: /data/config.yaml
            subPath: config.yaml
            readOnly: true
      volumes:
      - name: mqtt2prom-config-secret-volume
        secret:
          secretName: mqtt2prom-config-secret

The config comes from a secret as the MQTT is password protected.

@hikhvar
Copy link
Owner

hikhvar commented Aug 26, 2022

Thank you for the feedback. Will look into it. Can't give a time frame yet.

@hikhvar
Copy link
Owner

hikhvar commented Sep 15, 2022

Ok, can reproduce your issue. I think this is relates to #84

% docker run -it -v /tmp/config.yaml:/data/config.yaml ghcr.io/hikhvar/mqtt2prometheus:v0.1.6 /mqtt2prometheus -config /data/config.yaml -log-level debug
2022-09-15T06:47:46Z	warn	cmd/mqtt2prometheus.go:134	could not connect to mqtt broker %s, sleep 10 second	{"error": "network Error : dial tcp 127.0.0.1:1883: connect: connection refused"}

% docker run -it -v /tmp/config.yaml:/data/config.yaml ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-RC1 /mqtt2prometheus -config /data/config.yaml -log-level debug
Unable to find image 'ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-RC1' locally
v0.1.7-RC1: Pulling from hikhvar/mqtt2prometheus
Digest: sha256:935bf9211a329df80ed11e348409e9facd9390ddb3fd7afc7291816ff0e1856a
Status: Downloaded newer image for ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-RC1
2022-09-15T07:06:49Z	fatal	cmd/mqtt2prometheus.go:80	Could not load config	{"error": "open config.yaml: no such file or directory"}
main.main
	/home/runner/work/mqtt2prometheus/mqtt2prometheus/cmd/mqtt2prometheus.go:80
runtime.main
	/opt/hostedtoolcache/go/1.19.0/x64/src/runtime/proc.go:250

If the leading /mqtt2prometheus is ommited, it works again:

docker run -it -v /tmp/config.yaml:/data/config.yaml ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-RC1 -config /data/config.yaml -log-level debug 
2022-09-15T07:08:56Z	warn	cmd/mqtt2prometheus.go:134	could not connect to mqtt broker %s, sleep 10 second	{"error": "network Error : dial tcp 127.0.0.1:1883: connect: connection refused"}

So I think, if you change your deployment to the following it should work again:

# Source: mqtt2prom/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: release-name-mqtt2prom
  labels:
    helm.sh/chart: mqtt2prom-0.1.0
    app.kubernetes.io/name: mqtt2prom
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "0.1.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: mqtt2prom
      app.kubernetes.io/instance: release-name
  template:
    metadata:
      labels:
        app.kubernetes.io/name: mqtt2prom
        app.kubernetes.io/instance: release-name
    spec:
      securityContext:
        {}
      containers:
        - args:
          - -config
          - /data/config.yaml
          - -log-level
          - debug
          name: mqtt2prom
          image: "ghcr.io/hikhvar/mqtt2prometheus:v0.1.7-RC1"
          imagePullPolicy: Always
          ports:
            - name: http
              containerPort: 9641
              protocol: TCP
          # livenessProbe:
          #   httpGet:
          #     path: 
          #     port: http
          #   initialDelaySeconds: 45
          #   periodSeconds: 30
          # readinessProbe:
          #   httpGet:
          #     path: 
          #     port: http
          #   initialDelaySeconds: 45
          #   periodSeconds: 10
          resources:
            limits:
              cpu: 100m
              memory: 128Mi
            requests:
              cpu: 100m
              memory: 128Mi
          volumeMounts:
          - name: mqtt2prom-config-secret-volume
            mountPath: /data/config.yaml
            subPath: config.yaml
            readOnly: true
      volumes:
      - name: mqtt2prom-config-secret-volume
        secret:
          secretName: mqtt2prom-config-secret

@hikhvar
Copy link
Owner

hikhvar commented Dec 31, 2022

No response, assume this is fixed.

@hikhvar hikhvar closed this as completed Dec 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants