Skip to content

Commit

Permalink
add ingress addon (kubernetes#695)
Browse files Browse the repository at this point in the history
* add ingress addons and third party resource

* address comments
  • Loading branch information
mqliang authored and keontang committed Feb 7, 2017
1 parent 63b4e0f commit 935e206
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 6 deletions.
6 changes: 6 additions & 0 deletions cluster/caicloud-ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ dns_setup: true
# Turn to false to disable kubepush
kube_push: true

# Turn to false to disable ingress
cluster_ingress: true

# Number of dns replicas.
dns_replicas: 1

Expand Down Expand Up @@ -169,6 +172,9 @@ monitoring_image_grafana: "index.caicloud.io/caicloud/monitoring-grafana:v3.1.0-
monitoring_image_watcher: "index.caicloud.io/caicloud/monitoring-watcher:v1.0.0-rc2"
monitoring_image_server: "index.caicloud.io/caicloud/monitoring-server:v1.0.0-rc2"
kubepush_image_kubepush: "index.caicloud.io/caicloud/kubepush:v0.0.1"
ingress_keepalivd_image: "index.caicloud.io/caicloud/ingress-keepalived-vip:v0.0.1"
ingress_nginx_image: "index.caicloud.io/caicloud/nginx-ingress-controller:v0.0.1"
ingress_loadbalancer_controller_image: "index.caicloud.io/caicloud/loadbalancer-controller:v0.0.1"

# Main ports for etcd.
etcd_client_port: 2379
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
metadata:
name: push.k8s.io
apiVersion: extensions/v1beta1
kind: ThirdPartyResource
description: "Allow user to commit and push a container to registry"
versions:
- name: v1
kind: ThirdPartyResourceList
items:
- apiVersion: extensions/v1beta1
kind: ThirdPartyResource
metadata:
name: push.k8s.io
description: "Allow user to commit and push a container to registry"
versions:
- name: v1
- apiVersion: extensions/v1beta1
kind: ThirdPartyResource
metadata:
name: loadbalancerclaim.k8s.io
description: "Allow user to claim a loadbalancer instance"
versions:
- name: v1
- apiVersion: extensions/v1beta1
kind: ThirdPartyResource
metadata:
name: loadbalancer.k8s.io
description: "Allow user to CURD a loadbalancer instance"
versions:
- name: v1
16 changes: 16 additions & 0 deletions cluster/caicloud-ansible/roles/kubernetes-addons/tasks/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# Install ingress-loadbalancer-controller addon.

- name: Ingress | Mare sure ingress direcotry exists
file: path={{ kube_addons_dir }}/ingress state=directory

- name: Ingress | Write ingress-lb-controller template from converted saltfiles
template:
args:
src: "ingress/{{ item }}.j2"
dest: "{{ kube_addons_dir }}/ingress/{{ item }}"
mode: 0644
owner: root
group: root
with_items:
- ingress-lb-rc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
- include: kubepush.yml
when: kube_push

- include: ingress.yml
when: cluster_ingress

- name: Install required packages and addon scripts
include: generic-install.yml

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: v1
kind: ReplicationController
metadata:
namespace: "kube-system"
name: "ingress-loadbalancer-controller"
labels:
k8s-app: ingress-loadbalancer-controller
kubernetes.io/cluster-service: "true"
kubernetes-admin.caicloud.io/type: application
kubernetes-admin.caicloud.io/application: ingress-loadbalancer-controller
spec:
replicas: 1
selector:
k8s-app: ingress-loadbalancer-controller
kubernetes.io/cluster-service: "true"
kubernetes-admin.caicloud.io/type: application
kubernetes-admin.caicloud.io/application: ingress-loadbalancer-controller
template:
metadata:
labels:
k8s-app: ingress-loadbalancer-controller
kubernetes.io/cluster-service: "true"
kubernetes-admin.caicloud.io/type: application
kubernetes-admin.caicloud.io/application: ingress-loadbalancer-controller
spec:
containers:
- image: {{ ingress_loadbalancer_controller_image }}
imagePullPolicy: "Always"
name: "loadbalancer-claim-controller"
resources:
limits:
cpu: 100m
memory: 100Mi
requests:
cpu: 100m
memory: 100Mi
env:
- name: INGRESS_KEEPALIVED_IMAGE
value: {{ ingress_keepalivd_image }}
- name: INGRESS_NGINX_IMAGE
value: {{ ingress_nginx_image }}

0 comments on commit 935e206

Please sign in to comment.