tokers commented on code in PR #278: URL: https://github.com/apache/apisix-helm-chart/pull/278#discussion_r939755762
########## charts/apisix/templates/clusterrole.yaml: ########## @@ -0,0 +1,42 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{- $kubernetesTokenFile := "/var/run/secrets/kubernetes.io/serviceaccount/token" -}} Review Comment: Let's call it `defaultKubernetesTokenPath`. It would be more readable. ########## charts/apisix/values.yaml: ########## @@ -121,11 +121,10 @@ nameOverride: "" fullnameOverride: "" serviceAccount: - create: true + create: false # Set to `true` to create ServiceAccount for Kubernetes service discovery. Review Comment: We should know the consequence that we change the default value to `false`. ########## charts/apisix/templates/clusterrolebinding.yaml: ########## @@ -0,0 +1,46 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{- $kubernetesTokenFile := "/var/run/secrets/kubernetes.io/serviceaccount/token" -}} Review Comment: This can be put in a `tpl` file? ########## charts/apisix/templates/clusterrole.yaml: ########## @@ -0,0 +1,42 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{- $kubernetesTokenFile := "/var/run/secrets/kubernetes.io/serviceaccount/token" -}} +{{- $create := false -}} +{{- if .Values.discovery.enabled -}} +{{- with .Values.discovery.registry -}} +{{- if hasKey . "kubernetes" -}} +{{- if .kubernetes.client -}} +{{- if eq .kubernetes.client.token_file $kubernetesTokenFile -}} +{{- $create = true -}} Review Comment: So if users specify a custom token path, how does it work via our helm chart? ########## charts/apisix/templates/clusterrolebinding.yaml: ########## @@ -0,0 +1,46 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{- $kubernetesTokenFile := "/var/run/secrets/kubernetes.io/serviceaccount/token" -}} Review Comment: So that we can avoid writing them duplicately. ########## charts/apisix/values.yaml: ########## @@ -290,26 +293,42 @@ extraVolumeMounts: [] discovery: enabled: false - registry: - # Integration service discovery registry. E.g eureka\dns\nacos\consul_kv - # reference: - # https://apisix.apache.org/docs/apisix/discovery#configuration-for-eureka - # https://apisix.apache.org/docs/apisix/discovery/dns#service-discovery-via-dns - # https://apisix.apache.org/docs/apisix/discovery/consul_kv#configuration-for-consul-kv - # https://apisix.apache.org/docs/apisix/discovery/nacos#configuration-for-nacos - # - # an eureka example: - # eureka: - # host: - # - "http://${username}:${password}@${eureka_host1}:${eureka_port1}" - # - "http://${username}:${password}@${eureka_host2}:${eureka_port2}" - # prefix: "/eureka/" - # fetch_interval: 30 - # weight: 100 - # timeout: - # connect: 2000 - # send: 2000 - # read: 5000 + registry: {} + # Integration service discovery registry. E.g eureka\dns\nacos\consul_kv + # reference: + # https://apisix.apache.org/docs/apisix/discovery/#configuration-for-eureka + # https://apisix.apache.org/docs/apisix/discovery/dns/#service-discovery-via-dns + # https://apisix.apache.org/docs/apisix/discovery/consul_kv/#configuration-for-consul-kv + # https://apisix.apache.org/docs/apisix/discovery/nacos/#configuration-for-nacos + # https://apisix.apache.org/docs/apisix/discovery/kubernetes/#configuration + # + # an eureka example: + # ``` + # eureka: + # host: + # - "http://${username}:${password}@${eureka_host1}:${eureka_port1}" + # - "http://${username}:${password}@${eureka_host2}:${eureka_port2}" + # prefix: "/eureka/" + # fetch_interval: 30 + # weight: 100 + # timeout: + # connect: 2000 + # send: 2000 + # read: 5000 + # ``` + # + # the minimal Kubernetes example: + # ``` + # kubernetes: {} + # ``` + # + # The prerequisites for the above minimal Kubernetes example: + # 1. Set `.serviceAccount.create` (L124) to `true` to create the ServiceAccount with required permissions. + # This is for allowing the default `.discovery.registry.kubernetes.client.token_file`. + # 2. Add the following environment variables into `.nginx.envs` (L196) to pass into nginx worker processes: + # - KUBERNETES_SERVICE_HOST + # - KUBERNETES_SERVICE_PORT + # This is for allowing the default `host` and `port` of `.discovery.registry.kubernetes.service`. Review Comment: Let's add a hyperlink to https://apisix.apache.org/docs/apisix/discovery/kubernetes/, so that users can see the reference for each field. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
