Add Kubernetes image and configurations for coe 14/71814/29
authorFaseela K <faseela.k@ericsson.com>
Sat, 5 May 2018 19:48:37 +0000 (01:18 +0530)
committerFaseela K <faseela.k@ericsson.com>
Fri, 25 May 2018 05:40:53 +0000 (11:10 +0530)
Change-Id: Ice36e9bcfd7caee1708376a83b192318ad9eae86
Signed-off-by: Frederick F. Kautz IV <fkautz@redhat.com>
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
Signed-off-by: Faseela K <faseela.k@ericsson.com>
jjb/releng-packer-jobs.yaml
packer/provision/examples/apache-e-w.yaml [new file with mode: 0644]
packer/provision/examples/apache-n-s.yaml [new file with mode: 0644]
packer/provision/examples/apache-pod.yaml [new file with mode: 0644]
packer/provision/examples/busybox.yaml [new file with mode: 0644]
packer/provision/examples/nginx-pod.yaml [new file with mode: 0644]
packer/provision/kubernetes.yaml [new file with mode: 0644]
packer/provision/roles/coe/requirements.yaml [new file with mode: 0644]
packer/provision/templates/odlovs-cni.conf.j2 [new file with mode: 0644]
packer/templates/kubernetes.json [new file with mode: 0644]

index 72007f085080da54d8457d20350b0dd3078203ab..3f672c8c35c877867b45a74c93cb823b272de88c 100644 (file)
 
     platforms: centos-7
     templates: robot
