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

feat: Autogenerate random API Key with helm install if not passed #740

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions charts/apisix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ The command removes all the Kubernetes components associated with the chart and
| affinity | object | `{}` | Set affinity for Apache APISIX deploy |
| apisix.admin.allow.ipList | list | `["127.0.0.1/24"]` | The client IP CIDR allowed to access Apache APISIX Admin API service. |
| apisix.admin.cors | bool | `true` | Admin API support CORS response headers |
| apisix.admin.credentials | object | `{"admin":"edd1c9f034335f136f87ad84b625c8f1","secretName":"","viewer":"4054f7cf07e344346cd3f287985e76a2"}` | Admin API credentials |
| apisix.admin.credentials.admin | string | `"edd1c9f034335f136f87ad84b625c8f1"` | Apache APISIX admin API admin role credentials |
| apisix.admin.credentials | object | `{"admin":"","secretName":"","viewer":"4054f7cf07e344346cd3f287985e76a2"}` | Admin API credentials |
| apisix.admin.credentials.admin | string | `""` | Apache APISIX admin API admin role credentials. This is autogenerated with helm install if not passed. You can check configmap after deploying the helm chart to get the value. |
| apisix.admin.credentials.secretName | string | `""` | The APISIX Helm chart supports storing user credentials in a secret. The secret needs to contain two keys, admin and viewer, with their respective values set. |
| apisix.admin.credentials.viewer | string | `"4054f7cf07e344346cd3f287985e76a2"` | Apache APISIX admin API viewer role credentials |
| apisix.admin.enabled | bool | `true` | Enable Admin API |
Expand Down
2 changes: 2 additions & 0 deletions charts/apisix/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ data:
- name: "admin"
{{- if .Values.apisix.admin.credentials.secretName }}
key: ${{"{{"}}APISIX_ADMIN_KEY{{"}}"}}
{{- else if eq .Values.apisix.admin.credentials.admin "" }}
key: {{ randAlphaNum 32 }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do users know the key? You need to add a prompt output.

Perhaps managing admin-key through a secret would be more appropriate.
What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is in the confimap. Users can look at the configmap using kubectl to look at the key. Is there an issue there?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can write how to get the key in the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it regenerated when upgrading the version?

{{- else }}
key: {{ .Values.apisix.admin.credentials.admin }}
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions charts/apisix/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ apisix:
cors: true
# -- Admin API credentials
credentials:
# -- Apache APISIX admin API admin role credentials
admin: edd1c9f034335f136f87ad84b625c8f1
# -- Apache APISIX admin API admin role credentials. This is autogenerated with helm install if not passed. You can check configmap after deploying the helm chart to get the value.
admin: ''
# -- Apache APISIX admin API viewer role credentials
viewer: 4054f7cf07e344346cd3f287985e76a2

Expand Down
Loading