mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-29 12:53:53 +00:00
Implement Azure cloud provider scripts
Implement basic cloud provider functionality to deploy Kubernetes on Azure. SaltStack is used to deploy Kubernetes on top of Ubuntu virtual machines. OpenVpn provides network connectivity. For kubelet authentication, we use basic authentication (username and password). The scripts use the legacy Azure Service Management APIs. We have set up a nightly test job in our Jenkins server for federated testing to run the e2e test suite on Azure. With the cloud provider scripts in this commit, 14 e2e test cases pass in this environment. We plan to implement additional Azure functionality to support more test cases.
This commit is contained in:
64
cluster/saltbase/salt/nginx/init.sls
Normal file
64
cluster/saltbase/salt/nginx/init.sls
Normal file
@@ -0,0 +1,64 @@
|
||||
nginx:
|
||||
pkg:
|
||||
- installed
|
||||
|
||||
/etc/nginx/nginx.conf:
|
||||
file:
|
||||
- managed
|
||||
- source: salt://nginx/nginx.conf
|
||||
- template: jinja
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 644
|
||||
|
||||
/etc/nginx/sites-enabled/default:
|
||||
file:
|
||||
- managed
|
||||
- makedirs: true
|
||||
- source: salt://nginx/kubernetes-site
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 644
|
||||
|
||||
/usr/share/nginx/htpasswd:
|
||||
file:
|
||||
- managed
|
||||
- source: salt://nginx/htpasswd
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 644
|
||||
|
||||
{% if grains.cloud is defined and grains.cloud in ['gce'] %}
|
||||
/etc/kubernetes/manifests/nginx.json:
|
||||
file:
|
||||
- managed
|
||||
- source: salt://nginx/nginx.json
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 644
|
||||
- require:
|
||||
- file: /etc/nginx/nginx.conf
|
||||
- file: /etc/nginx/sites-enabled/default
|
||||
- file: /usr/share/nginx/htpasswd
|
||||
- cmd: kubernetes-cert
|
||||
|
||||
|
||||
#stop legacy nginx_service
|
||||
stop_nginx-service:
|
||||
service.dead:
|
||||
- name: nginx
|
||||
- enable: None
|
||||
|
||||
{% else %}
|
||||
nginx-service:
|
||||
service:
|
||||
- running
|
||||
- name: nginx
|
||||
- watch:
|
||||
- pkg: nginx
|
||||
- file: /etc/nginx/nginx.conf
|
||||
- file: /etc/nginx/sites-enabled/default
|
||||
- file: /usr/share/nginx/htpasswd
|
||||
- cmd: kubernetes-cert
|
||||
{% endif %}
|
||||
|
||||
66
cluster/saltbase/salt/nginx/kubernetes-site
Normal file
66
cluster/saltbase/salt/nginx/kubernetes-site
Normal file
@@ -0,0 +1,66 @@
|
||||
#server {
|
||||
#listen 80; ## listen for ipv4; this line is default and implied
|
||||
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
|
||||
|
||||
# root /usr/share/nginx/www;
|
||||
# index index.html index.htm;
|
||||
|
||||
# Make site accessible from http://localhost/
|
||||
# server_name localhost;
|
||||
# location / {
|
||||
# auth_basic "Restricted";
|
||||
# auth_basic_user_file /usr/share/nginx/htpasswd;
|
||||
|
||||
# Proxy settings.
|
||||
# proxy_pass http://localhost:8080/;
|
||||
# proxy_connect_timeout 159s;
|
||||
# proxy_send_timeout 600s;
|
||||
# proxy_read_timeout 600s;
|
||||
# proxy_buffer_size 64k;
|
||||
# proxy_buffers 16 32k;
|
||||
# proxy_busy_buffers_size 64k;
|
||||
# proxy_temp_file_write_size 64k;
|
||||
# }
|
||||
#}
|
||||
|
||||
# HTTPS server
|
||||
#
|
||||
server {
|
||||
listen 443;
|
||||
server_name localhost;
|
||||
|
||||
root html;
|
||||
index index.html index.htm;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /srv/kubernetes/server.cert;
|
||||
ssl_certificate_key /srv/kubernetes/server.key;
|
||||
|
||||
ssl_session_timeout 5m;
|
||||
|
||||
# don't use SSLv3 because of POODLE
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
location / {
|
||||
auth_basic "Restricted";
|
||||
auth_basic_user_file /usr/share/nginx/htpasswd;
|
||||
|
||||
# Proxy settings
|
||||
# disable buffering so that watch works
|
||||
proxy_buffering off;
|
||||
proxy_pass http://127.0.0.1:8080/;
|
||||
proxy_connect_timeout 159s;
|
||||
proxy_send_timeout 600s;
|
||||
proxy_read_timeout 600s;
|
||||
|
||||
# Disable retry
|
||||
proxy_next_upstream off;
|
||||
|
||||
# Support web sockets
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
61
cluster/saltbase/salt/nginx/nginx.conf
Normal file
61
cluster/saltbase/salt/nginx/nginx.conf
Normal file
@@ -0,0 +1,61 @@
|
||||
{% if grains['os_family'] == 'RedHat' %}
|
||||
user nginx;
|
||||
{% else %}
|
||||
user www-data;
|
||||
{% endif %}
|
||||
|
||||
worker_processes 4;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
# multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
##
|
||||
# Basic Settings
|
||||
##
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
# server_tokens off;
|
||||
|
||||
# server_names_hash_bucket_size 64;
|
||||
# server_name_in_redirect off;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
##
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
# gzip_vary on;
|
||||
# gzip_proxied any;
|
||||
# gzip_comp_level 6;
|
||||
# gzip_buffers 16 8k;
|
||||
# gzip_http_version 1.1;
|
||||
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
##
|
||||
# Virtual Host Configs
|
||||
##
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
}
|
||||
60
cluster/saltbase/salt/nginx/nginx.json
Normal file
60
cluster/saltbase/salt/nginx/nginx.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Pod",
|
||||
"metadata": {"name":"nginx"},
|
||||
"spec":{
|
||||
"hostNetwork": true,
|
||||
"containers":[
|
||||
{
|
||||
"name": "nginx",
|
||||
"image": "gcr.io/google-containers/nginx:v1",
|
||||
"resources": {
|
||||
"limits": {
|
||||
"cpu": "200m"
|
||||
}
|
||||
},
|
||||
"command": [
|
||||
"nginx",
|
||||
"-g",
|
||||
"daemon off;"
|
||||
],
|
||||
"ports":[
|
||||
{ "name": "https",
|
||||
"containerPort": 443,
|
||||
"hostPort": 443}
|
||||
],
|
||||
"volumeMounts": [
|
||||
{ "name": "nginx",
|
||||
"mountPath": "/etc/nginx",
|
||||
"readOnly": true},
|
||||
{ "name": "k8s",
|
||||
"mountPath": "/srv/kubernetes",
|
||||
"readOnly": true},
|
||||
{ "name": "logs",
|
||||
"mountPath": "/var/log/nginx",
|
||||
"readOnly": false},
|
||||
{ "name": "passwd",
|
||||
"mountPath": "/usr/share/nginx",
|
||||
"readOnly": true}
|
||||
]
|
||||
}
|
||||
],
|
||||
"volumes":[
|
||||
{ "name": "nginx",
|
||||
"hostPath": {
|
||||
"path": "/etc/nginx"}
|
||||
},
|
||||
{ "name": "k8s",
|
||||
"hostPath": {
|
||||
"path": "/srv/kubernetes"}
|
||||
},
|
||||
{ "name": "passwd",
|
||||
"hostPath": {
|
||||
"path": "/usr/share/nginx"}
|
||||
},
|
||||
{ "name": "logs",
|
||||
"hostPath": {
|
||||
"path": "/var/logs/nginx"}
|
||||
}
|
||||
]
|
||||
}}
|
||||
Reference in New Issue
Block a user