Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

helm chart: Installation with non privileged port as non root user

未关闭
#1,438 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
go, helm, kubernetes, mysql

调研方向

从 Helm chart/ 开始,跟踪 INSTALL_PORT 从 values.yaml 和 pod 环境进入 /data/conf/config.yaml 的过程。将 service.port 和 INSTALL_PORT 设置为 8080 来复现部署,然后验证 server.http.addr 和 swaggerui.address 都使用 8080,并且 pod 启动时不会进入崩溃循环。

由索引模型根据 Issue 内容生成。

描述

bug

Describe the bug

If helm chart is deployed to use a non privileged port Apache Answer writes wrong port into config file.

To Reproduce

Steps to reproduce the behavior:

  1. Deploy a MySQL database, create a database and a database user
  2. Create a Kubernetes secret: kubectl create secret generic answer-secrets --from-literal=db-user=apacheanswer --from-literal=db-password=... --from-literal=admin-user=... --from-literal=admin-password=... --from-literal=admin-email=...
  3. Prepare values.yaml:
# Overridden values for https://github.com/apache/answer/tree/main/charts

replicaCount: 1

# Environment variables
# Configure environment variables below
# https://answer.apache.org/docs/env
env:
  - name: INSTALL_PORT
    value: "8080"
  - name: LOG_LEVEL
    # [DEBUG INFO WARN ERROR]
    value: "INFO"
  # uncomment the below values to use AUTO_INSTALL and not have to go through the setup process.
  # Once used to do the initial setup, these variables won't be used moving forward.
  # You must at a minimum comment AUTO_INSTALL after initial setup to prevent an error about the database already being initiated.
  - name: AUTO_INSTALL
    value: "true"
  - name: DB_TYPE
    value: "mysql"
  - name: DB_HOST
    value: mysql
  - name: DB_NAME
    value: apacheanswer
  - name: DB_USERNAME
    valueFrom:
      secretKeyRef:
        name: answer-secrets
        key: db-user
  - name: DB_PASSWORD
    valueFrom:
      secretKeyRef:
        name: answer-secrets
        key: db-password
  - name: LANGUAGE
    value: "en-US"
  - name: SITE_NAME
    value: "The Unhandled Exception"
  - name: SITE_URL
    value: "https://example.org"
  - name: ADMIN_NAME
    valueFrom:
      secretKeyRef:
        name: answer-secrets
        key: admin-user
  - name: ADMIN_PASSWORD
    valueFrom:
      secretKeyRef:
        name: answer-secrets
        key: admin-password
  - name: ADMIN_EMAIL
    valueFrom:
      secretKeyRef:
        name: answer-secrets
        key: admin-email

# Persistence for the /data volume
# Without persistence, your uploads and config.yaml will not be remembered between restarts.
persistence:
  enabled: true
  accessMode: ReadWriteMany
  size: 50Gi

podSecurityContext:
  fsGroup: 1000

securityContext:
  capabilities:
    drop:
    - ALL
  readOnlyRootFilesystem: true
  runAsNonRoot: true
  runAsUser: 1000
  runAsGroup: 1000

service:
  # Switch to port 8080 as we are running with as non-root
  port: 8080

ingress:
  enabled: true
  className: "haproxy"
  hosts:
    - host: example.org
      paths:
        - path: /
          pathType: ImplementationSpecific
  tls: []

resources:
  requests:
    cpu: 1
    memory: 1Gi

autoscaling:
  enabled: false
  minReplicas: 1
  maxReplicas: 100
  targetCPUUtilizationPercentage: 80
  # targetMemoryUtilizationPercentage: 80

  1. Deploy the chart: helm upgrade apache-answer chart/ -f values.yaml --install
  2. Open the WebUI via the configured ingress

Actual behavior

  • Pod generated an invalid config (using port 80 instead of the configured 8080)
  • Then pod tries to restarts
  • The pod ends in a crash loop
Generated config file
apache-answer-645c989c98-qv7pm:/# cat /data/conf/config.yaml 
debug: false
server:
  http:
    addr: 0.0.0.0:80
data:
  database:
    driver: mysql
    connection: user:password@tcp(mysql:3306)/apacheanswer
  cache:
    file_path: /data/cache/cache.db
i18n:
  bundle_dir: /data/i18n
service_config:
  upload_path: /data/uploads
  clean_up_uploads: true
  clean_orphan_uploads_period_hours: 48
  purge_deleted_files_period_days: 30
swaggerui:
  show: true
  protocol: http
  host: 127.0.0.1
  address: :80
ui:
  base_url: ""
  api_base_url: ""

Expected behavior

  • Config declares pod 8080
server:
  http:
    addr: 0.0.0.0:8080
swaggerui:
  address: :8080
  • Apache Answer is configured correctly and starts properly.

Platform

  • Device: Kubernetes
  • OS: n/a
  • Browser and version: n/a
  • Version: v1.7.0
主要语言
Go
星标
15.7k
派生
1.4k
平均合并
1 天 20 小时
30 天内合并 PR
6

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/answer 的其他 Issue

查看 apache/answer 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。