+
+- project:
+    name: packer-kubernetes-jobs
+    jobs:
+      - gerrit-packer-merge
+
+    project: releng/builder
+    project-name: builder
+    branch: master
+    archive-artifacts: '**/*.log'
+
+    build-node: centos7-builder-2c-1g
+    build-timeout: 90
+
+    platforms:
+      - ubuntu-16.04
+      - centos-7
+    templates: kubernetes
diff --git a/packer/provision/examples/apache-e-w.yaml b/packer/provision/examples/apache-e-w.yaml
new file mode 100644 (file)
index 0000000..bb84fa1
--- /dev/null
@@ -0,0 +1,15 @@
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    name: apacheservice
+    role: service
+  name: apacheservice
+spec:
+  ports:
+    - port: 8800
+      targetPort: 80
+      protocol: TCP
+      name: tcp
+  selector:
+    name: webserver
diff --git a/packer/provision/examples/apache-n-s.yaml b/packer/provision/examples/apache-n-s.yaml
new file mode 100644 (file)
index 0000000..7b774e4
--- /dev/null
@@ -0,0 +1,16 @@
+apiVersion: v1
+kind: Service
+metadata:
+  labels:
+    name: apacheexternal
+    role: service
+  name: apacheexternal
+spec:
+  ports:
+    - port: 8800
+      targetPort: 80
+      protocol: TCP
+      name: tcp
+  selector:
+    name: webserver
+  type: NodePort
diff --git a/packer/provision/examples/apache-pod.yaml b/packer/provision/examples/apache-pod.yaml
new file mode 100644 (file)
index 0000000..cb97d13
--- /dev/null
@@ -0,0 +1,10 @@
+apiVersion: v1
+kind: Pod
+metadata:
+  name: apachetwin
+  labels:
+    name: webserver
+spec:
+  containers:
+  - name: apachetwin
+    image: fedora/apache
diff --git a/packer/provision/examples/busybox.yaml b/packer/provision/examples/busybox.yaml
new file mode 100644 (file)
index 0000000..babb765
--- /dev/null
@@ -0,0 +1,14 @@
+apiVersion: v1
+kind: Pod
+metadata:
+  name: busybox
+  namespace: default
+spec:
+  containers:
+  - image: busybox
+    command:
+      - sleep
+      - "3600"
+    imagePullPolicy: IfNotPresent
+    name: busybox
+  restartPolicy: Always
diff --git a/packer/provision/examples/nginx-pod.yaml b/packer/provision/examples/nginx-pod.yaml
new file mode 100644 (file)
index 0000000..d72959e
--- /dev/null
@@ -0,0 +1,10 @@
+apiVersion: v1
+kind: Pod
+metadata:
+  name: nginxtwin
+  labels:
+    name: webserver
+spec:
+  containers:
+  - name: nginxtwin
+    image: nginx
diff --git a/packer/provision/kubernetes.yaml b/packer/provision/kubernetes.yaml
new file mode 100644 (file)
index 0000000..ecf9e5f
--- /dev/null
@@ -0,0 +1,36 @@
+---
+- import_playbook: ../common-packer/provision/baseline.yaml
+
+- hosts: all
+  vars:
+    openvswitch_version: 2.8.2
+    openvswitch_checksum: sha256:87b4a7e7134a44ce1f808d3415a2244b4518c2b0b2a42fa2f8231e592f13103d
+    k8s_version: 1.9.4
+
+  pre_tasks:
+    - include_role: name=lfit.system-update
+
+  roles:
+    - lfit.docker-install
+    - fkautz.bridge-utils-install
+    - fkautz.golang-install
+    - fkautz.kubernetes-install
+    - fkautz.openvswitch-install
+
+- hosts: all
+  tasks:
+    - name: Make example directory
+      file:
+        path: /opt/k8s-examples
+        state: directory
+      become: true
+    - name: Copy example files to example directory
+      synchronize:
+        src: ../provision/examples/
+        dest: /opt/k8s-examples/
+      become: true
+
+  post_tasks:
+    - name: System Reseal
+      script: ../common-packer/provision/system-reseal.sh
+      become: true
diff --git a/packer/provision/roles/coe/requirements.yaml b/packer/provision/roles/coe/requirements.yaml
new file mode 100644 (file)
index 0000000..c4e1b21
--- /dev/null
@@ -0,0 +1,5 @@
+---
+- src: fkautz.bridge-utils-install
+- src: fkautz.openvswitch-install
+- src: fkautz.kubernetes-install
+- src: fkautz.golang-install
diff --git a/packer/provision/templates/odlovs-cni.conf.j2 b/packer/provision/templates/odlovs-cni.conf.j2
new file mode 100644 (file)
index 0000000..3782908
--- /dev/null
@@ -0,0 +1,22 @@
+{
+    "cniVersion": "0.3.0",
+    "name": "odl-cni",
+    "type": "odlovs-cni",
+    "mgrPort": {{ manager_port }},
+    "mgrActive": true,
+    "manager": "{{ manager_ip }}",
+    "ovsBridge": "br-int",
+    "ctlrPort": {{ controller_port }},
+    "ctlrActive": true,
+    "controller": "{{ controller_ip }}",
+    "externalIntf": "{{ external_interface }}",
+    "externalIp": "{{ external_ip }}",
+    "ipam": {
+        "type": "host-local",
+        "subnet": "{{ subnet }}",
+        "routes": [{
+            "dst": "0.0.0.0/0"
+        }],
+        "gateway": "{{ gateway }}"
+    }
+}
diff --git a/packer/templates/kubernetes.json b/packer/templates/kubernetes.json
new file mode 100644 (file)
index 0000000..bce854d
--- /dev/null
@@ -0,0 +1,64 @@
+{
+  "variables": {
+    "ansible_roles_path": "roles/coe",
+    "base_image": null,
+    "distro": null,
+    "cloud_auth_url": null,
+    "cloud_user": null,
+    "cloud_pass": null,
+    "cloud_network": null,
+    "cloud_tenant": null,
+    "cloud_user_data": null,
+    "ssh_user": null,
+    "ssh_proxy_host": ""
+  },
+  "builders": [
+    {
+      "name": "vexxhost",
+      "image_name": "ZZCI - {{user `distro`}} - kubernetes - {{isotime \"20060102-1504\"}}",
+      "source_image_name": "{{user `base_image`}}",
+      "type": "openstack",
+      "identity_endpoint": "{{user `cloud_auth_url`}}",
+      "username": "{{user `cloud_user`}}",
+      "password": "{{user `cloud_pass`}}",
+      "tenant_name": "{{user `cloud_tenant`}}",
+      "domain_name": "Default",
+      "region": "ca-ymq-1",
+      "availability_zone": "ca-ymq-2",
+      "networks": [
+        "{{user `cloud_network`}}"
+      ],
+      "user_data_file": "{{user `cloud_user_data`}}",
+      "ssh_username": "{{user `ssh_user`}}",
+      "ssh_proxy_host": "{{user `ssh_proxy_host`}}",
+      "flavor": "v1-standard-1",
+      "metadata": {
+        "ci_managed": "yes"
+      }
+    }
+  ],
+  "provisioners": [
+    {
+      "type": "shell",
+      "scripts": [
+        "common-packer/provision/install-python.sh"
+      ],
+      "execute_command": "chmod +x {{ .Path }}; if [ \"$UID\" == \"0\" ]; then {{ .Vars }} '{{ .Path }}'; else {{ .Vars }} sudo -E '{{ .Path }}'; fi"
+    },
+    {
+      "type": "shell-local",
+      "command": "./common-packer/ansible-galaxy.sh {{user `ansible_roles_path`}} provision/roles/coe/requirements.yaml"
+    },
+    {
+      "type": "ansible",
+      "playbook_file": "provision/kubernetes.yaml",
+      "ansible_env_vars": [
+        "ANSIBLE_NOCOWS=1",
+        "ANSIBLE_PIPELINING=True",
+        "ANSIBLE_ROLES_PATH={{user `ansible_roles_path`}}",
+        "ANSIBLE_CALLBACK_WHITELIST=profile_tasks",
+        "ANSIBLE_STDOUT_CALLBACK=debug"
+      ]
+    }
+  ]
+}