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

Move port config back to viper #1465

Open
motatoes opened this issue May 15, 2024 · 0 comments
Open

Move port config back to viper #1465

motatoes opened this issue May 15, 2024 · 0 comments

Comments

@motatoes
Copy link
Contributor

#1464 ships a quick fix for #1456 port issue. However there is an underlying problem with viper port loading that I was not able to rootcause yet which is causing port to be pulled as "0" be default from the config object. This has only been reproduced in a k8s environment with a config such as:

apiVersion: v1
kind: Service
metadata:
  name: digger
  namespace: digger
spec:
  ports:
  - port: 80
    targetPort: 3000
    protocol: TCP
  selector:
    app: digger
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: digger
  name: digger
  namespace: digger
spec:
  replicas: 1
  selector:
    matchLabels:
      app: digger
  template:
    metadata:
      labels:
        app: digger
    spec:
      containers:
      - env:
        - name: HOSTNAME
          value: http://localhost:3000
        - name: well
          value: "abc"

        - name: ALLOW_DIRTY
          value: "true"
        - name: GITHUB_ORG
          value: xxxx
        - name: BEARER_AUTH_TOKEN
          value: sadfasdfasd
        - name: DATABASE_URL
          value: postgres://postgres:root@mypostgresinstance/postgres?sslmode=disable
        - name: HTTP_BASIC_AUTH
          value: "1"
        - name: HTTP_BASIC_AUTH_USERNAME
          value: xxxx
        - name: HTTP_BASIC_AUTH_PASSWORD
          value: "sdfasdfsdf"            
        - name: DIGGER_MAX_CONCURRENCY_PER_BATCH
          value: "1"
        image: registry.digger.dev/diggerhq/digger_backend:v0.4.26
        name: backend
        ports:
        - containerPort: 3000

And when the service starts it is being loaded as port "0" when we try to fetch it from viper config - currently only reproduced in a k8s environment but not in docker-compose or binary environments. Need to dig into the viper config/config.go and figure out whats going on causing this 0 value in port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant