Parcourir la source

Merge remote-tracking branch 'openshift/master'

Diego Castro il y a 9 ans
Parent
commit
d54665d0c0
44 fichiers modifiés avec 935 ajouts et 230 suppressions
  1. 6 6
      README_openstack.md
  2. 6 0
      inventory/byo/hosts.example
  3. 13 0
      playbooks/aws/openshift-cluster/tasks/launch_instances.yml
  4. 2 0
      playbooks/common/openshift-master/config.yml
  5. 8 0
      playbooks/libvirt/openshift-cluster/launch.yml
  6. 3 2
      playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
  7. 24 18
      playbooks/openstack/openshift-cluster/files/heat_stack.yaml
  8. 11 22
      playbooks/openstack/openshift-cluster/launch.yml
  9. 0 27
      playbooks/openstack/openshift-cluster/tasks/configure_openstack.yml
  10. 2 6
      playbooks/openstack/openshift-cluster/vars.yml
  11. 36 0
      roles/openshift_cluster_metrics/README.md
  12. 53 0
      roles/openshift_cluster_metrics/files/cluster-metrics/grafana.yaml
  13. 4 0
      roles/openshift_cluster_metrics/files/cluster-metrics/heapster-serviceaccount.yaml
  14. 30 0
      roles/openshift_cluster_metrics/files/cluster-metrics/heapster.yaml
  15. 67 0
      roles/openshift_cluster_metrics/files/cluster-metrics/influxdb.yaml
  16. 50 0
      roles/openshift_cluster_metrics/tasks/main.yml
  17. 1 0
      roles/openshift_common/tasks/main.yml
  18. 1 0
      roles/openshift_examples/examples-sync.sh
  19. 13 8
      roles/openshift_examples/files/examples/db-templates/mongodb-ephemeral-template.json
  20. 16 10
      roles/openshift_examples/files/examples/db-templates/mongodb-persistent-template.json
  21. 11 7
      roles/openshift_examples/files/examples/db-templates/mysql-ephemeral-template.json
  22. 14 9
      roles/openshift_examples/files/examples/db-templates/mysql-persistent-template.json
  23. 11 7
      roles/openshift_examples/files/examples/db-templates/postgresql-ephemeral-template.json
  24. 14 9
      roles/openshift_examples/files/examples/db-templates/postgresql-persistent-template.json
  25. 11 11
      roles/openshift_examples/files/examples/image-streams/image-streams-centos7.json
  26. 32 9
      roles/openshift_examples/files/examples/image-streams/image-streams-rhel7.json
  27. 8 3
      roles/openshift_examples/files/examples/quickstart-templates/cakephp-mysql.json
  28. 2 2
      roles/openshift_examples/files/examples/quickstart-templates/cakephp.json
  29. 17 12
      roles/openshift_examples/files/examples/quickstart-templates/dancer-mysql.json
  30. 2 2
      roles/openshift_examples/files/examples/quickstart-templates/dancer.json
  31. 25 20
      roles/openshift_examples/files/examples/quickstart-templates/django-postgresql.json
  32. 2 2
      roles/openshift_examples/files/examples/quickstart-templates/django.json
  33. 145 0
      roles/openshift_examples/files/examples/quickstart-templates/jenkins-ephemeral-template.json
  34. 168 0
      roles/openshift_examples/files/examples/quickstart-templates/jenkins-persistent-template.json
  35. 20 15
      roles/openshift_examples/files/examples/quickstart-templates/nodejs-mongodb.json
  36. 2 2
      roles/openshift_examples/files/examples/quickstart-templates/nodejs.json
  37. 26 12
      roles/openshift_examples/files/examples/quickstart-templates/rails-postgresql.json
  38. 19 0
      roles/openshift_facts/library/openshift_facts.py
  39. 2 8
      roles/openshift_master/templates/master.yaml.v1.j2
  40. 4 0
      roles/openshift_node/defaults/main.yml
  41. 3 0
      roles/openshift_node/handlers/main.yml
  42. 45 1
      roles/openshift_node/tasks/main.yml
  43. 1 0
      roles/openshift_node/templates/node.yaml.v1.j2
  44. 5 0
      roles/openshift_node/templates/partials/kubeletArguments.j2

+ 6 - 6
README_openstack.md

@@ -25,20 +25,20 @@ Configuration
 
 The following options can be passed via the `-o` flag of the `create` command:
 
-* `image_name`: Name of the image to use to spawn VMs
-* `keypair` (default to `${LOGNAME}_key`): Name of the ssh key
-* `public_key` (default to `~/.ssh/id_rsa.pub`): filename of the ssh public key
-* `master_flavor` (default to `m1.small`): The ID or name of the flavor for the master
-* `node_flavor` (default to `m1.medium`): The ID or name of the flavor for the nodes
 * `infra_heat_stack` (default to `playbooks/openstack/openshift-cluster/files/heat_stack.yaml`): filename of the HEAT template to use to create the cluster infrastructure
 
 The following options are used only by `heat_stack.yaml`. They are so used only if the `infra_heat_stack` option is left with its default value.
 
+* `image_name`: Name of the image to use to spawn VMs
+* `public_key` (default to `~/.ssh/id_rsa.pub`): filename of the ssh public key
+* `master_flavor` (default to `m1.small`): The ID or name of the flavor for the master
+* `node_flavor` (default to `m1.medium`): The ID or name of the flavor for the compute nodes
+* `infra_flavor` (default to `m1.small`): The ID or name of the flavor for the infrastructure nodes
 * `network_prefix` (default to `openshift-ansible-<cluster_id>`): prefix prepended to all network objects (net, subnet, router, security groups)
 * `dns` (default to `8.8.8.8,8.8.4.4`): comma separated list of DNS to use
 * `net_cidr` (default to `192.168.<rand()>.0/24`): CIDR of the network created by `heat_stack.yaml`
 * `external_net` (default to `external`): Name of the external network to connect to
-* `floating_ip_pools` (default to `external`): comma separated list of floating IP pools
+* `floating_ip_pool` (default to `external`): comma separated list of floating IP pools
 * `ssh_from` (default to `0.0.0.0/0`): IPs authorized to connect to the VMs via ssh
 
 

+ 6 - 0
inventory/byo/hosts.example

@@ -20,6 +20,9 @@ ansible_ssh_user=root
 # deployment type valid values are origin, online and enterprise
 deployment_type=enterprise
 
+# Enable cluster metrics
+#use_cluster_metrics=true
+
 # Pre-release registry URL
 #oreg_url=rcm-img-docker01.build.eng.bos.redhat.com:5001/openshift3/ose-${component}:${version}
 
@@ -38,6 +41,9 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
 # Allow all auth
 #openshift_master_identity_providers=[{'name': 'allow_all', 'login': 'true', 'challenge': 'true', 'kind': 'AllowAllPasswordIdentityProvider'}]
 
+# Configure Fluentd
+#use_fluentd=true
+
 # master cluster ha variables using pacemaker or RHEL HA
 #openshift_master_cluster_password=openshift_cluster
 #openshift_master_cluster_vip=192.168.133.25

+ 13 - 0
playbooks/aws/openshift-cluster/tasks/launch_instances.yml

@@ -147,6 +147,18 @@
                     tag_host-type_{{ host_type }}, tag_env-host-type_{{ env_host_type }},
                     tag_sub-host-type_{{ sub_host_type }}"
 
+- set_fact:
+    node_label:
+      region: "{{ec2_region}}"
+      type: "{{sub_host_type}}"
+  when: host_type == "node"
+
+- set_fact:
+    node_label:
+      region: "{{ec2_region}}"
+      type: "{{host_type}}"
+  when: host_type != "node"
+
 - name: Add new instances groups and variables
   add_host:
     hostname: "{{ item.0 }}"
@@ -156,6 +168,7 @@
     groups: "{{ instance_groups }}"
     ec2_private_ip_address: "{{ item.1.private_ip }}"
     ec2_ip_address: "{{ item.1.public_ip }}"
+    openshift_node_labels: "{{ node_label }}"
   with_together:
   - instances
   - ec2.instances

+ 2 - 0
playbooks/common/openshift-master/config.yml

@@ -215,6 +215,8 @@
   - role: openshift_master_cluster
     when: openshift_master_ha | bool
   - openshift_examples
+  - role: openshift_cluster_metrics
+    when: openshift.common.use_cluster_metrics | bool
 
 # Additional instance config for online deployments
 - name: Additional instance config

+ 8 - 0
playbooks/libvirt/openshift-cluster/launch.yml

@@ -17,6 +17,14 @@
 
   - include: tasks/configure_libvirt.yml
 
+  - include: ../../common/openshift-cluster/set_etcd_launch_facts_tasks.yml
+  - include: tasks/launch_instances.yml
+    vars:
+      instances: "{{ etcd_names }}"
+      cluster: "{{ cluster_id }}"
+      type: "{{ k8s_type }}"
+      g_sub_host_type: "default"
+
   - include: ../../common/openshift-cluster/set_master_launch_facts_tasks.yml
   - include: tasks/launch_instances.yml
     vars:

+ 3 - 2
playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml

@@ -63,8 +63,9 @@
   shell: 'virsh -c {{ libvirt_uri }} net-dhcp-leases openshift-ansible | egrep -c ''{{ instances | join("|") }}'''
   register: nb_allocated_ips
   until: nb_allocated_ips.stdout == '{{ instances | length }}'
-  retries: 30
+  retries: 60
   delay: 1
+  when: instances | length != 0
 
 - name: Collect IP addresses of the VMs
   shell: 'virsh -c {{ libvirt_uri }} net-dhcp-leases openshift-ansible | awk ''$6 == "{{ item }}" {gsub(/\/.*/, "", $5); print $5}'''
@@ -72,7 +73,7 @@
   with_items: instances
 
 - set_fact:
-    ips: "{{ scratch_ip.results | oo_collect('stdout') }}"
+    ips: "{{ scratch_ip.results | default([]) | oo_collect('stdout') }}"
 
 - name: Add new instances
   add_host:

+ 24 - 18
playbooks/openstack/openshift-cluster/files/heat_stack.yaml

@@ -9,21 +9,6 @@ parameters:
     label: Cluster ID
     description: Identifier of the cluster
 
-  num_masters:
-    type: number
-    label: Number of masters
-    description: Number of masters
-
-  num_nodes:
-    type: number
-    label: Number of compute nodes
-    description: Number of compute nodes
-
-  num_infra:
-    type: number
-    label: Number of infrastructure nodes
-    description: Number of infrastructure nodes
-
   cidr:
     type: string
     label: CIDR
@@ -40,6 +25,12 @@ parameters:
     description: Name of the external network
     default: external
 
+  floating_ip_pool:
+    type: string
+    label: Floating IP pool
+    description: Floating IP pools
+    default: external
+
   ssh_public_key:
     type: string
     label: SSH public key
@@ -52,6 +43,21 @@ parameters:
     description: Source of legitimate ssh connections
     default: 0.0.0.0/0
 
+  num_masters:
+    type: number
+    label: Number of masters
+    description: Number of masters
+
+  num_nodes:
+    type: number
+    label: Number of compute nodes
+    description: Number of compute nodes
+
+  num_infra:
+    type: number
+    label: Number of infrastructure nodes
+    description: Number of infrastructure nodes
+
   master_image:
     type: string
     label: Master image
@@ -290,7 +296,7 @@ resources:
           subnet:     { get_resource: subnet }
           secgrp:
             - { get_resource: master-secgrp }
-          floating_network: { get_param: external_net }
+          floating_network: { get_param: floating_ip_pool }
           net_name:
             str_replace:
               template: openshift-ansible-cluster_id-net
@@ -322,7 +328,7 @@ resources:
           subnet:     { get_resource: subnet }
           secgrp:
             - { get_resource: node-secgrp }
-          floating_network: { get_param: external_net }
+          floating_network: { get_param: floating_ip_pool }
           net_name:
             str_replace:
               template: openshift-ansible-cluster_id-net
@@ -355,7 +361,7 @@ resources:
           secgrp:
             - { get_resource: node-secgrp }
             - { get_resource: infra-secgrp }
-          floating_network: { get_param: external_net }
+          floating_network: { get_param: floating_ip_pool }
           net_name:
             str_replace:
               template: openshift-ansible-cluster_id-net

+ 11 - 22
playbooks/openstack/openshift-cluster/launch.yml

@@ -19,30 +19,21 @@
     changed_when: false
     failed_when: stack_show_result.rc != 0 and 'Stack not found' not in stack_show_result.stderr
 
-  - name: Create OpenStack Stack
-    command: 'heat stack-create -f {{ openstack_infra_heat_stack }}
-             -P cluster_id={{ cluster_id }}
-             -P dns_nameservers={{ openstack_network_dns | join(",") }}
-             -P cidr={{ openstack_network_cidr }}
-             -P ssh_incoming={{ openstack_ssh_access_from }}
-             -P num_masters={{ num_masters }}
-             -P num_nodes={{ num_nodes }}
-             -P num_infra={{ num_infra }}
-             -P master_image={{ deployment_vars[deployment_type].image }}
-             -P node_image={{ deployment_vars[deployment_type].image }}
-             -P infra_image={{ deployment_vars[deployment_type].image }}
-             -P master_flavor={{ openstack_flavor["master"] }}
-             -P node_flavor={{ openstack_flavor["node"] }}
-             -P infra_flavor={{ openstack_flavor["infra"] }}
-             -P ssh_public_key="{{ openstack_ssh_public_key }}"
-             openshift-ansible-{{ cluster_id }}-stack'
+  - set_fact:
+      heat_stack_action: 'stack-create'
     when: stack_show_result.rc == 1
+  - set_fact:
+      heat_stack_action: 'stack-update'
+    when: stack_show_result.rc == 0
 
-  - name: Update OpenStack Stack
-    command: 'heat stack-update -f {{ openstack_infra_heat_stack }}
+  - name: Create or Update OpenStack Stack
+    command: 'heat {{ heat_stack_action }} -f {{ openstack_infra_heat_stack }}
              -P cluster_id={{ cluster_id }}
-             -P dns_nameservers={{ openstack_network_dns | join(",") }}
              -P cidr={{ openstack_network_cidr }}
+             -P dns_nameservers={{ openstack_network_dns | join(",") }}
+             -P external_net={{ openstack_network_external_net }}
+             -P floating_ip_pool={{ openstack_floating_ip_pool }}
+             -P ssh_public_key="{{ openstack_ssh_public_key }}"
              -P ssh_incoming={{ openstack_ssh_access_from }}
              -P num_masters={{ num_masters }}
              -P num_nodes={{ num_nodes }}
@@ -53,9 +44,7 @@
              -P master_flavor={{ openstack_flavor["master"] }}
              -P node_flavor={{ openstack_flavor["node"] }}
              -P infra_flavor={{ openstack_flavor["infra"] }}
-             -P ssh_public_key="{{ openstack_ssh_public_key }}"
              openshift-ansible-{{ cluster_id }}-stack'
-    when: stack_show_result.rc == 0
 
   - name: Wait for OpenStack Stack readiness
     shell: 'heat stack-show openshift-ansible-{{ cluster_id }}-stack | awk ''$2 == "stack_status" {print $4}'''

+ 0 - 27
playbooks/openstack/openshift-cluster/tasks/configure_openstack.yml

@@ -1,27 +0,0 @@
----
-- name: Check infra
-  command: 'heat stack-show {{ openstack_network_prefix }}-stack'
-  register: stack_show_result
-  changed_when: false
-  failed_when: stack_show_result.rc != 0 and 'Stack not found' not in stack_show_result.stderr
-
-- name: Create infra
-  command: 'heat stack-create -f {{ openstack_infra_heat_stack }} -P cluster-id={{ cluster_id }} -P network-prefix={{ openstack_network_prefix }} -P dns-nameservers={{ openstack_network_dns | join(",") }} -P cidr={{ openstack_network_cidr }} -P ssh-incoming={{ openstack_ssh_access_from }} {{ openstack_network_prefix }}-stack'
-  when: stack_show_result.rc == 1
-
-- name: Update infra
-  command: 'heat stack-update -f {{ openstack_infra_heat_stack }} -P cluster-id={{ cluster_id }} -P network-prefix={{ openstack_network_prefix }} -P dns-nameservers={{ openstack_network_dns | join(",") }} -P cidr={{ openstack_network_cidr }} -P ssh-incoming={{ openstack_ssh_access_from }} {{ openstack_network_prefix }}-stack'
-  when: stack_show_result.rc == 0
-
-- name: Wait for infra readiness
-  shell: 'heat stack-show {{ openstack_network_prefix }}-stack | awk ''$2 == "stack_status" {print $4}'''
-  register: stack_show_status_result
-  until: stack_show_status_result.stdout not in ['CREATE_IN_PROGRESS', 'UPDATE_IN_PROGRESS']
-  retries: 30
-  delay: 1
-  failed_when: stack_show_status_result.stdout not in ['CREATE_COMPLETE', 'UPDATE_COMPLETE']
-
-- name: Create ssh keypair
-  nova_keypair:
-    name: "{{ openstack_ssh_keypair }}"
-    public_key: "{{ openstack_ssh_public_key }}"

+ 2 - 6
playbooks/openstack/openshift-cluster/vars.yml

@@ -1,18 +1,14 @@
 ---
 openstack_infra_heat_stack:     "{{ lookup('oo_option', 'infra_heat_stack' ) |
                                     default('files/heat_stack.yaml',         True) }}"
-openstack_network_prefix:       "{{ lookup('oo_option', 'network_prefix'   ) |
-                                    default('openshift-ansible-'+cluster_id, True) }}"
 openstack_network_cidr:         "{{ lookup('oo_option', 'net_cidr'         ) |
                                     default('192.168.' + ( ( 1048576 | random % 256 ) | string() ) + '.0/24', True) }}"
 openstack_network_external_net: "{{ lookup('oo_option', 'external_net'     ) |
                                     default('external',                      True) }}"
-openstack_floating_ip_pools:    "{{ lookup('oo_option', 'floating_ip_pools') |
-                                    default('external',                      True) | oo_split() }}"
+openstack_floating_ip_pool:     "{{ lookup('oo_option', 'floating_ip_pool' ) |
+                                    default('external',                      True) }}"
 openstack_network_dns:          "{{ lookup('oo_option', 'dns'              ) |
                                     default('8.8.8.8,8.8.4.4',               True) | oo_split() }}"
-openstack_ssh_keypair:          "{{ lookup('oo_option', 'keypair'          ) |
-                                    default(lookup('env', 'LOGNAME')+'_key', True) }}"
 openstack_ssh_public_key:       "{{ lookup('file', lookup('oo_option', 'public_key') |
                                     default('~/.ssh/id_rsa.pub',             True)) }}"
 openstack_ssh_access_from:      "{{ lookup('oo_option', 'ssh_from')          |

+ 36 - 0
roles/openshift_cluster_metrics/README.md

@@ -0,0 +1,36 @@
+#openshift_cluster_metrics
+
+This role configures Cluster wide metrics. It does setting up three services:
+* Metrics are stored in InfluxDB for querying.
+* Heapster reads all nodes and pods from the master, then connects to eachs node's kubelet to retrieve pod metrics.
+* Grafan allows users to create dashboards of metrics from InfluxDB
+
+## Requirements
+
+Running OpenShift cluster
+
+## Role Variables
+
+```
+# Enable cluster metrics
+use_cluster_metrics=true
+```
+
+## Dependencies
+
+None
+
+## Example Playbook
+
+TODO
+
+## Security Note
+Opening up the read-only port exposes information about the running pods (such as namespace, pod name, labels, etc.) to unauthenticated clients. The requirement to open up this read-only port will be fixed in future versions.
+
+##License
+
+Apache License, Version 2.0
+
+## Author Information
+
+Diego Castro (diego.castro@getupcloud.com)

+ 53 - 0
roles/openshift_cluster_metrics/files/cluster-metrics/grafana.yaml

@@ -0,0 +1,53 @@
+apiVersion: "v1"
+kind: "List"
+items:
+  -
+    apiVersion: "v1"
+    kind: "Service"
+    metadata:
+      labels:
+        provider: "fabric8"
+        component: "grafana"
+      name: "grafana"
+    spec:
+      ports:
+        -
+          port: 80
+          targetPort: "http"
+      selector:
+        provider: "fabric8"
+        component: "grafana"
+  -
+    apiVersion: "v1"
+    kind: "ReplicationController"
+    metadata:
+      labels:
+        provider: "fabric8"
+        component: "grafana"
+      name: "grafana"
+    spec:
+      replicas: 1
+      selector:
+        provider: "fabric8"
+        component: "grafana"
+      template:
+        metadata:
+          labels:
+            provider: "fabric8"
+            component: "grafana"
+        spec:
+          containers:
+            -
+              env:
+                -
+                  name: "INFLUXDB_SERVICE_NAME"
+                  value: "INFLUXDB_MONITORING"
+                -
+                  name: "GRAFANA_DEFAULT_DASHBOARD"
+                  value: "/dashboard/file/kubernetes.json"
+              image: "fabric8/grafana:1.9.1_2"
+              name: "grafana"
+              ports:
+                -
+                  containerPort: 3000
+                  name: "http"

+ 4 - 0
roles/openshift_cluster_metrics/files/cluster-metrics/heapster-serviceaccount.yaml

@@ -0,0 +1,4 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: heapster

+ 30 - 0
roles/openshift_cluster_metrics/files/cluster-metrics/heapster.yaml

@@ -0,0 +1,30 @@
+apiVersion: "v1"
+kind: "List"
+items:
+  -
+    apiVersion: "v1"
+    kind: "ReplicationController"
+    metadata:
+      labels:
+        provider: "fabric8"
+        component: "heapster"
+      name: "heapster"
+    spec:
+      replicas: 1
+      selector:
+        provider: "fabric8"
+        component: "heapster"
+      template:
+        metadata:
+          labels:
+            provider: "fabric8"
+            component: "heapster"
+        spec:
+          containers:
+            -
+              args:
+                - "-source=kubernetes:https://kubernetes.default.svc.cluster.local?auth=&insecure=true&useServiceAccount=true"
+                - "-sink=influxdb:http://influxdb-monitoring.default.svc.cluster.local:8086"
+              image: "kubernetes/heapster:V0.14.2"
+              name: "heapster"
+          serviceAccount: "heapster"

+ 67 - 0
roles/openshift_cluster_metrics/files/cluster-metrics/influxdb.yaml

@@ -0,0 +1,67 @@
+apiVersion: "v1"
+kind: "List"
+items:
+  -
+    apiVersion: "v1"
+    kind: "Service"
+    metadata:
+      labels:
+        provider: "fabric8"
+        component: "influxdb-monitoring"
+      name: "influxdb-monitoring"
+    spec:
+      ports:
+        -
+          port: 8086
+          targetPort: "http"
+      selector:
+        provider: "fabric8"
+        component: "influxdb-monitoring"
+  -
+    apiVersion: "v1"
+    kind: "ReplicationController"
+    metadata:
+      labels:
+        provider: "fabric8"
+        component: "influxdb-monitoring"
+      name: "influxdb-monitoring"
+    spec:
+      replicas: 1
+      selector:
+        provider: "fabric8"
+        component: "influxdb-monitoring"
+      template:
+        metadata:
+          labels:
+            provider: "fabric8"
+            component: "influxdb-monitoring"
+        spec:
+          containers:
+            -
+              env:
+                -
+                  name: "PRE_CREATE_DB"
+                  value: "k8s;grafana"
+              image: "fabric8/influxdb:0.8.8"
+              name: "influxdb"
+              ports:
+                -
+                  containerPort: 8090
+                  name: "raft"
+                -
+                  containerPort: 8099
+                  name: "protobuf"
+                -
+                  containerPort: 8083
+                  name: "admin"
+                -
+                  containerPort: 8086
+                  name: "http"
+              volumeMounts:
+                -
+                  mountPath: "/data"
+                  name: "influxdb-data"
+          volumes:
+            -
+              emptyDir:
+              name: "influxdb-data"

+ 50 - 0
roles/openshift_cluster_metrics/tasks/main.yml

@@ -0,0 +1,50 @@
+---
+
+- name: Install cluster metrics templates
+  copy:
+    src: cluster-metrics
+    dest: /etc/openshift/
+
+- name: Create InfluxDB Services
+  command: >
+    {{ openshift.common.client_binary }} create -f 
+    /etc/openshift/cluster-metrics/influxdb.yaml
+  register: oex_influxdb_services
+  failed_when: "'already exists' not in oex_influxdb_services.stderr and oex_influxdb_services.rc != 0"
+  changed_when: false
+
+- name: Create Heapster Service Account
+  command: >
+    {{ openshift.common.client_binary }} create -f 
+    /etc/openshift/cluster-metrics/heapster-serviceaccount.yaml
+  register: oex_heapster_serviceaccount
+  failed_when: "'already exists' not in oex_heapster_serviceaccount.stderr and oex_heapster_serviceaccount.rc != 0"
+  changed_when: false
+
+- name: Add cluster-reader role to Heapster
+  command: > 
+    {{ openshift.common.admin_binary }} policy
+    add-cluster-role-to-user
+    cluster-reader
+    system:serviceaccount:default:heapster
+  register: oex_cluster_header_role
+  register: oex_cluster_header_role
+  failed_when: "'already exists' not in oex_cluster_header_role.stderr and oex_cluster_header_role.rc != 0"
+  changed_when: false
+
+- name: Create Heapster Services
+  command: >
+    {{ openshift.common.client_binary }} create -f
+    /etc/openshift/cluster-metrics/heapster.yaml
+  register: oex_heapster_services
+  failed_when: "'already exists' not in oex_heapster_services.stderr and oex_heapster_services.rc != 0"
+  changed_when: false
+
+- name: Create Grafana Services
+  command: >
+    {{ openshift.common.client_binary }} create -f
+    /etc/openshift/cluster-metrics/grafana.yaml
+  register: oex_grafana_services
+  failed_when: "'already exists' not in oex_grafana_services.stderr and oex_grafana_services.rc != 0"
+  changed_when: false
+

+ 1 - 0
roles/openshift_common/tasks/main.yml

@@ -12,6 +12,7 @@
       use_openshift_sdn: "{{ openshift_use_openshift_sdn | default(None) }}"
       sdn_network_plugin_name: "{{ os_sdn_network_plugin_name | default(None) }}"
       deployment_type: "{{ openshift_deployment_type }}"
+      use_fluentd: "{{ openshift_use_fluentd | default(None) }}"
 
 - name: Set hostname
   hostname: name={{ openshift.common.hostname }}

+ 1 - 0
roles/openshift_examples/examples-sync.sh

@@ -24,6 +24,7 @@ unzip dancer-ex-master.zip
 unzip cakephp-ex-master.zip
 unzip application-templates-master.zip
 cp origin-master/examples/db-templates/* ${EXAMPLES_BASE}/db-templates/
+cp origin-master/examples/jenkins/jenkins-*template.json ${EXAMPLES_BASE}/quickstart-templates/
 cp origin-master/examples/image-streams/* ${EXAMPLES_BASE}/image-streams/
 cp django-ex-master/openshift/templates/* ${EXAMPLES_BASE}/quickstart-templates/
 cp rails-ex-master/openshift/templates/* ${EXAMPLES_BASE}/quickstart-templates/

+ 13 - 8
roles/openshift_examples/files/examples/db-templates/mongodb-ephemeral-template.json

@@ -1,6 +1,6 @@
 {
   "kind": "Template",
-  "apiVersion": "v1beta3",
+  "apiVersion": "v1",
   "metadata": {
     "name": "mongodb-ephemeral",
     "creationTimestamp": null,
@@ -13,7 +13,7 @@
   "objects": [
     {
       "kind": "Service",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -41,7 +41,7 @@
     },
     {
       "kind": "DeploymentConfig",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -147,30 +147,35 @@
     {
       "name": "DATABASE_SERVICE_NAME",
       "description": "Database service name",
-      "value": "mongodb"
+      "value": "mongodb",
+      "required": true
     },
     {
       "name": "MONGODB_USER",
       "description": "Username for MongoDB user that will be used for accessing the database",
       "generate": "expression",
-      "from": "user[A-Z0-9]{3}"
+      "from": "user[A-Z0-9]{3}",
+      "required": true
     },
     {
       "name": "MONGODB_PASSWORD",
       "description": "Password for the MongoDB user",
       "generate": "expression",
-      "from": "[a-zA-Z0-9]{16}"
+      "from": "[a-zA-Z0-9]{16}",
+      "required": true
     },
     {
       "name": "MONGODB_DATABASE",
       "description": "Database name",
-      "value": "sampledb"
+      "value": "sampledb",
+      "required": true
     },
     {
       "name": "MONGODB_ADMIN_PASSWORD",
       "description": "Password for the database admin user",
       "generate": "expression",
-      "from": "[a-zA-Z0-9]{16}"
+      "from": "[a-zA-Z0-9]{16}",
+      "required": true
     }
   ],
   "labels": {

+ 16 - 10
roles/openshift_examples/files/examples/db-templates/mongodb-persistent-template.json

@@ -1,6 +1,6 @@
 {
   "kind": "Template",
-  "apiVersion": "v1beta3",
+  "apiVersion": "v1",
   "metadata": {
     "name": "mongodb-persistent",
     "creationTimestamp": null,
@@ -13,7 +13,7 @@
   "objects": [
     {
       "kind": "Service",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -41,7 +41,7 @@
     },
     {
       "kind": "PersistentVolumeClaim",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}"
       },
@@ -58,7 +58,7 @@
     },
     {
       "kind": "DeploymentConfig",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -164,35 +164,41 @@
     {
       "name": "DATABASE_SERVICE_NAME",
       "description": "Database service name",
-      "value": "mongodb"
+      "value": "mongodb",
+      "required": true
     },
     {
       "name": "MONGODB_USER",
       "description": "Username for MongoDB user that will be used for accessing the database",
       "generate": "expression",
-      "from": "user[A-Z0-9]{3}"
+      "from": "user[A-Z0-9]{3}",
+      "required": true
     },
     {
       "name": "MONGODB_PASSWORD",
       "description": "Password for the MongoDB user",
       "generate": "expression",
-      "from": "[a-zA-Z0-9]{16}"
+      "from": "[a-zA-Z0-9]{16}",
+      "required": true
     },
     {
       "name": "MONGODB_DATABASE",
       "description": "Database name",
-      "value": "sampledb"
+      "value": "sampledb",
+      "required": true
     },
     {
       "name": "MONGODB_ADMIN_PASSWORD",
       "description": "Password for the database admin user",
       "generate": "expression",
-      "from": "[a-zA-Z0-9]{16}"
+      "from": "[a-zA-Z0-9]{16}",
+      "required": true
     },
     {
       "name": "VOLUME_CAPACITY",
       "description": "Volume space available for data, e.g. 512Mi, 2Gi",
-      "value": "512Mi"
+      "value": "512Mi",
+      "required": true
     }
   ],
   "labels": {

+ 11 - 7
roles/openshift_examples/files/examples/db-templates/mysql-ephemeral-template.json

@@ -1,6 +1,6 @@
 {
   "kind": "Template",
-  "apiVersion": "v1beta3",
+  "apiVersion": "v1",
   "metadata": {
     "name": "mysql-ephemeral",
     "creationTimestamp": null,
@@ -13,7 +13,7 @@
   "objects": [
     {
       "kind": "Service",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -41,7 +41,7 @@
     },
     {
       "kind": "DeploymentConfig",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -143,24 +143,28 @@
     {
       "name": "DATABASE_SERVICE_NAME",
       "description": "Database service name",
-      "value": "mysql"
+      "value": "mysql",
+      "required": true
     },
     {
       "name": "MYSQL_USER",
       "description": "Username for MySQL user that will be used for accessing the database",
       "generate": "expression",
-      "from": "user[A-Z0-9]{3}"
+      "from": "user[A-Z0-9]{3}",
+      "required": true
     },
     {
       "name": "MYSQL_PASSWORD",
       "description": "Password for the MySQL user",
       "generate": "expression",
-      "from": "[a-zA-Z0-9]{16}"
+      "from": "[a-zA-Z0-9]{16}",
+      "required": true
     },
     {
       "name": "MYSQL_DATABASE",
       "description": "Database name",
-      "value": "sampledb"
+      "value": "sampledb",
+      "required": true
     }
   ],
   "labels": {

+ 14 - 9
roles/openshift_examples/files/examples/db-templates/mysql-persistent-template.json

@@ -1,6 +1,6 @@
 {
   "kind": "Template",
-  "apiVersion": "v1beta3",
+  "apiVersion": "v1",
   "metadata": {
     "name": "mysql-persistent",
     "creationTimestamp": null,
@@ -13,7 +13,7 @@
   "objects": [
     {
       "kind": "Service",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -41,7 +41,7 @@
     },
     {
       "kind": "PersistentVolumeClaim",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}"
       },
@@ -58,7 +58,7 @@
     },
     {
       "kind": "DeploymentConfig",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -160,29 +160,34 @@
     {
       "name": "DATABASE_SERVICE_NAME",
       "description": "Database service name",
-      "value": "mysql"
+      "value": "mysql",
+      "required": true
     },
     {
       "name": "MYSQL_USER",
       "description": "Username for MySQL user that will be used for accessing the database",
       "generate": "expression",
-      "from": "user[A-Z0-9]{3}"
+      "from": "user[A-Z0-9]{3}",
+      "required": true
     },
     {
       "name": "MYSQL_PASSWORD",
       "description": "Password for the MySQL user",
       "generate": "expression",
-      "from": "[a-zA-Z0-9]{16}"
+      "from": "[a-zA-Z0-9]{16}",
+      "required": true
     },
     {
       "name": "MYSQL_DATABASE",
       "description": "Database name",
-      "value": "sampledb"
+      "value": "sampledb",
+      "required": true
     },
     {
       "name": "VOLUME_CAPACITY",
       "description": "Volume space available for data, e.g. 512Mi, 2Gi",
-      "value": "512Mi"
+      "value": "512Mi",
+      "required": true
     }
   ],
   "labels": {

+ 11 - 7
roles/openshift_examples/files/examples/db-templates/postgresql-ephemeral-template.json

@@ -1,6 +1,6 @@
 {
   "kind": "Template",
-  "apiVersion": "v1beta3",
+  "apiVersion": "v1",
   "metadata": {
     "name": "postgresql-ephemeral",
     "creationTimestamp": null,
@@ -13,7 +13,7 @@
   "objects": [
     {
       "kind": "Service",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -41,7 +41,7 @@
     },
     {
       "kind": "DeploymentConfig",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -143,24 +143,28 @@
     {
       "name": "DATABASE_SERVICE_NAME",
       "description": "Database service name",
-      "value": "postgresql"
+      "value": "postgresql",
+      "required": true
     },
     {
       "name": "POSTGRESQL_USER",
       "description": "Username for PostgreSQL user that will be used for accessing the database",
       "generate": "expression",
-      "from": "user[A-Z0-9]{3}"
+      "from": "user[A-Z0-9]{3}",
+      "required": true
     },
     {
       "name": "POSTGRESQL_PASSWORD",
       "description": "Password for the PostgreSQL user",
       "generate": "expression",
-      "from": "[a-zA-Z0-9]{16}"
+      "from": "[a-zA-Z0-9]{16}",
+      "required": true
     },
     {
       "name": "POSTGRESQL_DATABASE",
       "description": "Database name",
-      "value": "sampledb"
+      "value": "sampledb",
+      "required": true
     }
   ],
   "labels": {

+ 14 - 9
roles/openshift_examples/files/examples/db-templates/postgresql-persistent-template.json

@@ -1,6 +1,6 @@
 {
   "kind": "Template",
-  "apiVersion": "v1beta3",
+  "apiVersion": "v1",
   "metadata": {
     "name": "postgresql-persistent",
     "creationTimestamp": null,
@@ -13,7 +13,7 @@
   "objects": [
     {
       "kind": "Service",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -41,7 +41,7 @@
     },
     {
       "kind": "PersistentVolumeClaim",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}"
       },
@@ -58,7 +58,7 @@
     },
     {
       "kind": "DeploymentConfig",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "${DATABASE_SERVICE_NAME}",
         "creationTimestamp": null
@@ -160,29 +160,34 @@
     {
       "name": "DATABASE_SERVICE_NAME",
       "description": "Database service name",
-      "value": "postgresql"
+      "value": "postgresql",
+      "required": true
     },
     {
       "name": "POSTGRESQL_USER",
       "description": "Username for PostgreSQL user that will be used for accessing the database",
       "generate": "expression",
-      "from": "user[A-Z0-9]{3}"
+      "from": "user[A-Z0-9]{3}",
+      "required": true
     },
     {
       "name": "POSTGRESQL_PASSWORD",
       "description": "Password for the PostgreSQL user",
       "generate": "expression",
-      "from": "[a-zA-Z0-9]{16}"
+      "from": "[a-zA-Z0-9]{16}",
+      "required": true
     },
     {
       "name": "POSTGRESQL_DATABASE",
       "description": "Database name",
-      "value": "sampledb"
+      "value": "sampledb",
+      "required": true
     },
     {
       "name": "VOLUME_CAPACITY",
       "description": "Volume space available for data, e.g. 512Mi, 2Gi",
-      "value": "512Mi"
+      "value": "512Mi",
+      "required": true
     }
   ],
   "labels": {

+ 11 - 11
roles/openshift_examples/files/examples/image-streams/image-streams-centos7.json

@@ -1,11 +1,11 @@
 {
   "kind": "ImageStreamList",
-  "apiVersion": "v1beta3",
+  "apiVersion": "v1",
   "metadata": {},
   "items": [
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "ruby",
         "creationTimestamp": null
@@ -35,7 +35,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "nodejs",
         "creationTimestamp": null
@@ -65,7 +65,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "perl",
         "creationTimestamp": null
@@ -95,7 +95,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "php",
         "creationTimestamp": null
@@ -125,7 +125,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "python",
         "creationTimestamp": null
@@ -155,7 +155,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "wildfly",
         "creationTimestamp": null
@@ -185,7 +185,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "mysql",
         "creationTimestamp": null
@@ -208,7 +208,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "postgresql",
         "creationTimestamp": null
@@ -231,7 +231,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "mongodb",
         "creationTimestamp": null
@@ -254,7 +254,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "jenkins",
         "creationTimestamp": null

+ 32 - 9
roles/openshift_examples/files/examples/image-streams/image-streams-rhel7.json

@@ -1,11 +1,11 @@
 {
   "kind": "ImageStreamList",
-  "apiVersion": "v1beta3",
+  "apiVersion": "v1",
   "metadata": {},
   "items": [
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "ruby",
         "creationTimestamp": null
@@ -35,7 +35,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "nodejs",
         "creationTimestamp": null
@@ -65,7 +65,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "perl",
         "creationTimestamp": null
@@ -95,7 +95,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "php",
         "creationTimestamp": null
@@ -125,7 +125,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "python",
         "creationTimestamp": null
@@ -155,7 +155,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "mysql",
         "creationTimestamp": null
@@ -178,7 +178,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "postgresql",
         "creationTimestamp": null
@@ -201,7 +201,7 @@
     },
     {
       "kind": "ImageStream",
-      "apiVersion": "v1beta3",
+      "apiVersion": "v1",
       "metadata": {
         "name": "mongodb",
         "creationTimestamp": null
@@ -221,6 +221,29 @@
           }
         ]
       }
+    },
+    {
+      "kind": "ImageStream",
+      "apiVersion": "v1",
+      "metadata": {
+        "name": "jenkins",
+        "creationTimestamp": null
+      },
+      "spec": {
+        "dockerImageRepository": "registry.access.redhat.com/openshift3/jenkins-16-rhel7",
+        "tags": [
+          {
+            "name": "latest"
+          },
+          {
+            "name": "1.6",
+            "from": {
+              "Kind": "ImageStreamTag",
+              "Name": "latest"
+            }
+          }
+        ]
+      }
     }
   ]
 }

+ 8 - 3
roles/openshift_examples/files/examples/quickstart-templates/cakephp-mysql.json

@@ -264,7 +264,7 @@
             "containers": [
               {
                 "name": "mysql",
-                "image": "openshift/mysql-55-centos7",
+                "image": "${MYSQL_IMAGE}",
                 "ports": [
                   {
                     "containerPort": 3306
@@ -307,8 +307,8 @@
     },
     {
       "name": "APPLICATION_DOMAIN",
-      "description": "The exposed hostname that will route to the CakePHP service",
-      "value": "cakephp-mysql-example.openshiftapps.com"
+      "description": "The exposed hostname that will route to the CakePHP service, if left blank a value will be defaulted.",
+      "value": ""
     },
     {
       "name": "GITHUB_WEBHOOK_SECRET",
@@ -343,6 +343,11 @@
       "from": "[a-zA-Z0-9]{16}"
     },
     {
+      "name": "MYSQL_IMAGE",
+      "description": "Image to use for mysql",
+      "value": "openshift/mysql-55-centos7"      
+    },
+    {
       "name": "CAKEPHP_SECRET_TOKEN",
       "description": "Set this to a long random string",
       "generate": "expression",

+ 2 - 2
roles/openshift_examples/files/examples/quickstart-templates/cakephp.json

@@ -215,8 +215,8 @@
     },
     {
       "name": "APPLICATION_DOMAIN",
-      "description": "The exposed hostname that will route to the CakePHP service",
-      "value": "cakephp-example.openshiftapps.com"
+      "description": "The exposed hostname that will route to the CakePHP service, if left blank a value will be defaulted.",
+      "value": ""
     },
     {
       "name": "GITHUB_WEBHOOK_SECRET",

+ 17 - 12
roles/openshift_examples/files/examples/quickstart-templates/dancer-mysql.json

@@ -162,15 +162,15 @@
                   },
                   {
                     "name": "MYSQL_USER",
-                    "value": "${MYSQL_USER}"
+                    "value": "${DATABASE_USER}"
                   },
                   {
                     "name": "MYSQL_PASSWORD",
-                    "value": "${MYSQL_PASSWORD}"
+                    "value": "${DATABASE_PASSWORD}"
                   },
                   {
                     "name": "MYSQL_DATABASE",
-                    "value": "${MYSQL_DATABASE}"
+                    "value": "${DATABASE_NAME}"
                   },
                   {
                     "name": "SECRET_KEY_BASE",
@@ -238,7 +238,7 @@
             "containers": [
               {
                 "name": "mysql",
-                "image": "openshift/mysql-55-centos7",
+                "image": "${MYSQL_IMAGE}",
                 "ports": [
                   {
                     "containerPort": 3306
@@ -247,15 +247,15 @@
                 "env": [
                   {
                     "name": "MYSQL_USER",
-                    "value": "${MYSQL_USER}"
+                    "value": "${DATABASE_USER}"
                   },
                   {
                     "name": "MYSQL_PASSWORD",
-                    "value": "${MYSQL_PASSWORD}"
+                    "value": "${DATABASE_PASSWORD}"
                   },
                   {
                     "name": "MYSQL_DATABASE",
-                    "value": "${MYSQL_DATABASE}"
+                    "value": "${DATABASE_NAME}"
                   }
                 ]
               }
@@ -281,8 +281,8 @@
     },
     {
       "name": "APPLICATION_DOMAIN",
-      "description": "The exposed hostname that will route to the Dancer service",
-      "value": "dancer-mysql-example.openshiftapps.com"
+      "description": "The exposed hostname that will route to the Dancer service, if left blank a value will be defaulted.",
+      "value": ""
     },
     {
       "name": "GITHUB_WEBHOOK_SECRET",
@@ -308,23 +308,28 @@
       "value": "database"
     },
     {
-      "name": "MYSQL_USER",
+      "name": "DATABASE_USER",
       "description": "database username",
       "generate": "expression",
       "from": "user[A-Z0-9]{3}"
     },
     {
-      "name": "MYSQL_PASSWORD",
+      "name": "DATABASE_PASSWORD",
       "description": "database password",
       "generate": "expression",
       "from": "[a-zA-Z0-9]{8}"
     },
     {
-      "name": "MYSQL_DATABASE",
+      "name": "DATABASE_NAME",
       "description": "database name",
       "value": "sampledb"
     },
     {
+      "name": "MYSQL_IMAGE",
+      "description": "Image to use for mysql",
+      "value": "openshift/mysql-55-centos7"      
+    },
+    {
       "name": "SECRET_KEY_BASE",
       "description": "Your secret key for verifying the integrity of signed cookies",
       "generate": "expression",

+ 2 - 2
roles/openshift_examples/files/examples/quickstart-templates/dancer.json

@@ -181,8 +181,8 @@
     },
     {
       "name": "APPLICATION_DOMAIN",
-      "description": "The exposed hostname that will route to the Dancer service",
-      "value": "dancer-example.openshiftapps.com"
+      "description": "The exposed hostname that will route to the Dancer service, if left blank a value will be defaulted.",
+      "value": ""
     },
     {
       "name": "GITHUB_WEBHOOK_SECRET",

+ 25 - 20
roles/openshift_examples/files/examples/quickstart-templates/django-postgresql.json

@@ -2,7 +2,7 @@
   "kind": "Template",
   "apiVersion": "v1",
   "metadata": {
-    "name": "django-postgresql-example",
+    "name": "django-psql-example",
     "annotations": {
       "description": "An example Django application with a PostgreSQL database",
       "tags": "instant-app,python,django,postgresql",
@@ -10,14 +10,14 @@
     }
   },
   "labels": {
-    "template": "django-postgresql-example"
+    "template": "django-psql-example"
   },
   "objects": [
     {
       "kind": "Service",
       "apiVersion": "v1",
       "metadata": {
-        "name": "django-postgresql-example",
+        "name": "django-psql-example",
         "annotations": {
           "description": "Exposes and load balances the application pods"
         }
@@ -31,7 +31,7 @@
           }
         ],
         "selector": {
-          "name": "django-postgresql-example"
+          "name": "django-psql-example"
         }
       }
     },
@@ -39,13 +39,13 @@
       "kind": "Route",
       "apiVersion": "v1",
       "metadata": {
-        "name": "django-postgresql-example"
+        "name": "django-psql-example"
       },
       "spec": {
         "host": "${APPLICATION_DOMAIN}",
         "to": {
           "kind": "Service",
-          "name": "django-postgresql-example"
+          "name": "django-psql-example"
         }
       }
     },
@@ -53,7 +53,7 @@
       "kind": "ImageStream",
       "apiVersion": "v1",
       "metadata": {
-        "name": "django-postgresql-example",
+        "name": "django-psql-example",
         "annotations": {
           "description": "Keeps track of changes in the application image"
         }
@@ -63,7 +63,7 @@
       "kind": "BuildConfig",
       "apiVersion": "v1",
       "metadata": {
-        "name": "django-postgresql-example",
+        "name": "django-psql-example",
         "annotations": {
           "description": "Defines how to build the application"
         }
@@ -90,7 +90,7 @@
         "output": {
           "to": {
             "kind": "ImageStreamTag",
-            "name": "django-postgresql-example:latest"
+            "name": "django-psql-example:latest"
           }
         },
         "triggers": [
@@ -110,7 +110,7 @@
       "kind": "DeploymentConfig",
       "apiVersion": "v1",
       "metadata": {
-        "name": "django-postgresql-example",
+        "name": "django-psql-example",
         "annotations": {
           "description": "Defines how to deploy the application server"
         }
@@ -125,11 +125,11 @@
             "imageChangeParams": {
               "automatic": true,
               "containerNames": [
-                "django-postgresql-example"
+                "django-psql-example"
               ],
               "from": {
                 "kind": "ImageStreamTag",
-                "name": "django-postgresql-example:latest"
+                "name": "django-psql-example:latest"
               }
             }
           },
@@ -139,20 +139,20 @@
         ],
         "replicas": 1,
         "selector": {
-          "name": "django-postgresql-example"
+          "name": "django-psql-example"
         },
         "template": {
           "metadata": {
-            "name": "django-postgresql-example",
+            "name": "django-psql-example",
             "labels": {
-              "name": "django-postgresql-example"
+              "name": "django-psql-example"
             }
           },
           "spec": {
             "containers": [
               {
-                "name": "django-postgresql-example",
-                "image": "django-postgresql-example",
+                "name": "django-psql-example",
+                "image": "django-psql-example",
                 "ports": [
                   {
                     "containerPort": 8080
@@ -249,7 +249,7 @@
             "containers": [
               {
                 "name": "postgresql",
-                "image": "openshift/postgresql-92-centos7",
+                "image": "${POSTGRESQL_IMAGE}",
                 "ports": [
                   {
                     "containerPort": 5432
@@ -292,8 +292,8 @@
     },
     {
       "name": "APPLICATION_DOMAIN",
-      "description": "The exposed hostname that will route to the Django service",
-      "value": "django-postgresql-example.openshiftapps.com"
+      "description": "The exposed hostname that will route to the Django service, if left blank a value will be defaulted.",
+      "value": ""
     },
     {
       "name": "GITHUB_WEBHOOK_SECRET",
@@ -328,6 +328,11 @@
       "from": "[a-zA-Z0-9]{16}"
     },
     {
+      "name": "POSTGRESQL_IMAGE",
+      "description": "Image to use for postgresql",
+      "value": "openshift/postgresql-92-centos7"      
+    },
+    {
       "name": "APP_CONFIG",
       "description": "Relative path to Gunicorn configuration file (optional)"
     },

+ 2 - 2
roles/openshift_examples/files/examples/quickstart-templates/django.json

@@ -211,8 +211,8 @@
     },
     {
       "name": "APPLICATION_DOMAIN",
-      "description": "The exposed hostname that will route to the Django service",
-      "value": "django-example.openshiftapps.com"
+      "description": "The exposed hostname that will route to the Django service, if left blank a value will be defaulted.",
+      "value": ""
     },
     {
       "name": "GITHUB_WEBHOOK_SECRET",

Fichier diff supprimé car celui-ci est trop grand
+ 145 - 0
roles/openshift_examples/files/examples/quickstart-templates/jenkins-ephemeral-template.json


Fichier diff supprimé car celui-ci est trop grand
+ 168 - 0
roles/openshift_examples/files/examples/quickstart-templates/jenkins-persistent-template.json


+ 20 - 15
roles/openshift_examples/files/examples/quickstart-templates/nodejs-mongodb.json

@@ -165,19 +165,19 @@
                   },
                   {
                     "name": "MONGODB_USER",
-                    "value": "${MONGODB_USER}"
+                    "value": "${DATABASE_USER}"
                   },
                   {
                     "name": "MONGODB_PASSWORD",
-                    "value": "${MONGODB_PASSWORD}"
+                    "value": "${DATABASE_PASSWORD}"
                   },
                   {
                     "name": "MONGODB_DATABASE",
-                    "value": "${MONGODB_DATABASE}"
+                    "value": "${DATABASE_NAME}"
                   },
                   {
                     "name": "MONGODB_ADMIN_PASSWORD",
-                    "value": "${MONGODB_ADMIN_PASSWORD}"
+                    "value": "${DATABASE_ADMIN_PASSWORD}"
                   }
                 ]
               }
@@ -241,7 +241,7 @@
             "containers": [
               {
                 "name": "mongodb",
-                "image": "openshift/mongodb-24-centos7",
+                "image": "${MONGODB_IMAGE}",
                 "ports": [
                   {
                     "containerPort": 27017
@@ -250,19 +250,19 @@
                 "env": [
                   {
                     "name": "MONGODB_USER",
-                    "value": "${MONGODB_USER}"
+                    "value": "${DATABASE_USER}"
                   },
                   {
                     "name": "MONGODB_PASSWORD",
-                    "value": "${MONGODB_PASSWORD}"
+                    "value": "${DATABASE_PASSWORD}"
                   },
                   {
                     "name": "MONGODB_DATABASE",
-                    "value": "${MONGODB_DATABASE}"
+                    "value": "${DATABASE_NAME}"
                   },
                   {
                     "name": "MONGODB_ADMIN_PASSWORD",
-                    "value": "${MONGODB_ADMIN_PASSWORD}"
+                    "value": "${DATABASE_ADMIN_PASSWORD}"
                   }
                 ]
               }
@@ -288,8 +288,8 @@
     },
     {
       "name": "APPLICATION_DOMAIN",
-      "description": "The exposed hostname that will route to the Node.js service",
-      "value": "nodejs-mongodb-example.openshiftapps.com"
+      "description": "The exposed hostname that will route to the Node.js service, if left blank a value will be defaulted.",
+      "value": ""
     },
     {
       "name": "GITHUB_WEBHOOK_SECRET",
@@ -303,27 +303,32 @@
       "value": "mongodb"
     },
     {
-      "name": "MONGODB_USER",
+      "name": "DATABASE_USER",
       "description": "Username for MongoDB user that will be used for accessing the database",
       "generate": "expression",
       "from": "user[A-Z0-9]{3}"
     },
     {
-      "name": "MONGODB_PASSWORD",
+      "name": "DATABASE_PASSWORD",
       "description": "Password for the MongoDB user",
       "generate": "expression",
       "from": "[a-zA-Z0-9]{16}"
     },
     {
-      "name": "MONGODB_DATABASE",
+      "name": "DATABASE_NAME",
       "description": "Database name",
       "value": "sampledb"
     },
     {
-      "name": "MONGODB_ADMIN_PASSWORD",
+      "name": "DATABASE_ADMIN_PASSWORD",
       "description": "Password for the database admin user",
       "generate": "expression",
       "from": "[a-zA-Z0-9]{16}"
+    },
+    {
+      "name": "MONGODB_IMAGE",
+      "description": "Image to use for mongodb",
+      "value": "openshift/mongodb-24-centos7"      
     }
   ]
 }

+ 2 - 2
roles/openshift_examples/files/examples/quickstart-templates/nodejs.json

@@ -203,8 +203,8 @@
     },
     {
       "name": "APPLICATION_DOMAIN",
-      "description": "The exposed hostname that will route to the Node.js service",
-      "value": "nodejs-example.openshiftapps.com"
+      "description": "The exposed hostname that will route to the Node.js service, if left blank a value will be defaulted.",
+      "value": ""
     },
     {
       "name": "GITHUB_WEBHOOK_SECRET",

+ 26 - 12
roles/openshift_examples/files/examples/quickstart-templates/rails-postgresql.json

@@ -176,15 +176,15 @@
                   },
                   {
                     "name": "POSTGRESQL_USER",
-                    "value": "${POSTGRESQL_USER}"
+                    "value": "${DATABASE_USER}"
                   },
                   {
                     "name": "POSTGRESQL_PASSWORD",
-                    "value": "${POSTGRESQL_PASSWORD}"
+                    "value": "${DATABASE_PASSWORD}"
                   },
                   {
                     "name": "POSTGRESQL_DATABASE",
-                    "value": "${POSTGRESQL_DATABASE}"
+                    "value": "${DATABASE_NAME}"
                   },
                   {
                     "name": "SECRET_KEY_BASE",
@@ -213,6 +213,10 @@
                   {
                     "name": "APPLICATION_PASSWORD",
                     "value": "${APPLICATION_PASSWORD}"
+                  },
+                  {
+                    "name": "RAILS_ENV",
+                    "value": "${RAILS_ENV}"
                   }
                 ]
               }
@@ -276,7 +280,7 @@
             "containers": [
               {
                 "name": "postgresql",
-                "image": "openshift/postgresql-92-centos7",
+                "image": "${POSTGRESQL_IMAGE}",
                 "ports": [
                   {
                     "containerPort": 5432
@@ -285,15 +289,15 @@
                 "env": [
                   {
                     "name": "POSTGRESQL_USER",
-                    "value": "${POSTGRESQL_USER}"
+                    "value": "${DATABASE_USER}"
                   },
                   {
                     "name": "POSTGRESQL_PASSWORD",
-                    "value": "${POSTGRESQL_PASSWORD}"
+                    "value": "${DATABASE_PASSWORD}"
                   },
                   {
                     "name": "POSTGRESQL_DATABASE",
-                    "value": "${POSTGRESQL_DATABASE}"
+                    "value": "${DATABASE_NAME}"
                   },
                   {
                     "name": "POSTGRESQL_MAX_CONNECTIONS",
@@ -327,8 +331,8 @@
     },
     {
       "name": "APPLICATION_DOMAIN",
-      "description": "The exposed hostname that will route to the Rails service",
-      "value": "rails-postgresql-example.openshiftapps.com"
+      "description": "The exposed hostname that will route to the Rails service, if left blank a value will be defaulted.",
+      "value": ""
     },
     {
       "name": "GITHUB_WEBHOOK_SECRET",
@@ -353,28 +357,38 @@
       "value": "secret"
     },
     {
+      "name": "RAILS_ENV",
+      "description": "Environment under which the sample application will run. Could be set to production, development or test",
+      "value": "production"
+    },
+    {
       "name": "DATABASE_SERVICE_NAME",
       "description": "Database service name",
       "value": "postgresql"
     },
     {
-      "name": "POSTGRESQL_USER",
+      "name": "DATABASE_USER",
       "description": "database username",
       "generate": "expression",
       "from": "user[A-Z0-9]{3}"
     },
     {
-      "name": "POSTGRESQL_PASSWORD",
+      "name": "DATABASE_PASSWORD",
       "description": "database password",
       "generate": "expression",
       "from": "[a-zA-Z0-9]{8}"
     },
     {
-      "name": "POSTGRESQL_DATABASE",
+      "name": "DATABASE_NAME",
       "description": "database name",
       "value": "root"
     },
     {
+      "name": "POSTGRESQL_IMAGE",
+      "description": "Image to use for postgresql",
+      "value": "openshift/postgresql-92-centos7"      
+    },
+    {
       "name": "POSTGRESQL_MAX_CONNECTIONS",
       "description": "database max connections",
       "value": "10"

+ 19 - 0
roles/openshift_facts/library/openshift_facts.py

@@ -323,6 +323,24 @@ def set_fluentd_facts_if_unset(facts):
             facts['common']['use_fluentd'] = use_fluentd
     return facts
 
+def set_cluster_metrics_facts_if_unset(facts):
+    """ Set cluster metrics facts if not already present in facts dict
+            dict: the facts dict updated with the generated cluster metrics facts if
+            missing
+        Args:
+            facts (dict): existing facts
+        Returns:
+            dict: the facts dict updated with the generated cluster metrics
+            facts if they were not already present
+
+    """
+    if 'common' in facts:
+        deployment_type = facts['common']['deployment_type']
+        if 'use_cluster_metrics' not in facts['common']:
+            use_cluster_metrics = True if deployment_type == 'origin' else False
+            facts['common']['use_cluster_metrics'] = use_cluster_metrics
+    return facts
+
 def set_identity_providers_if_unset(facts):
     """ Set identity_providers fact if not already present in facts dict
 
@@ -700,6 +718,7 @@ class OpenShiftFacts(object):
         facts['current_config'] = get_current_config(facts)
         facts = set_url_facts_if_unset(facts)
         facts = set_fluentd_facts_if_unset(facts)
+        facts = set_cluster_metrics_facts_if_unset(facts)
         facts = set_identity_providers_if_unset(facts)
         facts = set_registry_url_if_unset(facts)
         facts = set_sdn_facts_if_unset(facts)

+ 2 - 8
roles/openshift_master/templates/master.yaml.v1.j2

@@ -2,9 +2,6 @@ apiLevels:
 - v1beta3
 - v1
 apiVersion: v1
-{% if api_server_args is defined and api_server_args %}
-apiServerArguments: {{ api_server_args }}
-{% endif %}
 assetConfig:
   logoutURL: ""
   masterPublicURL: {{ openshift.master.public_api_url }}
@@ -16,9 +13,6 @@ assetConfig:
     keyFile: master.server.key
     maxRequestsInFlight: 0
     requestTimeoutSeconds: 0
-{% if controller_args is defined and controller_args %}
-controllerArguments: {{ controller_args }}
-{% endif %}
 corsAllowedOrigins:
 {% for origin in ['127.0.0.1', 'localhost', openshift.common.hostname, openshift.common.ip, openshift.common.public_hostname, openshift.common.public_ip] %}
   - {{ origin }}
@@ -74,8 +68,8 @@ kubernetesMasterConfig:
   apiLevels:
   - v1beta3
   - v1
-  apiServerArguments: null
-  controllerArguments: null
+  apiServerArguments: {{ api_server_args if api_server_args is defined else 'null' }}
+  controllerArguments: {{ controller_args if controller_args is defined else 'null' }}
 {# TODO: support overriding masterCount #}
   masterCount: 1
   masterIP: ""

+ 4 - 0
roles/openshift_node/defaults/main.yml

@@ -6,3 +6,7 @@ os_firewall_allow:
   port: 80/tcp
 - service: https
   port: 443/tcp
+- service: Openshift kubelet ReadOnlyPort
+  port: 10255/tcp
+- service: Openshift kubelet ReadOnlyPort udp
+  port: 10255/udp

+ 3 - 0
roles/openshift_node/handlers/main.yml

@@ -1,3 +1,6 @@
 ---
 - name: restart openshift-node
   service: name=openshift-node state=restarted
+
+- name: restart docker
+  service: name=docker state=restarted

+ 45 - 1
roles/openshift_node/tasks/main.yml

@@ -66,10 +66,54 @@
 - name: Secure OpenShift Registry
   lineinfile:
     dest: /etc/sysconfig/docker
-    regexp: '^OPTIONS=.*'
+    regexp: '^OPTIONS=.*$'
     line: "OPTIONS='--insecure-registry={{ openshift.node.portal_net }} \
 {% if ansible_selinux and ansible_selinux.status == '''enabled''' %}--selinux-enabled{% endif %}'"
   when: docker_check.stat.isreg
+  notify:
+    - restart docker
+
+- set_fact:
+    docker_additional_registries: "{{ lookup('oo_option', 'docker_additional_registries')
+                                      | oo_split() | union(['registry.access.redhat.com'])
+                                      | difference(['']) }}"
+  when: openshift.common.deployment_type == 'enterprise'
+- set_fact:
+    docker_additional_registries: "{{ lookup('oo_option', 'docker_additional_registries')
+                                      | oo_split() | difference(['']) }}"
+  when: openshift.common.deployment_type != 'enterprise'
+
+- name: Add personal registries
+  lineinfile:
+    dest: /etc/sysconfig/docker
+    regexp: '^ADD_REGISTRY=.*$'
+    line: "ADD_REGISTRY='{{ docker_additional_registries
+                            | oo_prepend_strings_in_list('--add-registry ') | join(' ') }}'"
+  when: docker_check.stat.isreg and docker_additional_registries
+  notify:
+    - restart docker
+
+- name: Block registries
+  lineinfile:
+    dest: /etc/sysconfig/docker
+    regexp: '^BLOCK_REGISTRY=.*$'
+    line: "BLOCK_REGISTRY='{{ lookup('oo_option', 'docker_blocked_registries') | oo_split()
+                              | oo_prepend_strings_in_list('--block-registry ') | join(' ') }}'"
+  when: docker_check.stat.isreg and
+        lookup('oo_option', 'docker_blocked_registries') != ''
+  notify:
+    - restart docker
+
+- name: Grant access to additional insecure registries
+  lineinfile:
+    dest: /etc/sysconfig/docker
+    regexp: '^INSECURE_REGISTRY=.*'
+    line: "INSECURE_REGISTRY='{{ lookup('oo_option', 'docker_insecure_registries') | oo_split()
+                              | oo_prepend_strings_in_list('--insecure-registry ') | join(' ') }}'"
+  when: docker_check.stat.isreg and
+        lookup('oo_option', 'docker_insecure_registries') != ''
+  notify:
+    - restart docker
 
 - name: Allow NFS access for VMs
   seboolean: name=virt_use_nfs state=yes persistent=yes

+ 1 - 0
roles/openshift_node/templates/node.yaml.v1.j2

@@ -21,3 +21,4 @@ servingInfo:
   clientCA: ca.crt
   keyFile: server.key
 volumeDirectory: {{ openshift_data_dir }}/openshift.local.volumes
+{% include 'partials/kubeletArguments.j2' %}

+ 5 - 0
roles/openshift_node/templates/partials/kubeletArguments.j2

@@ -0,0 +1,5 @@
+{% if openshift.common.use_cluster_metrics | bool %}
+kubeletArguments:
+  "read-only-port":
+    - "10255"
+{% endif %}