This is an automated email from the ASF dual-hosted git repository. kvn pushed a commit to branch kv/k8s-config in repository https://gitbox.apache.org/repos/asf/apisix.git
commit 8f3e4587c2e6dda847ab8512490bee3f7709aa47 Author: kv <gxt...@163.com> AuthorDate: Tue Sep 8 16:43:42 2020 +0800 fix: change the config file when deploying apisix in k8s #2182 --- kubernetes/README.md | 17 ++++++----------- kubernetes/apisix-gw-config-cm.yaml | 10 +++++++--- kubernetes/config.sh | 29 ----------------------------- 3 files changed, 13 insertions(+), 43 deletions(-) diff --git a/kubernetes/README.md b/kubernetes/README.md index 6a2212f..c060f84 100644 --- a/kubernetes/README.md +++ b/kubernetes/README.md @@ -21,16 +21,7 @@ There are some yaml files for deploying apisix in Kubernetes. ### Prerequisites -- use `etcd` , if there is no `etcd` service, please install and set env `etcd_url` in `config.sh` - -- Run `config.sh` to generate `apisix-gw-config-cm.yaml` from the latest `config.yaml` - -``` -# if config.sh have no permission to executethen, then execute `chmod +x config.sh` -# Generate apisix-gw-config-cm.yaml -# sh config.sh -``` - +- use `etcd` , if there is no `etcd` service, please install and set etcd address in `apisix-gw-config-cm.yaml` #### when using etcd-operator when using etcd-operator, you need to change apisix-gw-config-cm.yaml: @@ -57,11 +48,15 @@ etcd: #### Create configmap for apache apisix +you will change some config by use `apisix-gw-config-cm.yaml` + ``` $ kubectl apply -f apisix-gw-config-cm.yaml -or +``` +or, if you do not need to change any config, and use default config in `../conf/config.yaml` +``` $ kubectl create configmap apisix-gw-config.yaml --from-file=../conf/config.yaml ``` diff --git a/kubernetes/apisix-gw-config-cm.yaml b/kubernetes/apisix-gw-config-cm.yaml index e1d5022..0071c1c 100644 --- a/kubernetes/apisix-gw-config-cm.yaml +++ b/kubernetes/apisix-gw-config-cm.yaml @@ -16,10 +16,14 @@ # apiVersion: v1 -data: - config.yaml: | - #CONFIG_YAML# kind: ConfigMap metadata: name: apisix-gw-config.yaml # namespace: default +data: + config.yaml: | + etcd: + host: + - "http://127.0.0.1:2379" ## you can replace the etcd address here + + diff --git a/kubernetes/config.sh b/kubernetes/config.sh deleted file mode 100755 index 1f3c6eb..0000000 --- a/kubernetes/config.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# -# 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. -# - - -export etcd_url='http://$ETCD_IP_ADDRESS:2379' - -wget https://raw.githubusercontent.com/apache/apisix/master/conf/config.yaml - -sed -i -e ':a' -e 'N' -e '$!ba' -e "s/allow_admin[a-z: #\/._]*\n\( *- [0-9a-zA-Z: #\/._',]*\n*\)*//g" config.yaml - -sed -i -e "s%http://[0-9.]*:2379%`echo $etcd_url`%g" config.yaml - -sed -i -e '/#CONFIG_YAML#/{r config.yaml' -e 'd}' apisix-gw-config-cm.yaml -