[opensuse] Enabling external loadbalancer feature

Adding config to enable OpenStack loadbalancer for Kubernetes
cluster as backend. By default we keep it disabled to avoid having
to inject the openstack credentials in the cluster always.

Change-Id: I02f690b220e933d492671f53724a604a167d5abb
This commit is contained in:
sayalilunkad 2017-04-13 15:47:27 +02:00
parent 4ad01cb867
commit 6a5d02c482
4 changed files with 20 additions and 7 deletions

View File

@ -37,14 +37,14 @@ sed -i '
sed -i ' sed -i '
/^KUBE_API_ADDRESS=/ s|=.*|="--advertise-address='"$KUBE_NODE_IP"' --insecure-bind-address=0.0.0.0 --bind_address=0.0.0.0"| /^KUBE_API_ADDRESS=/ s|=.*|="--advertise-address='"$KUBE_NODE_IP"' --insecure-bind-address=0.0.0.0 --bind_address=0.0.0.0"|
/^KUBE_SERVICE_ADDRESSES=/ s|=.*|="--service-cluster-ip-range='"$PORTAL_NETWORK_CIDR"'"| /^KUBE_SERVICE_ADDRESSES=/ s|=.*|="--service-cluster-ip-range='"$PORTAL_NETWORK_CIDR"'"|
/^KUBE_API_ARGS=/ s|=.*|="'"$KUBE_API_ARGS"'"| /^KUBE_API_ARGS=/ s|=.*|="--service-account-key-file='"$SERVICE_ACCOUNT_KEY"' --runtime-config=api\/all=true"|
/^KUBE_ETCD_SERVERS=/ s/=.*/="--etcd-servers=http:\/\/127.0.0.1:2379"/ /^KUBE_ETCD_SERVERS=/ s/=.*/="--etcd-servers=http:\/\/127.0.0.1:2379"/
/^KUBE_ADMISSION_CONTROL=/ s/=.*/="--admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota"/ /^KUBE_ADMISSION_CONTROL=/ s/=.*/="--admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota"/
' /etc/kubernetes/apiserver ' /etc/kubernetes/apiserver
cat >> /etc/kubernetes/apiserver <<EOF cat >> /etc/kubernetes/apiserver <<EOF
#Uncomment the following line to enable Load Balancer feature #Uncomment the following line to enable Load Balancer feature
#KUBE_API_ARGS="--runtime-config=api/all=true --cloud-config=/etc/sysconfig/kubernetes_openstack_config --cloud-provider=openstack" #KUBE_API_ARGS="--service-account-key-file='"$SERVICE_ACCOUNT_KEY"' --runtime-config=api\/all=true" --runtime-config=api\/all=true --cloud-config=/etc/sysconfig/kubernetes_openstack_config --cloud-provider=openstack"
EOF EOF
sed -i ' sed -i '
@ -52,19 +52,20 @@ sed -i '
' /etc/kubernetes/controller-manager ' /etc/kubernetes/controller-manager
cat >> /etc/kubernetes/controller-manager <<EOF cat >> /etc/kubernetes/controller-manager <<EOF
#Uncomment the following line to enable Load Balancer feature
#Uncomment the following line to enable Kubernetes Load Balancer feature #KUBE_CONTROLLER_MANAGER_ARGS="--service_account_private_key_file='"$SERVICE_ACCOUNT_KEY"' --leader-elect=true --cluster-name=kubernetes --cluster-cidr='"$FLANNEL_NETWORK_CIDR"' --cloud-config=/etc/sysconfig/kubernetes_openstack_config --cloud-provider=openstack"
#KUBE_CONTROLLER_MANAGER_ARGS="--cloud-config=/etc/sysconfig/kubernetes_openstack_config --cloud-provider=openstack"
EOF EOF
# Generate a the configuration for Kubernetes services to talk to OpenStack Neutron # Generate a the configuration for Kubernetes services to talk to OpenStack Neutron
cat > /etc/sysconfig/kubernetes_openstack_config <<EOF cat > /etc/sysconfig/kubernetes_openstack_config <<EOF
[Global] [Global]
auth-url=$AUTH_URL auth-url=$AUTH_URL
Username=$USERNAME username=$USERNAME
Password=$PASSWORD password=$PASSWORD
tenant-name=$TENANT_NAME tenant-name=$TENANT_NAME
domain-name=$DOMAIN_NAME
[LoadBalancer] [LoadBalancer]
lb-version=v2
subnet-id=$CLUSTER_SUBNET subnet-id=$CLUSTER_SUBNET
create-monitor=yes create-monitor=yes
monitor-delay=1m monitor-delay=1m

View File

@ -35,3 +35,4 @@ write_files:
TRUSTEE_USER_ID="$TRUSTEE_USER_ID" TRUSTEE_USER_ID="$TRUSTEE_USER_ID"
TRUSTEE_PASSWORD="$TRUSTEE_PASSWORD" TRUSTEE_PASSWORD="$TRUSTEE_PASSWORD"
TRUST_ID="$TRUST_ID" TRUST_ID="$TRUST_ID"
DOMAIN_NAME="$DOMAIN_NAME"

View File

@ -305,6 +305,11 @@ parameters:
default: "" default: ""
hidden: true hidden: true
domain_name:
type: string
description: domain_name
default: ""
resources: resources:
###################################################################### ######################################################################
@ -555,6 +560,7 @@ resources:
trustee_user_id: {get_param: trustee_user_id} trustee_user_id: {get_param: trustee_user_id}
trustee_password: {get_param: trustee_password} trustee_password: {get_param: trustee_password}
trust_id: {get_param: trust_id} trust_id: {get_param: trust_id}
domain_name: {get_param: domain_name}
###################################################################### ######################################################################
# #

View File

@ -195,6 +195,10 @@ parameters:
description: id of the trust which is used by the trustee description: id of the trust which is used by the trustee
hidden: true hidden: true
domain_name:
type: string
description: domain name
resources: resources:
master_wait_handle: master_wait_handle:
@ -255,6 +259,7 @@ resources:
"$TRUSTEE_USER_ID": {get_param: trustee_user_id} "$TRUSTEE_USER_ID": {get_param: trustee_user_id}
"$TRUSTEE_PASSWORD": {get_param: trustee_password} "$TRUSTEE_PASSWORD": {get_param: trustee_password}
"$TRUST_ID": {get_param: trust_id} "$TRUST_ID": {get_param: trust_id}
"$DOMAIN_NAME": {get_param: domain_name}
make_cert: make_cert:
type: OS::Heat::SoftwareConfig type: OS::Heat::SoftwareConfig