diff --git a/.gitignore b/.gitignore index 9ed40fc..25b1a3e 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ package* node_modules .firebaserc .firebase +automation/group_vars/all/robot-config-service.yaml diff --git a/README.md b/README.md index 49f163e..a49f0f6 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,6 @@ This repository contains all infrastructure components needed to set up and manage the Cloud Native Robotz Hackathon environment. The setup includes a complete OpenShift-based infrastructure spanning from datacenter training environments to edge gateways and individual robot configurations. -![Infrastructure Overview](overview.drawio.v2.png) - Detailed informations are available in the [facilitator-guide](https://cloud-native-robotz-hackathon.github.io/infrastructure/) ## Architecture Components diff --git a/automation/bootstrap-robot.yaml b/automation/bootstrap-robot.yaml new file mode 100644 index 0000000..ab95daa --- /dev/null +++ b/automation/bootstrap-robot.yaml @@ -0,0 +1,59 @@ +--- +- hosts: robots + gather_facts: true + vars: + edge_controller_version: v2.1.4 + robot_config_service_version: v1.0.0 + handlers: + - name: restart edge-controller + ansible.builtin.systemd: + name: edge-controller.service + state: restarted + daemon_reload: true + tasks: + - name: Slurp /robot-image-version + ansible.builtin.slurp: + src: /robot-image-version + register: robot_image_version + + - name: Check robot image version + fail: + msg: "Please check robot image version" + # image version robot-hackathon-image.20260218 + when: robot_image_version['content'] != "cm9ib3QtaGFja2F0aG9uLWltYWdlLjIwMjYwMjE4Cg==" + + # ToDo: Check if this is needed anymore + # https://github.com/cloud-native-robotz-hackathon/infrastructure/issues/230 + # - name: Rollout /etc/hosts + # ansible.builtin.lineinfile: + # path: /etc/hosts + # search_string: "{{ ansible_default_ipv4.address }}" + # line: "{{ ansible_default_ipv4.address }} robot.local {{ inventory_hostname }}" + # owner: root + # group: root + # mode: '0644' + + - name: Rollout /etc/motd + ansible.builtin.copy: + content: | + + Watch robot config service: + + tail -f /var/log/robot-config-service.log /var/log/robot-config-service-ansible-core.log + + dest: /etc/motd + mode: '0644' + + - name: "Setup edge-controller {{ edge_controller_version }}" + ansible.builtin.include_role: + name: robot + tasks_from: setup-edge-controller.yaml + + - name: Setup robot-config-service + ansible.builtin.include_role: + name: robot + tasks_from: setup-robot-config-service.yaml + + - name: reboot + ansible.builtin.reboot: + msg: "rebooting..." diff --git a/automation/check-environments.yaml b/automation/check-environments.yaml deleted file mode 100644 index 2904295..0000000 --- a/automation/check-environments.yaml +++ /dev/null @@ -1,119 +0,0 @@ ---- -- hosts: robots - gather_facts: false - tasks: - - name: "πŸ€– Robot => http://robot.local:5000/" - with_items: - - /distance - - / - tags: - - robots - ansible.builtin.uri: - url: "http://robot.local:5000{{ item }}" - method: GET - - - name: "πŸ’» Laptop => πŸ€– Robot http://πŸ€–:5000/" - with_items: - - /distance - - / - tags: - - robots - delegate_to: localhost - ansible.builtin.uri: - url: "http://{{ ansible_host }}:5000{{ item }}" - method: GET - -- hosts: datacenter - gather_facts: false - connection: local - tasks: - - name: "🏒 DataCenter - Check robot service" - tags: - - datacenter - with_items: "{{ hostvars[inventory_hostname].groups.robots }}" - kubernetes.core.k8s_info: - kubeconfig: "kubeconfig-data-center" - namespace: "robot" - api_version: v1 - kind: Service - name: "{{ item }}" - wait: true - - - name: "🏒 DataCenter - Get web-hub-controller" - tags: - - datacenter - kubernetes.core.k8s_info: - kubeconfig: "kubeconfig-data-center" - api_version: route.openshift.io/v1 - kind: Route - name: "web" - namespace: "hub-controller" - wait: true - register: web_hub_controller - - - name: "πŸ’» Laptop => 🏒 DataCenter (web-hub-controller) => πŸ€– Robot's" - with_items: "{{ hostvars[inventory_hostname].groups.robots }}" - tags: - - datacenter - ansible.builtin.uri: - url: "https://{{ web_hub_controller.resources[0].spec.host }}/robot/status?user_key={{ item }}" - method: GET - - - name: "πŸ’» Laptop => web-hub-controller dashboard " - tags: - - datacenter - ansible.builtin.uri: - url: "https://{{ web_hub_controller.resources[0].spec.host }}/dashboard.html" - method: GET - - - - name: "🏒 DataCenter => Fetch argocd applications" - tags: - - datacenter - kubernetes.core.k8s_info: - kubeconfig: "kubeconfig-data-center" - api_version: argoproj.io/v1alpha1 - kind: Application - namespace: openshift-gitops - register: application - - # - debug: var=item - # with_items: "{{ application.resources }}" - - - name: "🏒 DataCenter => Check argocd applications" - tags: - - datacenter - fail: - msg: "Sync is {{ item.status.sync.status }}" - when: item.status.sync.status is not search("Synced") - with_items: "{{ application.resources }}" - - # - name: "🏒 DataCenter via skupper to 🏭 Edge-gateway(hub-controller-live) to πŸ€– Robot" - # tags: - # - datacenter - # with_items: "{{ hostvars[inventory_hostname].groups.robots }}" - # kubernetes.core.k8s: - # state: present - # kubeconfig: "kubeconfig-data-center" - # wait: true - # wait_condition: - # type: Initialized - # reason: "PodCompleted" - # definition: - # apiVersion: v1 - # kind: Pod - # metadata: - # generateName: check-connection-to-{{ item | split('.') | first }}- - # namespace: red-hat-service-interconnect-data-center - # spec: - # restartPolicy: Never - # containers: - # - name: checker - # image: registry.access.redhat.com/ubi9/ubi-minimal:latest - # command: - # - "/bin/sh" - # - "-c" - # - | - # set -x - # curl -v http://hub-controller-live.red-hat-service-interconnect-data-center.svc.cluster.local:8080/robot/status?user_key={{ item }} - # echo diff --git a/automation/configure-robot.yaml b/automation/configure-robot.yaml deleted file mode 100644 index 0e01efe..0000000 --- a/automation/configure-robot.yaml +++ /dev/null @@ -1,101 +0,0 @@ ---- -- hosts: robots - gather_facts: true - vars: - edge_controller_version: v2.1.1 - handlers: - - name: restart edge-controller - ansible.builtin.systemd: - name: edge-controller.service - state: restarted - daemon_reload: true - tasks: - - name: Slurp /robot-image-version - ansible.builtin.slurp: - src: /robot-image-version - register: robot_image_version - - - name: Check robot image version - fail: - msg: "Please check robot image version" - # image version robot-hackathon-image.20240726 - #when: robot_image_version['content'] != "cm9ib3QtaGFja2F0aG9uLWltYWdlLjIwMjQwNzI2Cg==" - # image version robot-hackathon-image.20260212 - when: robot_image_version['content'] != "cm9ib3QtaGFja2F0aG9uLWltYWdlLjIwMjYwMjEyCg==" - - - name: Stop and remove edgehub.service systemd unit - ignore_errors: true - ansible.builtin.systemd: - name: edgehub.service - force: true - state: stopped - - # Remove old edge-controller aka edgehub - - name: Remove old edge-controller aka edgehub - ansible.builtin.file: - path: "{{ item }}" - state: absent - with_items: - - /lib/systemd/system/edgehub.service - - /usr/local/bin/edgehub.py - - - name: Rollout new version of edge-controller "{{ edge_controller_version }}" - ansible.builtin.git: - repo: https://github.com/cloud-native-robotz-hackathon/edge-controller - dest: /opt/edge-controller - version: "{{ edge_controller_version }}" - register: git_result - - - name: Install systemd.service - ansible.builtin.copy: - remote_src: true - src: /opt/edge-controller/edge-controller.service - dest: /etc/systemd/system/edge-controller.service - mode: '0644' - - - name: Enable edge-controller service - ansible.builtin.systemd: - name: edge-controller.service - enabled: true - daemon_reload: true - - - name: Restart edge-controller - ansible.builtin.systemd: - name: edge-controller.service - state: restarted - daemon_reload: true - when: git_result.changed - - - name: Check version - ansible.builtin.uri: - url: "http://{{ansible_host}}:5000/version" - method: GET - return_content: true - status_code: - - 200 - register: version_check - until: version_check is not failed and edge_controller_version in version_check.content - retries: 10 - delay: 2 - - - name: Rollout /etc/issue - ansible.builtin.copy: - content: | - Ubuntu 22.04.4 LTS \n \l - eth0: \4{eth0} - wlan0: \4{wlan0} - dest: /etc/issue - - - name: Rollout /etc/hosts - ansible.builtin.lineinfile: - path: /etc/hosts - search_string: "{{ ansible_default_ipv4.address }}" - line: "{{ ansible_default_ipv4.address }} robot.local {{ inventory_hostname }}" - owner: root - group: root - mode: '0644' - - - name: Set hostname - ansible.builtin.hostname: - name: "{{ inventory_hostname }}" - diff --git a/automation/group_vars/all/.gitkeep b/automation/group_vars/all/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/automation/inventory.yaml b/automation/inventory.yaml index fd6177f..323c0fa 100644 --- a/automation/inventory.yaml +++ b/automation/inventory.yaml @@ -4,39 +4,23 @@ all: ansible_user: root ansible_ssh_private_key_file: ~/.ssh/robot-hackathon -datacenter: - hosts: - 🏒-datacenter: - ansible_connection: local - robots: hosts: gort: - ansible_host: 192.168.8.105 team: team-1 t-1000: - ansible_host: 192.168.8.106 team: team-2 marvin: - ansible_host: 192.168.8.104 team: team-3 c3po: - ansible_host: 192.168.8.109 team: team-4 r2d2: - ansible_host: 192.168.8.108 team: team-5 marc13: - ansible_host: 192.168.8.107 team: team-6 data: - ansible_host: 192.168.8.103 team: team-7 terminator: - ansible_host: 192.168.8.100 team: team-8 ultron: - ansible_host: 192.168.8.102 team: team-9 - # robocop: - # team: team-3 diff --git a/automation/microshift-reset.yaml b/automation/microshift-reset.yaml deleted file mode 100644 index 43fc8e3..0000000 --- a/automation/microshift-reset.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- hosts: robots - gather_facts: true - tasks: - - name: Reset MicroShift - ansible.builtin.include_role: - name: robot - tasks_from: reset-microshift.yaml - - - name: Wait for api - ansible.builtin.wait_for: - port: 6443 - - - name: Info - ansible.builtin.debug: - msg: "Run export KUBECONFIG=kubeconfig-{{ inventory_hostname }}; to have oc/kubectl access." diff --git a/automation/new-data-center.yaml b/automation/new-data-center.yaml deleted file mode 100644 index 7ffa0a5..0000000 --- a/automation/new-data-center.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Reset MicroShift - import_playbook: microshift-reset.yaml - tags: - - reset-microshift - -- name: Rebuild skupper tunnel - import_playbook: skupper-tunnel.yaml - tags: - - skupper - -- name: Connect robots and teams - import_playbook: update-robot-to-team.yaml - tags: - - robot-to-team diff --git a/automation/roles/robot/tasks/reset-microshift.yaml b/automation/roles/robot/tasks/reset-microshift.yaml deleted file mode 100644 index 696e3d1..0000000 --- a/automation/roles/robot/tasks/reset-microshift.yaml +++ /dev/null @@ -1,161 +0,0 @@ ---- -# Check disk -- name: Get first mount - ansible.builtin.set_fact: - mount: "{{ ansible_mounts | first }}" - -- name: Calculation... - ansible.builtin.set_fact: - disk_usage: "{{ mount.size_total - mount.size_available }}" -- name: Calculation... - ansible.builtin.set_fact: - disk_usage_ratio: "{{ disk_usage|float / mount.size_total }}" -- name: Calculation... - ansible.builtin.set_fact: - disk_usage_s: "{{ (disk_usage|float / 1000000000) | round(1, 'common') }}GB" - disk_total_s: "{{ (mount.size_total / 1000000000) | round(1, 'common') }}GB" - disk_usage_ratio_s: "{{ 100 * (disk_usage_ratio|float) | round(1, 'common') }}%" - disk_limit_ratio_s: "{{ (100 * disk_limit|float) |round }}%" - -- name: Disk usage report - ansible.builtin.debug: - msg: "disk usage {{ disk_usage_s }} of total {{ disk_total_s }} ({{ disk_usage_ratio_s }}) (should be within limit {{ disk_limit_ratio_s }})" - -- name: Check disk - ansible.builtin.assert: - that: ( (disk_usage|float)/mount.size_total ) < disk_limit|float - msg: "Disk usage {{ disk_usage_ratio_s }} exceeds {{ disk_limit_ratio_s }}" - any_errors_fatal: true - -- name: Stop microshift - ansible.builtin.systemd_service: - state: stopped - name: microshift.service - -- name: Clean /var/lib/microshift - ansible.builtin.file: - state: absent - path: /var/lib/microshift - -- name: Check / configure /etc/hosts (robot.local, $inventoryname.lan) - ansible.builtin.lineinfile: - path: /etc/hosts - regexp: 'robot\.local' - line: "{{ ansible_host }} robot.local {{ inventory_hostname.split('.') | first }}.lan {{ inventory_hostname }}" - -- name: Creating Microshift config - ansible.builtin.copy: - dest: "/etc/microshift/config.yaml" - content: | - cluster: - domain: apps.{{ inventory_hostname }} - -- name: Create /var/lib/microshift/manifests - ansible.builtin.file: - path: /var/lib/microshift/manifests - state: directory - mode: '0755' - -- name: Creating /var/lib/microshift/manifests/pin-triton.yaml - ansible.builtin.copy: - dest: "/var/lib/microshift/manifests/pin-triton.yaml" - content: | - apiVersion: v1 - kind: Pod - metadata: - name: pin-triton-server - namespace: default - spec: - priorityClassName: system-node-critical - containers: - - name: triton - image: quay.io/cloud-native-robotz-hackathon/tritonserver:24.08-py3 - imagePullPolicy: Never - resources: - limits: - memory: "28Mi" - cpu: "200m" - requests: - memory: "28Mi" - cpu: "200m" - command: - - "/bin/sh" - - "-c" - - "sleep infinity" - restartPolicy: Never - -- name: Creating /var/lib/microshift/manifests/kustomization.yaml - ansible.builtin.copy: - dest: "/var/lib/microshift/manifests/kustomization.yaml" - content: | - apiVersion: kustomize.config.k8s.io/v1beta1 - kind: Kustomization - resources: - - pin-triton.yaml - -- name: Start microshift - ansible.builtin.systemd_service: - state: started - name: microshift.service - -- name: Wait for /var/lib/microshift/resources/kubeadmin/kubeconfig - ansible.builtin.wait_for: - path: /var/lib/microshift/resources/kubeadmin/kubeconfig - state: present - msg: Timeout to find file kubeconfig - -- name: ~/.kube/ - ansible.builtin.file: - state: directory - path: ~/.kube/ - -- name: Install kubeconfig to root user - ansible.builtin.copy: - src: "/var/lib/microshift/resources/kubeadmin/kubeconfig" - dest: "~/.kube/config" - remote_src: yes - -- name: Fetch kubeconfig - ansible.builtin.fetch: - src: "/var/lib/microshift/resources/kubeadmin/kubeconfig" - dest: "kubeconfig-{{ inventory_hostname }}" - flat: yes - - -- name: Read kubeconfig - delegate_to: localhost - include_vars: - file: "kubeconfig-{{ inventory_hostname }}" - name: kubeconfig - -- name: Rebuild new kubeconfig - set_fact: - kubeconfig: "{{ kubeconfig | combine(fields_to_change, recursive=true) }}" - vars: - fields_to_change: - clusters: - - name: "{{ inventory_hostname.split('.') | first }}" - cluster: - server: "https://{{ inventory_hostname }}:6443" - insecure-skip-tls-verify: true - contexts: - - name: "{{ inventory_hostname.split('.') | first }}" - context: - cluster: "{{ inventory_hostname.split('.') | first }}" - namespace: "default" - user: "user" - current-context: "{{ inventory_hostname.split('.') | first }}" - -- name: "Write kubeconfig" - delegate_to: localhost - copy: - content: "{{ kubeconfig | to_nice_yaml }}" - dest: "kubeconfig-{{ inventory_hostname }}" - -- name: Wait for api - ansible.builtin.wait_for: - port: 6443 - -- name: Info - ansible.builtin.debug: - msg: "Run export KUBECONFIG=kubeconfig-{{ inventory_hostname }}; to have oc/kubectl access." diff --git a/automation/roles/robot/tasks/setup-edge-controller.yaml b/automation/roles/robot/tasks/setup-edge-controller.yaml new file mode 100644 index 0000000..e2deeb6 --- /dev/null +++ b/automation/roles/robot/tasks/setup-edge-controller.yaml @@ -0,0 +1,23 @@ +--- +- name: Rollout new version of edge-controller "{{ edge_controller_version }}" + ansible.builtin.git: + repo: https://github.com/cloud-native-robotz-hackathon/edge-controller + dest: /opt/edge-controller + version: "{{ edge_controller_version }}" + force: true + register: git_result + +- name: Install systemd.service + ansible.builtin.copy: + remote_src: true + src: /opt/edge-controller/edge-controller.service + dest: /etc/systemd/system/edge-controller.service + mode: '0644' + +- name: Enable edge-controller service + ansible.builtin.systemd: + name: edge-controller.service + enabled: true + daemon_reload: true + + diff --git a/automation/roles/robot/tasks/setup-robot-config-service.yaml b/automation/roles/robot/tasks/setup-robot-config-service.yaml new file mode 100644 index 0000000..7500db9 --- /dev/null +++ b/automation/roles/robot/tasks/setup-robot-config-service.yaml @@ -0,0 +1,35 @@ +--- +- name: Rollout new version of robot-config-service "{{ robot_config_service_version }}" + ansible.builtin.git: + repo: https://github.com/cloud-native-robotz-hackathon/robot-config-service.git + dest: /opt/robot-config-service + version: "{{ robot_config_service_version }}" + force: true + register: git_result + +- name: Rollout environment file + ansible.builtin.copy: + content: | + RCS_GIT_REPO={{ rcs_git_repo }} + RCS_GH_TOKEN={{ rcs_gh_token }} + + RCS_HUBCONTROLLER_USER={{ rcs_hubcontroller_user }} + RCS_HUBCONTROLLER_PASSWORD={{ rcs_hubcontroller_password }} + + SERVICE_STARTUP_DELAY=0 + + dest: /etc/default/robot-config-service + mode: '0644' + +- name: Install systemd.service + ansible.builtin.copy: + remote_src: true + src: /opt/robot-config-service/robot-config-service.service + dest: /etc/systemd/system/robot-config-service.service + mode: '0644' + +- name: Enable robot-config-service service + ansible.builtin.systemd: + name: robot-config-service.service + enabled: true + daemon_reload: true diff --git a/automation/skupper-tunnel.yaml b/automation/skupper-tunnel.yaml deleted file mode 100644 index 97830a2..0000000 --- a/automation/skupper-tunnel.yaml +++ /dev/null @@ -1,353 +0,0 @@ ---- -# Prepare the data-center -- hosts: localhost - gather_facts: false - tags: - - data-center - tasks: - - name: Restart skupper-site-controller - kubernetes.core.k8s: - state: absent - kubeconfig: "kubeconfig-data-center" - namespace: openshift-operators - api_version: v1 - kind: Pod - label_selectors: - - app.kubernetes.io/name=skupper-site-controller - wait_condition: - type: Ready - status: 'True' - - - name: Destroy a namespaces - kubernetes.core.k8s: - state: absent - wait: true - kubeconfig: "kubeconfig-data-center" - definition: - apiVersion: v1 - kind: Namespace - metadata: - name: robot - spec: {} - - - name: Create a namespaces - kubernetes.core.k8s: - state: present - wait: true - kubeconfig: "kubeconfig-data-center" - definition: - apiVersion: v1 - kind: Namespace - metadata: - name: robot - spec: {} - - - name: Start skupper at data-center - kubernetes.core.k8s: - state: present - kubeconfig: "kubeconfig-data-center" - definition: - apiVersion: v1 - kind: ConfigMap - metadata: - name: skupper-site - namespace: robot - data: - cluster-permissions: "false" - console: "true" - console-authentication: internal - console-password: "" - console-user: "" - enable-skupper-events: "true" - flow-collector: "true" - ingress: route - name: data-center - router-console: "false" - router-logging: "" - router-mode: interior - service-controller: "true" - service-sync: "true" - - - name: Wait for skupper-site - kubernetes.core.k8s_info: - kubeconfig: "kubeconfig-data-center" - namespace: "robot" - api_version: v1 - kind: Pods - label_selectors: - app.kubernetes.io/part-of=skupper - wait: true - wait_condition: - type: Ready - -- hosts: robots - gather_facts: false - tags: - - robots - tasks: - - # - name: Reset MicroShift - # ansible.builtin.include_role: - # name: robot - # tasks_from: reset-microshift.yaml - - - name: Download kubeconfig - ansible.builtin.include_role: - name: robot - tasks_from: download-kubeconfig.yaml - - - name: Destroy skupper a namespaces - delegate_to: localhost - kubernetes.core.k8s: - state: absent - wait: true - kubeconfig: "kubeconfig-{{ inventory_hostname }}" - definition: - apiVersion: v1 - kind: Namespace - metadata: - name: skupper - spec: {} - - - name: Create skupper a namespaces - delegate_to: localhost - kubernetes.core.k8s: - state: present - wait: true - kubeconfig: "kubeconfig-{{ inventory_hostname }}" - definition: - apiVersion: v1 - kind: Namespace - metadata: - name: skupper - spec: {} - - - name: Download skupper - ansible.builtin.get_url: - url: https://github.com/skupperproject/skupper/releases/download/1.8.3/skupper-cli-1.8.3-linux-arm64.tgz - dest: /tmp/skupper.tgz - checksum: md5:6950f429a712fcd6cec0d67bc87a6f2f - - - name: Unarchive skupper - ansible.builtin.unarchive: - src: /tmp/skupper.tgz - dest: /usr/local/bin - remote_src: yes - - - name: Init Skupper - ansible.builtin.shell: - cmd: "/usr/local/bin/skupper init --ingress none --namespace skupper --site-name {{ inventory_hostname }}" - - - name: Token request for robot - delegate_to: localhost - kubernetes.core.k8s: - state: present - kubeconfig: "kubeconfig-data-center" - definition: - apiVersion: v1 - kind: Secret - metadata: - namespace: robot - labels: - skupper.io/type: connection-token-request - name: "{{ inventory_hostname }}" - - - name: Fetch secret from data-center - delegate_to: localhost - kubernetes.core.k8s_info: - kubeconfig: "kubeconfig-data-center" - api_version: v1 - kind: Secret - name: "{{ inventory_hostname }}" - namespace: robot - register: token_secret - retries: 10 - until: token_secret.resources[0].metadata.labels['skupper.io/type'] == "connection-token" - - - name: Extract & change token - ansible.builtin.set_fact: - token: "{{ token_secret.resources[0] | combine(to_change, recursive=true) }}" - vars: - to_change: - metadata: - namespace: skupper - resourceVersion: - uid: - creationTimestamp: - - - name: Apply token at robot - delegate_to: localhost - kubernetes.core.k8s: - state: present - kubeconfig: "kubeconfig-{{ inventory_hostname }}" - definition: "{{ token }}" - - - name: Deploy reverse proxy - delegate_to: localhost - tags: - - deploy-reverse-proxy - - reverse-proxy - kubernetes.core.k8s: - state: present - kubeconfig: "kubeconfig-{{ inventory_hostname }}" - wait: yes - wait_condition: - type: Available - status: "True" - reason: MinimumReplicasAvailable - definition: - apiVersion: apps/v1 - kind: Deployment - metadata: - name: "{{ inventory_hostname }}" - namespace: skupper - labels: - app: reverse-proxy - app.openshift.io/runtime: traefik - app.kubernetes.io/part-of: reverse-proxy - spec: - replicas: 1 - strategy: - type: Recreate - selector: - matchLabels: - app: reverse-proxy - template: - metadata: - labels: - app: reverse-proxy - spec: - automountServiceAccountToken: false - containers: - - image: quay.io/cloud-native-robotz-hackathon/ubi-traefik:20250324T164622 - name: traefik - ports: - - name: edge-controller - containerPort: 5000 - - name: k8s-api - containerPort: 6443 - - name: ingress-http - containerPort: 80 - - name: ingress-https - containerPort: 443 - env: - - name: HOST_IP - valueFrom: - fieldRef: - fieldPath: status.hostIP - - # skupper expose deployment --namespace skupper reverse-proxy - # deployment reverse-proxy exposed as reverse-proxy - - name: Expose reverse-proxy - tags: - - reverse-proxy - - expose-reverse-proxy - ansible.builtin.shell: - cmd: "/usr/local/bin/skupper expose deployment --namespace skupper {{ inventory_hostname }}" - - - name: Get ingress domain - delegate_to: localhost - tags: - - check - kubernetes.core.k8s_info: - kubeconfig: "kubeconfig-data-center" - namespace: "openshift-ingress-operator" - api_version: operator.openshift.io/v1 - kind: IngressController - name: "default" - register: raw_ingress_controller - - - - name: Create wildcard-http - delegate_to: localhost - kubernetes.core.k8s: - state: present - wait: true - kubeconfig: "kubeconfig-data-center" - definition: - apiVersion: route.openshift.io/v1 - kind: Route - metadata: - name: "{{ inventory_hostname }}-http" - namespace: robot - spec: - host: "wildcard-http.{{ inventory_hostname }}.{{ raw_ingress_controller.resources[0].status.domain }}" - path: / - to: - name: "{{ inventory_hostname }}" - weight: 100 - kind: Service - port: - targetPort: port80 - wildcardPolicy: Subdomain - alternateBackends: [] - - - name: Create wildcard-https - delegate_to: localhost - kubernetes.core.k8s: - state: present - wait: true - kubeconfig: "kubeconfig-data-center" - definition: - apiVersion: route.openshift.io/v1 - kind: Route - metadata: - name: "{{ inventory_hostname }}-https" - namespace: robot - spec: - host: "wildcard-https.{{ inventory_hostname }}.{{ raw_ingress_controller.resources[0].status.domain }}" - to: - name: "{{ inventory_hostname }}" - weight: 100 - kind: Service - port: - targetPort: port443 - tls: - termination: passthrough - insecureEdgeTerminationPolicy: None - wildcardPolicy: Subdomain - alternateBackends: [] - - - name: Wait robot services - delegate_to: localhost - tags: - - check - kubernetes.core.k8s_info: - kubeconfig: "kubeconfig-data-center" - namespace: "robot" - api_version: v1 - kind: Service - name: "{{ inventory_hostname }}" - wait: true - - - name: Run check pod - delegate_to: localhost - tags: - - check - kubernetes.core.k8s: - state: present - kubeconfig: "kubeconfig-data-center" - wait: true - wait_condition: - type: Initialized - reason: "PodCompleted" - definition: - apiVersion: v1 - kind: Pod - metadata: - generateName: "check-skupper-connect-{{ inventory_hostname }}-" - namespace: robot - spec: - restartPolicy: Never - containers: - - name: checker - image: registry.access.redhat.com/ubi9/ubi-minimal:latest - command: - - "/bin/sh" - - "-c" - - | - set -x - curl http://{{ inventory_hostname }}.robot.svc.cluster.local:5000/ - curl -k https://{{ inventory_hostname }}.robot.svc.cluster.local:6443/ - curl http://{{ inventory_hostname }}.robot.svc.cluster.local:80/ - curl -k https://{{ inventory_hostname }}.robot.svc.cluster.local:443/ diff --git a/automation/update-robot-to-team.yaml b/automation/update-robot-to-team.yaml deleted file mode 100644 index b288cab..0000000 --- a/automation/update-robot-to-team.yaml +++ /dev/null @@ -1,115 +0,0 @@ ---- -- hosts: robots - gather_facts: false - tasks: - - - name: Check is team is defined - fail: - msg: Please configure a team for the robot! - when: team is not defined - - - name: Download kubeconfig - ansible.builtin.include_role: - name: robot - tasks_from: download-kubeconfig.yaml - - - name: Build config - ansible.builtin.set_fact: - config: | - { - "tlsClientConfig": { - "insecure": true, - "certData": "{{ kubeconfig.users[0].user['client-certificate-data'] }}", - "keyData": "{{ kubeconfig.users[0].user['client-key-data'] }}" - } - } - - - name: Create a argocd cluster secret - delegate_to: localhost - kubernetes.core.k8s: - state: present - kubeconfig: "kubeconfig-data-center" - definition: - apiVersion: v1 - kind: Secret - type: Opaque - metadata: - name: "cluster-{{ inventory_hostname }}" - namespace: openshift-gitops - labels: - argocd.argoproj.io/secret-type: cluster - stringData: - name: "{{ inventory_hostname }}" - server: "https://{{ inventory_hostname }}.robot.svc.cluster.local.:6443" - config: "{{ config | to_json }}" - - - name: Get git url from data-center - delegate_to: localhost - kubernetes.core.k8s_info: - kubeconfig: "kubeconfig-data-center" - api_version: route.openshift.io/v1 - kind: Route - name: gitea - namespace: gitea - register: gitea_route - - # - debug: - # var: gitea_route.resources[0].spec.host - - # - debug: - # var: team - - - name: Apply AppProject to data-center - delegate_to: localhost - kubernetes.core.k8s: - state: present - kubeconfig: "kubeconfig-data-center" - definition: - apiVersion: argoproj.io/v1alpha1 - kind: AppProject - metadata: - name: "{{ team }}" - namespace: openshift-gitops - spec: - clusterResourceWhitelist: - - group: '*' - kind: '*' - namespaceResourceWhitelist: - - group: '*' - kind: '*' - destinations: - - name: '*' - namespace: '*' - server: :"https://{{ inventory_hostname }}.robot.svc.cluster.local.:6443" - roles: - - groups: - - "{{ team }}" - name: "{{ team }}-admin" - policies: - - "p, proj:{{ team }}:{{ team }}-admin, applications, *, {{ team }}/*, allow" - sourceRepos: - - '*' - - - name: Apply Application to data-center - delegate_to: localhost - kubernetes.core.k8s: - state: present - kubeconfig: "kubeconfig-data-center" - definition: - apiVersion: argoproj.io/v1alpha1 - kind: Application - metadata: - name: "{{ team }}-robot-gitops" - namespace: openshift-gitops - spec: - destination: - server: "https://{{ inventory_hostname }}.robot.svc.cluster.local.:6443" - project: "{{ team }}" - source: - path: base/ - repoURL: "https://{{ gitea_route.resources[0].spec.host }}/{{ team }}/robot-gitops.git" - targetRevision: HEAD - syncPolicy: - automated: {} - syncOptions: - - CreateNamespace=true diff --git a/container-images/workbench-object-detection/Containerfile b/container-images/workbench-object-detection/Containerfile index 44b8ebc..b33b921 100644 --- a/container-images/workbench-object-detection/Containerfile +++ b/container-images/workbench-object-detection/Containerfile @@ -1 +1,15 @@ -FROM quay.io/mmurakam/workbenches:object-detection-v2.1.0 +# Based on https://github.com/mamurak/os-mlops/blob/main/container-images/object-detection/Containerfile-workbench +# FROM quay.io/mmurakam/workbenches:object-detection-v2.1.0 +FROM quay.io/modh/odh-pytorch-notebook:v3-20250827-3a59e5e + +RUN pip install pip==25.3 setuptools==75.8.2 + +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt && \ + pip uninstall -y ray + +ADD jupyter-webrtc.json /opt/app-root/etc/jupyter/nbconfig/notebook.d/ + +RUN chmod -R g+w /opt/app-root/lib/python3.11/site-packages && \ + fix-permissions /opt/app-root -P + diff --git a/container-images/workbench-object-detection/README.md b/container-images/workbench-object-detection/README.md new file mode 100644 index 0000000..146322e --- /dev/null +++ b/container-images/workbench-object-detection/README.md @@ -0,0 +1,12 @@ +# Info + +## on MacOS + +```shell + +podman build --platform linux/amd64 \ + -t quay.io/cloud-native-robotz-hackathon/workbench-object-detection:devel \ + . + +``` + diff --git a/container-images/workbench-object-detection/jupyter-webrtc.json b/container-images/workbench-object-detection/jupyter-webrtc.json new file mode 100644 index 0000000..dcb3329 --- /dev/null +++ b/container-images/workbench-object-detection/jupyter-webrtc.json @@ -0,0 +1,5 @@ +{ + "load_extensions": { + "jupyter-webrtc/extension": true + } +} \ No newline at end of file diff --git a/container-images/workbench-object-detection/requirements.txt b/container-images/workbench-object-detection/requirements.txt new file mode 100644 index 0000000..3e5b4a5 --- /dev/null +++ b/container-images/workbench-object-detection/requirements.txt @@ -0,0 +1,22 @@ +onnx +onnxruntime-gpu +openimages +Pillow +ultralytics==8.0.196 +seaborn +boto3 +torch +torchvision +PyYAML>=5.3.1 +scipy>=1.4.1 +matplotlib>=3.2.2 +opencv-python>=4.1.1 +Pillow>=7.1.2 +numpy>=1.18.5 +requests>=2.23.0 +pandas>=1.1.4 +tqdm>=4.64.0 +psutil +thop>=0.1.1 +ipywebrtc>=0.6.0 +jupyter-ui-poll==1.1.0 diff --git a/datacenter/cluster-configuration/base/cluster-scope/TektonConfig/config.yaml b/datacenter/cluster-configuration/base/cluster-scope/TektonConfig/config.yaml new file mode 100644 index 0000000..3e401eb --- /dev/null +++ b/datacenter/cluster-configuration/base/cluster-scope/TektonConfig/config.yaml @@ -0,0 +1,11 @@ +# https://github.com/cloud-native-robotz-hackathon/infrastructure/issues/237 +--- +apiVersion: operator.tekton.dev/v1alpha1 +kind: TektonConfig +metadata: + name: config + annotations: + argocd.argoproj.io/sync-options: "ServerSideApply=true,Validate=false" +spec: + pipeline: + coschedule: disabled diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/Route/kustomization.yaml b/datacenter/cluster-configuration/base/cluster-scope/TektonConfig/kustomization.yaml similarity index 84% rename from datacenter/cluster-configuration/base/namespace/hub-controller/Route/kustomization.yaml rename to datacenter/cluster-configuration/base/cluster-scope/TektonConfig/kustomization.yaml index 344d62a..20955c4 100644 --- a/datacenter/cluster-configuration/base/namespace/hub-controller/Route/kustomization.yaml +++ b/datacenter/cluster-configuration/base/cluster-scope/TektonConfig/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- web.yaml +- config.yaml diff --git a/datacenter/cluster-configuration/base/cluster-scope/kustomization.yaml b/datacenter/cluster-configuration/base/cluster-scope/kustomization.yaml index 0468a7f..4ef49f5 100644 --- a/datacenter/cluster-configuration/base/cluster-scope/kustomization.yaml +++ b/datacenter/cluster-configuration/base/cluster-scope/kustomization.yaml @@ -7,3 +7,4 @@ resources: # Disabled: https://github.com/cloud-native-robotz-hackathon/infrastructure/issues/182 # - OAuth/ - Auth/ +- TektonConfig/ diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/ConfigMap/robot-mapping-configmap.yaml b/datacenter/cluster-configuration/base/namespace/hub-controller/ConfigMap/robot-mapping-configmap.yaml deleted file mode 100644 index ee533f7..0000000 --- a/datacenter/cluster-configuration/base/namespace/hub-controller/ConfigMap/robot-mapping-configmap.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: v1 -data: - MAP: | - { - "gort": "gort.robot.svc.cluster.local.", - "t-1000": "t-1000.robot.svc.cluster.local.", - "marvin": "marvin.robot.svc.cluster.local.", - "c3po": "c3po.robot.svc.cluster.local.", - "r2d2": "r2d2.robot.svc.cluster.local.", - "marc13": "marc13.robot.svc.cluster.local.", - "data": "data.robot.svc.cluster.local.", - "terminator": "terminator.robot.svc.cluster.local.", - "ultron": "ultron.robot.svc.cluster.local." - } -immutable: false -kind: ConfigMap -metadata: - name: robot-mapping-configmap diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/Deployment/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/hub-controller/Deployment/kustomization.yaml deleted file mode 100644 index e213572..0000000 --- a/datacenter/cluster-configuration/base/namespace/hub-controller/Deployment/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- hub-controller-live.yaml diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/Service/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/hub-controller/Service/kustomization.yaml deleted file mode 100644 index 3490bcd..0000000 --- a/datacenter/cluster-configuration/base/namespace/hub-controller/Service/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- hub-controller-live.yaml -- api.yaml diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/hub-controller/kustomization.yaml deleted file mode 100644 index 5f1b769..0000000 --- a/datacenter/cluster-configuration/base/namespace/hub-controller/kustomization.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: hub-controller -resources: -- ConfigMap/ -- Deployment/ -- Service/ -- Route/ -- Namespace/ diff --git a/datacenter/cluster-configuration/base/namespace/image-puller/configmap.yaml b/datacenter/cluster-configuration/base/namespace/image-puller/configmap.yaml index a790ac9..3fefea6 100644 --- a/datacenter/cluster-configuration/base/namespace/image-puller/configmap.yaml +++ b/datacenter/cluster-configuration/base/namespace/image-puller/configmap.yaml @@ -5,6 +5,7 @@ metadata: data: IMAGES: | object-detection-v2-1-0=quay.io/cloud-native-robotz-hackathon/workbench-object-detection:v2.1.0; + object-detection-v3-0-1=quay.io/cloud-native-robotz-hackathon/workbench-object-detection:v3.0.1; object-detection-runtime-v2-1-0=quay.io/mmurakam/runtimes:object-detection-v2.1.0; code-rhel9=registry.redhat.io/devspaces/code-rhel9@sha256:50e457ca3c17e0c471a8fb44ee7f9c9c650d422087f7f52e774b88c84ce741fd; traefik-rhel9=registry.redhat.io/devspaces/traefik-rhel9@sha256:780c2a69b8910067d9435877b94d93c8cf168a424bfa99c90f2f0ddb7b20c2a5; diff --git a/datacenter/cluster-configuration/base/namespace/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/kustomization.yaml index 8f26757..e970578 100644 --- a/datacenter/cluster-configuration/base/namespace/kustomization.yaml +++ b/datacenter/cluster-configuration/base/namespace/kustomization.yaml @@ -4,6 +4,8 @@ resources: - redhat-ods-applications/ - image-puller/ - openshift-config/ -- hub-controller/ +- openshift-operators/ +- openshift-gitops/ - openshift-ingress-operator/ - code-assistant/ +- robot/ diff --git a/datacenter/cluster-configuration/base/namespace/openshift-gitops/Role/hub-controller.yaml b/datacenter/cluster-configuration/base/namespace/openshift-gitops/Role/hub-controller.yaml new file mode 100644 index 0000000..82bda8f --- /dev/null +++ b/datacenter/cluster-configuration/base/namespace/openshift-gitops/Role/hub-controller.yaml @@ -0,0 +1,11 @@ +# Role for hubcontroller in the openshift-gitops namespace +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: hubcontroller-role + namespace: openshift-gitops +rules: +# Secret management (for Skupper connection tokens) +- apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "list", "create", "update", "patch", "watch"] diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/Namespace/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/openshift-gitops/Role/kustomization.yaml similarity index 100% rename from datacenter/cluster-configuration/base/namespace/hub-controller/Namespace/kustomization.yaml rename to datacenter/cluster-configuration/base/namespace/openshift-gitops/Role/kustomization.yaml diff --git a/datacenter/cluster-configuration/base/namespace/openshift-gitops/RoleBinding/hub-controller.yaml b/datacenter/cluster-configuration/base/namespace/openshift-gitops/RoleBinding/hub-controller.yaml new file mode 100644 index 0000000..409e6c0 --- /dev/null +++ b/datacenter/cluster-configuration/base/namespace/openshift-gitops/RoleBinding/hub-controller.yaml @@ -0,0 +1,14 @@ +# RoleBinding for hubcontroller in the openshift-gitops namespace +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: hubcontroller-rolebinding + namespace: openshift-gitops +subjects: + - kind: ServiceAccount + name: hub-controller + namespace: hub-controller +roleRef: + kind: Role + name: hubcontroller-role + apiGroup: rbac.authorization.k8s.io diff --git a/edge-gateway/cluster-configuration/namespace/openshift-gitops/Application/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/openshift-gitops/RoleBinding/kustomization.yaml similarity index 100% rename from edge-gateway/cluster-configuration/namespace/openshift-gitops/Application/kustomization.yaml rename to datacenter/cluster-configuration/base/namespace/openshift-gitops/RoleBinding/kustomization.yaml diff --git a/datacenter/cluster-configuration/base/namespace/openshift-gitops/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/openshift-gitops/kustomization.yaml new file mode 100644 index 0000000..9f8f451 --- /dev/null +++ b/datacenter/cluster-configuration/base/namespace/openshift-gitops/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- Role/ +- RoleBinding/ diff --git a/datacenter/cluster-configuration/base/namespace/openshift-operators/Role/hub-controller.yaml b/datacenter/cluster-configuration/base/namespace/openshift-operators/Role/hub-controller.yaml new file mode 100644 index 0000000..a6612ff --- /dev/null +++ b/datacenter/cluster-configuration/base/namespace/openshift-operators/Role/hub-controller.yaml @@ -0,0 +1,12 @@ +# Role for hubcontroller in the openshift-operators namespace +# Allows restarting the skupper-site-controller pod +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: hubcontroller-role + namespace: openshift-operators +rules: + # Pod management (for restarting skupper-site-controller) + - apiGroups: [""] + resources: ["pods"] + verbs: ["get", "list", "delete", "watch"] diff --git a/edge-gateway/hub-controller/Namespace/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/openshift-operators/Role/kustomization.yaml similarity index 100% rename from edge-gateway/hub-controller/Namespace/kustomization.yaml rename to datacenter/cluster-configuration/base/namespace/openshift-operators/Role/kustomization.yaml diff --git a/datacenter/cluster-configuration/base/namespace/openshift-operators/RoleBinding/hub-controller.yaml b/datacenter/cluster-configuration/base/namespace/openshift-operators/RoleBinding/hub-controller.yaml new file mode 100644 index 0000000..1a76ce4 --- /dev/null +++ b/datacenter/cluster-configuration/base/namespace/openshift-operators/RoleBinding/hub-controller.yaml @@ -0,0 +1,14 @@ +# RoleBinding for hubcontroller in the openshift-operators namespace +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: hubcontroller-rolebinding + namespace: openshift-operators +subjects: + - kind: ServiceAccount + name: hub-controller + namespace: hub-controller +roleRef: + kind: Role + name: hubcontroller-role + apiGroup: rbac.authorization.k8s.io diff --git a/edge-gateway/cluster-configuration/namespace/openshift-gitops/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/openshift-operators/RoleBinding/kustomization.yaml similarity index 77% rename from edge-gateway/cluster-configuration/namespace/openshift-gitops/kustomization.yaml rename to datacenter/cluster-configuration/base/namespace/openshift-operators/RoleBinding/kustomization.yaml index ca0e0d7..efa9741 100644 --- a/edge-gateway/cluster-configuration/namespace/openshift-gitops/kustomization.yaml +++ b/datacenter/cluster-configuration/base/namespace/openshift-operators/RoleBinding/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- Application/ +- hub-controller.yaml diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/ConfigMap/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/openshift-operators/kustomization.yaml similarity index 58% rename from datacenter/cluster-configuration/base/namespace/hub-controller/ConfigMap/kustomization.yaml rename to datacenter/cluster-configuration/base/namespace/openshift-operators/kustomization.yaml index 91bc463..87b67b9 100644 --- a/datacenter/cluster-configuration/base/namespace/hub-controller/ConfigMap/kustomization.yaml +++ b/datacenter/cluster-configuration/base/namespace/openshift-operators/kustomization.yaml @@ -1,4 +1,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization +namespace: openshift-operators resources: -- robot-mapping-configmap.yaml +- Role/ +- RoleBinding/ diff --git a/datacenter/cluster-configuration/base/namespace/redhat-ods-applications/ImageStream/object-detection.yaml b/datacenter/cluster-configuration/base/namespace/redhat-ods-applications/ImageStream/object-detection.yaml index de8ef38..bcca9ac 100644 --- a/datacenter/cluster-configuration/base/namespace/redhat-ods-applications/ImageStream/object-detection.yaml +++ b/datacenter/cluster-configuration/base/namespace/redhat-ods-applications/ImageStream/object-detection.yaml @@ -30,4 +30,16 @@ spec: opendatahub.io/notebook-python-dependencies: >- [{"name":"opencv","version":"4.8.0.74"},{"name":"ultralytics","version":"8.0.130"},{"name":"onnxruntime","version":"1.15.1"}] opendatahub.io/notebook-software: '[{"name":"Python","version":"3.9"}]' + - name: "3.0.1" + from: + kind: DockerImage + name: quay.io/cloud-native-robotz-hackathon/workbench-object-detection:v3.0.1 + importPolicy: {} + referencePolicy: + type: Local + annotations: + opendatahub.io/notebook-build-commit: cb56bca + opendatahub.io/notebook-python-dependencies: >- + [{"name":"opencv","version":"4.12.0.88"},{"name":"ultralytics","version":"8.0.196"},{"name":"onnx","version":"1.18.0"}] + opendatahub.io/notebook-software: '[{"name":"Python","version":"3.11"}]' opendatahub.io/workbench-image-recommended: "true" diff --git a/datacenter/cluster-configuration/base/namespace/robot/Role/hub-controller.yaml b/datacenter/cluster-configuration/base/namespace/robot/Role/hub-controller.yaml new file mode 100644 index 0000000..ee6eb35 --- /dev/null +++ b/datacenter/cluster-configuration/base/namespace/robot/Role/hub-controller.yaml @@ -0,0 +1,13 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: hub-controller +rules: + # ConfigMap management (for skupper-site ConfigMap) + - apiGroups: [""] + resources: ["configmaps"] + verbs: ["get", "list", "create", "update", "patch", "watch"] + # Secret management (for Skupper connection tokens) + - apiGroups: [""] + resources: ["secrets"] + verbs: ["get", "list", "create", "update", "patch", "watch"] diff --git a/edge-gateway/cluster-configuration/namespace/openshift-operators/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/robot/Role/kustomization.yaml similarity index 77% rename from edge-gateway/cluster-configuration/namespace/openshift-operators/kustomization.yaml rename to datacenter/cluster-configuration/base/namespace/robot/Role/kustomization.yaml index 4535529..efa9741 100644 --- a/edge-gateway/cluster-configuration/namespace/openshift-operators/kustomization.yaml +++ b/datacenter/cluster-configuration/base/namespace/robot/Role/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- Subscription/ +- hub-controller.yaml diff --git a/datacenter/cluster-configuration/base/namespace/robot/RoleBinding/hub-controller.yaml b/datacenter/cluster-configuration/base/namespace/robot/RoleBinding/hub-controller.yaml new file mode 100644 index 0000000..66a7d65 --- /dev/null +++ b/datacenter/cluster-configuration/base/namespace/robot/RoleBinding/hub-controller.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: hub-controller +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: hub-controller +subjects: +- kind: ServiceAccount + name: hub-controller + namespace: hub-controller diff --git a/edge-gateway/cluster-configuration/cluster-scope/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/robot/RoleBinding/kustomization.yaml similarity index 77% rename from edge-gateway/cluster-configuration/cluster-scope/kustomization.yaml rename to datacenter/cluster-configuration/base/namespace/robot/RoleBinding/kustomization.yaml index 1fe08aa..efa9741 100644 --- a/edge-gateway/cluster-configuration/cluster-scope/kustomization.yaml +++ b/datacenter/cluster-configuration/base/namespace/robot/RoleBinding/kustomization.yaml @@ -1,4 +1,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ClusterRoleBinding/ +- hub-controller.yaml diff --git a/edge-gateway/cluster-configuration/namespace/skupper-private/kustomization.yaml b/datacenter/cluster-configuration/base/namespace/robot/kustomization.yaml similarity index 69% rename from edge-gateway/cluster-configuration/namespace/skupper-private/kustomization.yaml rename to datacenter/cluster-configuration/base/namespace/robot/kustomization.yaml index 9783cf5..ff5d416 100644 --- a/edge-gateway/cluster-configuration/namespace/skupper-private/kustomization.yaml +++ b/datacenter/cluster-configuration/base/namespace/robot/kustomization.yaml @@ -1,6 +1,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: skupper-private +namespace: robot resources: - namespace.yaml -- ConfigMap/ +- Role/ +- RoleBinding/ diff --git a/edge-gateway/cluster-configuration/namespace/skupper-private/namespace.yaml b/datacenter/cluster-configuration/base/namespace/robot/namespace.yaml similarity index 55% rename from edge-gateway/cluster-configuration/namespace/skupper-private/namespace.yaml rename to datacenter/cluster-configuration/base/namespace/robot/namespace.yaml index b337e9a..7b6698e 100644 --- a/edge-gateway/cluster-configuration/namespace/skupper-private/namespace.yaml +++ b/datacenter/cluster-configuration/base/namespace/robot/namespace.yaml @@ -1,5 +1,5 @@ apiVersion: v1 kind: Namespace metadata: - name: skupper-private -spec: {} + name: robot +spec: diff --git a/datacenter/hub-controller/.helmignore b/datacenter/hub-controller/.helmignore new file mode 100755 index 0000000..0e8a0eb --- /dev/null +++ b/datacenter/hub-controller/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/datacenter/hub-controller/Chart.yaml b/datacenter/hub-controller/Chart.yaml new file mode 100755 index 0000000..fecf6a9 --- /dev/null +++ b/datacenter/hub-controller/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: HubController +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/Deployment/hub-controller-live.yaml b/datacenter/hub-controller/templates/Deployment/hub-controller.yaml similarity index 73% rename from datacenter/cluster-configuration/base/namespace/hub-controller/Deployment/hub-controller-live.yaml rename to datacenter/hub-controller/templates/Deployment/hub-controller.yaml index a93cfae..923bf27 100644 --- a/datacenter/cluster-configuration/base/namespace/hub-controller/Deployment/hub-controller-live.yaml +++ b/datacenter/hub-controller/templates/Deployment/hub-controller.yaml @@ -2,38 +2,37 @@ apiVersion: apps/v1 kind: Deployment metadata: labels: - app: hub-controller-live + app: hub-controller app.kubernetes.io/managed-by: quarkus app.openshift.io/runtime: quarkus annotations: app.openshift.io/vcs-uri: git@github.com:cloud-native-robotz-hackathon/hubcontroller-rest-quarkus.git app.quarkus.io/vcs-uri: https://github.com/cloud-native-robotz-hackathon/hubcontroller-rest-quarkus.git - name: hub-controller-live + name: hub-controller spec: replicas: 1 selector: matchLabels: - app: hub-controller-live + app: hub-controller strategy: type: RollingUpdate template: metadata: labels: - app: hub-controller-live + app: hub-controller spec: + serviceAccountName: hub-controller containers: - - env: - - name: MAP - valueFrom: - configMapKeyRef: - key: MAP - name: robot-mapping-configmap - - name: KUBERNETES_NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: quay.io/cloud-native-robotz-hackathon/hubcontroller-rest-quarkus:latest-native + - envFrom: + - secretRef: + name: hub-controller-config + env: + - name: KUBERNETES_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + image: quay.io/cloud-native-robotz-hackathon/hubcontroller-rest-quarkus:v3-native imagePullPolicy: Always name: hub-controller livenessProbe: diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/Namespace/hub-controller.yaml b/datacenter/hub-controller/templates/Namespace/hub-controller.yaml similarity index 100% rename from datacenter/cluster-configuration/base/namespace/hub-controller/Namespace/hub-controller.yaml rename to datacenter/hub-controller/templates/Namespace/hub-controller.yaml diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/Route/web.yaml b/datacenter/hub-controller/templates/Route/web.yaml similarity index 82% rename from datacenter/cluster-configuration/base/namespace/hub-controller/Route/web.yaml rename to datacenter/hub-controller/templates/Route/web.yaml index c771a3d..5ae4bff 100644 --- a/datacenter/cluster-configuration/base/namespace/hub-controller/Route/web.yaml +++ b/datacenter/hub-controller/templates/Route/web.yaml @@ -3,12 +3,12 @@ apiVersion: route.openshift.io/v1 metadata: name: web labels: - app: hub-controller-live + app: hub-controller app.kubernetes.io/instance: hub-controller spec: to: kind: Service - name: hub-controller-live + name: hub-controller weight: 100 port: targetPort: http diff --git a/datacenter/hub-controller/templates/Secrets/hub-controller-config.yaml b/datacenter/hub-controller/templates/Secrets/hub-controller-config.yaml new file mode 100644 index 0000000..fb7ed15 --- /dev/null +++ b/datacenter/hub-controller/templates/Secrets/hub-controller-config.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Secret +metadata: + name: hub-controller-config + namespace: hub-controller +stringData: + DASHBOARD_PASSWORD: "{{ .Values.api_password }}" + MAP: | + { + "robot-dummy": "robot-dummy.default.svc.cluster.local." + } +type: Opaque \ No newline at end of file diff --git a/datacenter/hub-controller/templates/Secrets/repo-updater-config.yaml b/datacenter/hub-controller/templates/Secrets/repo-updater-config.yaml new file mode 100644 index 0000000..5a22143 --- /dev/null +++ b/datacenter/hub-controller/templates/Secrets/repo-updater-config.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Secret +metadata: + name: repo-updater-config + namespace: hub-controller +type: Opaque +stringData: + RU_ROBOT_NAMES: {{ range $i, $value := .Values.team_robot_map }}{{ $value.robot_name }} {{ end }} + {{- if .Values.ru_repo_url }} + RU_REPO_URL: {{ .Values.ru_repo_url }} + {{- end }} + {{- if .Values.ru_repo_token }} + RU_REPO_TOKEN: {{ .Values.ru_repo_token }} + {{- end }} diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/Service/api.yaml b/datacenter/hub-controller/templates/Service/api.yaml similarity index 85% rename from datacenter/cluster-configuration/base/namespace/hub-controller/Service/api.yaml rename to datacenter/hub-controller/templates/Service/api.yaml index 175e14d..5b2b70b 100644 --- a/datacenter/cluster-configuration/base/namespace/hub-controller/Service/api.yaml +++ b/datacenter/hub-controller/templates/Service/api.yaml @@ -10,5 +10,5 @@ spec: protocol: TCP targetPort: 8080 selector: - app: hub-controller-live + app: hub-controller type: ClusterIP diff --git a/datacenter/cluster-configuration/base/namespace/hub-controller/Service/hub-controller-live.yaml b/datacenter/hub-controller/templates/Service/hub-controller.yaml similarity index 84% rename from datacenter/cluster-configuration/base/namespace/hub-controller/Service/hub-controller-live.yaml rename to datacenter/hub-controller/templates/Service/hub-controller.yaml index 046b193..61d1eab 100644 --- a/datacenter/cluster-configuration/base/namespace/hub-controller/Service/hub-controller-live.yaml +++ b/datacenter/hub-controller/templates/Service/hub-controller.yaml @@ -2,10 +2,10 @@ apiVersion: v1 kind: Service metadata: labels: - app: hub-controller-live + app: hub-controller app.kubernetes.io/managed-by: quarkus app.openshift.io/runtime: quarkus - name: hub-controller-live + name: hub-controller annotations: app.openshift.io/vcs-uri: git@github.com:cloud-native-robotz-hackathon/hubcontroller-rest-quarkus.git app.quarkus.io/vcs-uri: https://github.com/cloud-native-robotz-hackathon/hubcontroller-rest-quarkus.git @@ -16,5 +16,5 @@ spec: protocol: TCP targetPort: 8080 selector: - app: hub-controller-live + app: hub-controller type: ClusterIP diff --git a/datacenter/hub-controller/templates/ServiceAccount/hub-controller.yaml b/datacenter/hub-controller/templates/ServiceAccount/hub-controller.yaml new file mode 100644 index 0000000..c76dfda --- /dev/null +++ b/datacenter/hub-controller/templates/ServiceAccount/hub-controller.yaml @@ -0,0 +1,5 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: hub-controller diff --git a/datacenter/hub-controller/templates/update-repo-job.yaml b/datacenter/hub-controller/templates/update-repo-job.yaml new file mode 100644 index 0000000..7c4c50c --- /dev/null +++ b/datacenter/hub-controller/templates/update-repo-job.yaml @@ -0,0 +1,66 @@ +--- +kind: Job +apiVersion: batch/v1 +metadata: + name: repo-updater + namespace: hub-controller +spec: + activeDeadlineSeconds: 600 + manualSelector: false + template: + metadata: + generateName: update-repo- + spec: + nodeSelector: + kubernetes.io/os: linux + kubernetes.io/arch: amd64 + restartPolicy: Never + volumes: + - name: workdir + emptyDir: {} + containers: + - name: git + volumeMounts: + - name: workdir + mountPath: /workdir + image: quay.io/hummingbird/git:2 + workingDir: /workdir + envFrom: + - secretRef: + name: repo-updater-config + command: + - sh + - -c + - | + + export CLEAN_URI=$(echo $RU_REPO_URL | sed -E 's/^\s*.*:\/\///g') + export HC_URL=https://web-hub-controller.{{ .Values.openshift_cluster_ingress_domain }}/ + + + git clone https://robot:${RU_REPO_TOKEN}@${CLEAN_URI} --branch=main main + + cd main/ + + for robot in $RU_ROBOT_NAMES; + do + echo $HC_URL > $robot; + git add $robot; + done; + + git config --global user.name "robot-auto-register" + git config --global user.email "devnull@redhat.com" + + git commit -m 'Auto register robots at cluster {{ .Values.openshift_cluster_ingress_domain }}' + + git push + + imagePullPolicy: IfNotPresent + {{- if eq .Values.ru_enabled "False" }} + suspend: true + {{- else if .Values.ru_enabled }} + suspend: false + {{- else }} + suspend: true + {{- end }} + parallelism: 1 + \ No newline at end of file diff --git a/datacenter/hub-controller/values.yaml b/datacenter/hub-controller/values.yaml new file mode 100755 index 0000000..b715794 --- /dev/null +++ b/datacenter/hub-controller/values.yaml @@ -0,0 +1,16 @@ +# Default values for service-mesh-system. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +api_username: admin +api_password: foo + +openshift_cluster_ingress_domain: "apps.example.com" +ru_enabled: "False" +ru_repo_url: "" +ru_repo_token: "" + +team_robot_map: + - team: team-demo + robot_name: demo-robot + diff --git a/datacenter/per-user/gitops/.helmignore b/datacenter/per-user/gitops/.helmignore new file mode 100755 index 0000000..0e8a0eb --- /dev/null +++ b/datacenter/per-user/gitops/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/datacenter/per-user/gitops/Chart.yaml b/datacenter/per-user/gitops/Chart.yaml new file mode 100755 index 0000000..b6f4300 --- /dev/null +++ b/datacenter/per-user/gitops/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: gitops +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/datacenter/per-user/gitops/templates/AppProject.yaml b/datacenter/per-user/gitops/templates/AppProject.yaml new file mode 100644 index 0000000..eef9aa4 --- /dev/null +++ b/datacenter/per-user/gitops/templates/AppProject.yaml @@ -0,0 +1,24 @@ +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + name: "{{ .Values.team }}" + namespace: openshift-gitops +spec: + clusterResourceWhitelist: + - group: '*' + kind: '*' + namespaceResourceWhitelist: + - group: '*' + kind: '*' + destinations: + - name: '*' + namespace: '*' + server: :"https://{{ .Values.robot_name }}.robot.svc.cluster.local.:6443" + roles: + - groups: + - "{{ .Values.team }}" + name: "{{ .Values.team }}-admin" + policies: + - "p, proj:{{ .Values.team }}:{{ .Values.team }}-admin, applications, *, {{ .Values.team }}/*, allow" + sourceRepos: + - '*' \ No newline at end of file diff --git a/datacenter/per-user/gitops/templates/Application.yaml b/datacenter/per-user/gitops/templates/Application.yaml new file mode 100644 index 0000000..666ff76 --- /dev/null +++ b/datacenter/per-user/gitops/templates/Application.yaml @@ -0,0 +1,17 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: "{{ .Values.team }}-robot-gitops" + namespace: openshift-gitops +spec: + destination: + server: "https://{{ .Values.robot_name }}.robot.svc.cluster.local.:6443" + project: "{{ .Values.team }}" + source: + path: base/ + repoURL: "https://gitea.{{ .Values.openshift_cluster_ingress_domain }}/{{ .Values.team }}/robot-gitops.git" + targetRevision: HEAD + syncPolicy: + automated: {} + syncOptions: + - CreateNamespace=true diff --git a/datacenter/per-user/gitops/values.yaml b/datacenter/per-user/gitops/values.yaml new file mode 100755 index 0000000..4282afb --- /dev/null +++ b/datacenter/per-user/gitops/values.yaml @@ -0,0 +1,14 @@ +# Default values for service-mesh-system. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +username: team-demo +team: team-demo +robot_name: t-demo +openshift_cluster_ingress_domain: "apps.clusters.demo.com" + +namespacePermissions: + # Which OpenShift user gets permissions for the namespace + user: kubeadmin + # Which role to grant the user on the namespace + role: admin \ No newline at end of file diff --git a/edge-gateway/README.md b/edge-gateway/README.md deleted file mode 100644 index 705c261..0000000 --- a/edge-gateway/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# Edge gateway - -Login into - -## Bootstrap - -Please take a look into - - -## hub-controller test commands: - - -``` -export ROBOT=data - -curl -X POST -v -k https://web-hub-controller.apps.edge-gateway.lan/api/robot/forward/10?user_key=$ROBOT -curl -X POST -v -k https://web-hub-controller.apps.edge-gateway.lan/api/robot/backward/10?user_key=$ROBOT - -curl -X POST -v -k https://web-hub-controller.apps.edge-gateway.lan/api/robot/left/10?user_key=$ROBOT - - -curl -X POST -v -k https://web-hub-controller.apps.edge-gateway.lan/api/robot/right/10?user_key=$ROBOT - - -curl -X GET -k https://web-hub-controller.apps.edge-gateway.lan/api/robot/remote_status?user_key=data - -curl -X GET -k https://web-hub-controller.apps.edge-gateway.lan/api/robot/power?user_key=data - -curl -X GET -k https://web-hub-controller.apps.edge-gateway.lan/api/robot/distance?user_key=data - -``` - -## Update boto access - - - -``` -argocd login --username admin openshift-gitops-server-openshift-gitops.apps.edge-gateway.lan:443 - -export ROBOT=data -scp $ROBOT.robot.lan:/var/lib/microshift/resources/kubeadmin/kubeconfig ${ROBOT}.kubeconfig -export KUBECONFIG=${ROBOT}.kubeconfig -oc config set-cluster ${ROBOT} --server=https://${ROBOT}.robot.lan:6443 --insecure-skip-tls-verify=true -oc config set-context $ROBOT --user=user --cluster=${ROBOT} -oc config use-context $ROBOT - -argocd cluster add $(oc config current-context ) - -``` - -## ToDo - rewrite - -Added cluster to argocd instance - -```bash -# Login into Robot -oc login -u kubeadmin .... - -# Login into OpenShift GitOps at OpenShift Local instance -argocd login ... - -# Add cluster to argocd instance -argocd cluster add $(oc config current-context ) -``` - -Example outpur of `argocd cluster list`: -```bash -$ argocd cluster list -SERVER NAME VERSION STATUS MESSAGE PROJECT -https://10.89.114.152:6443 goetz-robot Unknown Cluster has no application and not being monitored. -https://kubernetes.default.svc in-cluster Unknown Cluster has no application and not being monitored. -``` - -Apply ArgoCD Application: -```bash -oc apply -f openshift-local/starter-app.application.yaml -oc apply -f openshift-local/hubcontroller-rest.application.yaml -``` -## hubcontroller-rest test commands - -```bash -# Forward -curl -k -X POST https://test-hubcontroller-rest.apps.edgesno.example.com/api/robot/forward/1?user_key=terminator - -``` \ No newline at end of file diff --git a/edge-gateway/appliance-builder/agent-config.yaml b/edge-gateway/appliance-builder/agent-config.yaml deleted file mode 100644 index 46dd88a..0000000 --- a/edge-gateway/appliance-builder/agent-config.yaml +++ /dev/null @@ -1,33 +0,0 @@ -apiVersion: v1alpha1 -kind: AgentConfig -rendezvousIP: 192.168.8.2 -metadata: - name: edge-gateway -hosts: - - hostname: edge-gateway - role: master - interfaces: - - name: enp2s0 - macAddress: 84:8b:cd:4d:15:f9 - networkConfig: - interfaces: - - name: enp2s0 - type: ethernet - state: up - mac-address: 84:8b:cd:4d:15:f9 - ipv4: - enabled: true - address: - - ip: 192.168.8.2 - prefix-length: 24 - dhcp: false - dns-resolver: - config: - server: - - 192.168.8.1 - routes: - config: - - destination: 0.0.0.0/0 - next-hop-address: 192.168.8.1 - next-hop-interface: enp2s0 - table-id: 254 diff --git a/edge-gateway/appliance-builder/appliance-config.yaml b/edge-gateway/appliance-builder/appliance-config.yaml deleted file mode 100644 index c802928..0000000 --- a/edge-gateway/appliance-builder/appliance-config.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v1beta1 -kind: ApplianceConfig -ocpRelease: - version: 4.16.27 - channel: stable - cpuArchitecture: x86_64 -# Replace pull secret -pullSecret: '{"auths":{"cloud.open...' - -sshKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICEibaAML0mtppKRlNQpe1eqgXB05chuIQ9/0yg2vcYx robot-hackathon' -# Replace core password, it's document at bitwarden -userCorePass: replaceme -enableDefaultSources: false -stopLocalRegistry: false -createPinnedImageSets: false -operators: - - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.16 - packages: - - name: openshift-gitops-operator - channels: - - name: latest - - name: skupper-operator - channels: - - name: stable diff --git a/edge-gateway/appliance-builder/install-config.yaml b/edge-gateway/appliance-builder/install-config.yaml deleted file mode 100644 index 39ca72a..0000000 --- a/edge-gateway/appliance-builder/install-config.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: v1 -baseDomain: lan -metadata: - name: edge-gateway -compute: -- name: worker - replicas: 0 -controlPlane: - name: master - replicas: 1 -networking: - networkType: OVNKubernetes - machineNetwork: - - cidr: 192.168.8.0/24 -platform: - none: {} -pullSecret: '{"auths":{"":{"auth":"dXNlcjpwYXNz"}}}' -sshKey: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICEibaAML0mtppKRlNQpe1eqgXB05chuIQ9/0yg2vcYx robot-hackathon' diff --git a/edge-gateway/cluster-configuration/cluster-scope/ClusterRoleBinding/kustomization.yaml b/edge-gateway/cluster-configuration/cluster-scope/ClusterRoleBinding/kustomization.yaml deleted file mode 100644 index 8b83122..0000000 --- a/edge-gateway/cluster-configuration/cluster-scope/ClusterRoleBinding/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- openshift-gitops-argocd-admin.yaml -- self-provisioners.yaml diff --git a/edge-gateway/cluster-configuration/cluster-scope/ClusterRoleBinding/openshift-gitops-argocd-admin.yaml b/edge-gateway/cluster-configuration/cluster-scope/ClusterRoleBinding/openshift-gitops-argocd-admin.yaml deleted file mode 100644 index 3609b33..0000000 --- a/edge-gateway/cluster-configuration/cluster-scope/ClusterRoleBinding/openshift-gitops-argocd-admin.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: openshift-gitops-argocd-admin -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: argocds.argoproj.io-v1alpha1-admin -subjects: -- kind: ServiceAccount - name: openshift-gitops-argocd-application-controller - namespace: openshift-gitops diff --git a/edge-gateway/cluster-configuration/cluster-scope/ClusterRoleBinding/self-provisioners.yaml b/edge-gateway/cluster-configuration/cluster-scope/ClusterRoleBinding/self-provisioners.yaml deleted file mode 100644 index e72df51..0000000 --- a/edge-gateway/cluster-configuration/cluster-scope/ClusterRoleBinding/self-provisioners.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - annotations: - rbac.authorization.kubernetes.io/autoupdate: "false" - name: self-provisioners -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: self-provisioner -subjects: [] diff --git a/edge-gateway/cluster-configuration/kustomization.yaml b/edge-gateway/cluster-configuration/kustomization.yaml deleted file mode 100644 index a3d0166..0000000 --- a/edge-gateway/cluster-configuration/kustomization.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -resources: -# Do we need pipeline here? -# - pipeline-operator/ -- cluster-scope/ -- namespace/ diff --git a/edge-gateway/cluster-configuration/namespace/kustomization.yaml b/edge-gateway/cluster-configuration/namespace/kustomization.yaml deleted file mode 100644 index 4d11e38..0000000 --- a/edge-gateway/cluster-configuration/namespace/kustomization.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- openshift-operators/ -- openshift-gitops/ diff --git a/edge-gateway/cluster-configuration/namespace/openshift-gitops/Application/hub-controller.yaml b/edge-gateway/cluster-configuration/namespace/openshift-gitops/Application/hub-controller.yaml deleted file mode 100644 index a3a3ead..0000000 --- a/edge-gateway/cluster-configuration/namespace/openshift-gitops/Application/hub-controller.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: hub-controller - namespace: openshift-gitops -spec: - destination: - server: https://kubernetes.default.svc - project: default - source: - path: edge-gateway/hub-controller/ - repoURL: https://github.com/cloud-native-robotz-hackathon/infrastructure.git - targetRevision: HEAD - syncPolicy: - automated: - prune: true - syncOptions: - - PruneLast=true - - CreateNamespace=true diff --git a/edge-gateway/cluster-configuration/namespace/openshift-operators/Subscription/kustomization.yaml b/edge-gateway/cluster-configuration/namespace/openshift-operators/Subscription/kustomization.yaml deleted file mode 100644 index f98d241..0000000 --- a/edge-gateway/cluster-configuration/namespace/openshift-operators/Subscription/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- skupper-operator.yaml diff --git a/edge-gateway/cluster-configuration/namespace/openshift-operators/Subscription/skupper-operator.yaml b/edge-gateway/cluster-configuration/namespace/openshift-operators/Subscription/skupper-operator.yaml deleted file mode 100644 index c6bca15..0000000 --- a/edge-gateway/cluster-configuration/namespace/openshift-operators/Subscription/skupper-operator.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: operators.coreos.com/v1alpha1 -kind: Subscription -metadata: - name: skupper-operator - namespace: openshift-operators -spec: - config: - env: - - name: CLUSTER_PERMISSIONS_ALLOWED - value: "true" - channel: stable - installPlanApproval: Automatic - name: skupper-operator - source: cs-redhat-operator-index - sourceNamespace: openshift-marketplace diff --git a/edge-gateway/cluster-configuration/namespace/skupper-private/ConfigMap/kustomization.yaml b/edge-gateway/cluster-configuration/namespace/skupper-private/ConfigMap/kustomization.yaml deleted file mode 100644 index c77869c..0000000 --- a/edge-gateway/cluster-configuration/namespace/skupper-private/ConfigMap/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- skupper-site.yaml diff --git a/edge-gateway/cluster-configuration/namespace/skupper-private/ConfigMap/skupper-site.yaml b/edge-gateway/cluster-configuration/namespace/skupper-private/ConfigMap/skupper-site.yaml deleted file mode 100644 index 84e734f..0000000 --- a/edge-gateway/cluster-configuration/namespace/skupper-private/ConfigMap/skupper-site.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: skupper-site -data: - cluster-local: "false" - console: "true" - edge: "true" - - name: edge-gateway - router-console: "true" - service-controller: "true" - service-sync: "true" - - console-authentication: openshift diff --git a/edge-gateway/hub-controller/ConfigMap/kustomization.yaml b/edge-gateway/hub-controller/ConfigMap/kustomization.yaml deleted file mode 100644 index 91bc463..0000000 --- a/edge-gateway/hub-controller/ConfigMap/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- robot-mapping-configmap.yaml diff --git a/edge-gateway/hub-controller/ConfigMap/robot-mapping-configmap.yaml b/edge-gateway/hub-controller/ConfigMap/robot-mapping-configmap.yaml deleted file mode 100644 index 8df586f..0000000 --- a/edge-gateway/hub-controller/ConfigMap/robot-mapping-configmap.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: v1 -data: - MAP: | - { - "someRobotToken": "someRobotAddress" - } -immutable: false -kind: ConfigMap -metadata: - name: robot-mapping-configmap diff --git a/edge-gateway/hub-controller/Deployment/hub-controller-live.yaml b/edge-gateway/hub-controller/Deployment/hub-controller-live.yaml deleted file mode 100644 index a93cfae..0000000 --- a/edge-gateway/hub-controller/Deployment/hub-controller-live.yaml +++ /dev/null @@ -1,62 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: hub-controller-live - app.kubernetes.io/managed-by: quarkus - app.openshift.io/runtime: quarkus - annotations: - app.openshift.io/vcs-uri: git@github.com:cloud-native-robotz-hackathon/hubcontroller-rest-quarkus.git - app.quarkus.io/vcs-uri: https://github.com/cloud-native-robotz-hackathon/hubcontroller-rest-quarkus.git - name: hub-controller-live -spec: - replicas: 1 - selector: - matchLabels: - app: hub-controller-live - strategy: - type: RollingUpdate - template: - metadata: - labels: - app: hub-controller-live - spec: - containers: - - env: - - name: MAP - valueFrom: - configMapKeyRef: - key: MAP - name: robot-mapping-configmap - - name: KUBERNETES_NAMESPACE - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.namespace - image: quay.io/cloud-native-robotz-hackathon/hubcontroller-rest-quarkus:latest-native - imagePullPolicy: Always - name: hub-controller - livenessProbe: - failureThreshold: 3 - httpGet: - path: /q/health/live - port: 8080 - scheme: HTTP - initialDelaySeconds: 1 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 - ports: - - containerPort: 8080 - name: http - protocol: TCP - readinessProbe: - failureThreshold: 3 - httpGet: - path: /q/health/ready - port: 8080 - scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 1 diff --git a/edge-gateway/hub-controller/Deployment/kustomization.yaml b/edge-gateway/hub-controller/Deployment/kustomization.yaml deleted file mode 100644 index e213572..0000000 --- a/edge-gateway/hub-controller/Deployment/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- hub-controller-live.yaml diff --git a/edge-gateway/hub-controller/Namespace/hub-controller.yaml b/edge-gateway/hub-controller/Namespace/hub-controller.yaml deleted file mode 100644 index 560712e..0000000 --- a/edge-gateway/hub-controller/Namespace/hub-controller.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - labels: - argocd.argoproj.io/managed-by: openshift-gitops - name: hub-controller -spec: {} diff --git a/edge-gateway/hub-controller/Route/kustomization.yaml b/edge-gateway/hub-controller/Route/kustomization.yaml deleted file mode 100644 index 344d62a..0000000 --- a/edge-gateway/hub-controller/Route/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- web.yaml diff --git a/edge-gateway/hub-controller/Route/web.yaml b/edge-gateway/hub-controller/Route/web.yaml deleted file mode 100644 index 1db2375..0000000 --- a/edge-gateway/hub-controller/Route/web.yaml +++ /dev/null @@ -1,15 +0,0 @@ -kind: Route -apiVersion: route.openshift.io/v1 -metadata: - name: web - labels: - app: hub-controller-live - app.kubernetes.io/instance: hub-controller -spec: - to: - kind: Service - name: hub-controller-live - weight: 100 - port: - targetPort: http - diff --git a/edge-gateway/hub-controller/Service/hub-controller-live.yaml b/edge-gateway/hub-controller/Service/hub-controller-live.yaml deleted file mode 100644 index 046b193..0000000 --- a/edge-gateway/hub-controller/Service/hub-controller-live.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - app: hub-controller-live - app.kubernetes.io/managed-by: quarkus - app.openshift.io/runtime: quarkus - name: hub-controller-live - annotations: - app.openshift.io/vcs-uri: git@github.com:cloud-native-robotz-hackathon/hubcontroller-rest-quarkus.git - app.quarkus.io/vcs-uri: https://github.com/cloud-native-robotz-hackathon/hubcontroller-rest-quarkus.git -spec: - ports: - - name: http - port: 8080 - protocol: TCP - targetPort: 8080 - selector: - app: hub-controller-live - type: ClusterIP diff --git a/edge-gateway/hub-controller/Service/kustomization.yaml b/edge-gateway/hub-controller/Service/kustomization.yaml deleted file mode 100644 index e213572..0000000 --- a/edge-gateway/hub-controller/Service/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- hub-controller-live.yaml diff --git a/edge-gateway/hub-controller/kustomization.yaml b/edge-gateway/hub-controller/kustomization.yaml deleted file mode 100644 index 5f1b769..0000000 --- a/edge-gateway/hub-controller/kustomization.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: hub-controller -resources: -- ConfigMap/ -- Deployment/ -- Service/ -- Route/ -- Namespace/ diff --git a/edge-gateway/pipeline-operator/kustomization.yaml b/edge-gateway/pipeline-operator/kustomization.yaml deleted file mode 100644 index b2d134b..0000000 --- a/edge-gateway/pipeline-operator/kustomization.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -resources: -- subscription.yaml diff --git a/edge-gateway/pipeline-operator/subscription.yaml b/edge-gateway/pipeline-operator/subscription.yaml deleted file mode 100644 index 43b3276..0000000 --- a/edge-gateway/pipeline-operator/subscription.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: operators.coreos.com/v1alpha1 -kind: Subscription -metadata: - name: openshift-pipelines-operator - namespace: openshift-operators -spec: - channel: latest - name: openshift-pipelines-operator-rh - source: redhat-operators - sourceNamespace: openshift-marketplace \ No newline at end of file diff --git a/edge-gateway/starter-app.application.yaml b/edge-gateway/starter-app.application.yaml deleted file mode 100644 index dabc9c3..0000000 --- a/edge-gateway/starter-app.application.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: starter-app - namespace: openshift-gitops -spec: - destination: - namespace: starterapp-python - server: https://10.89.114.152:6443 - project: default - source: - path: gitops-starterapp-python - repoURL: https://github.com/cloud-native-robotz-hackathon/devel-bucket.git - targetRevision: master - syncPolicy: {} diff --git a/facilitator-guide/README.md b/facilitator-guide/README.md index 28e1b9e..59b7f32 100644 --- a/facilitator-guide/README.md +++ b/facilitator-guide/README.md @@ -1 +1,11 @@ -# mkdocs-materials-github-actions \ No newline at end of file +# Facilitator guide + +```shell +export VERSION=$(date +%Y%m%d%H%M) +export IMAGE="quay.io/cloud-native-robotz-hackathon/facilitator-guide-builder:${VERSION}" + +podman build --platform linux/amd64,linux/arm64 --manifest ${IMAGE} . +podman manifest push ${IMAGE} + + +``` diff --git a/facilitator-guide/content/README.md b/facilitator-guide/content/README.md index 7ad262c..5979e0b 100644 --- a/facilitator-guide/content/README.md +++ b/facilitator-guide/content/README.md @@ -1,8 +1,19 @@ --- title: Home hero: "Home" -description: "..." +description: "Practical reference for facilitators and organizers running the cloud-native robot hackathon." +icon: material/home --- # Robot Hackathon Facilitator Guide +This site is the **facilitator guide** for the **cloud-native robot hackathon**. Use it to plan and run events, understand the hardware and kits, fix common issues, and onboard contributors who work on the guide or automation. + +## Where to go next + +- **[Run a Event](run-a-event/index.md)** β€” event formats (full day, booth/demo) and [on-site prerequisites](run-a-event/on-site-prerequisites.md). +- **[Component](component/index.md)** β€” robots, travel kit, data center, Wi‑Fi router, and related setup. +- **[Troubleshooting](troubleshooting/index.md)** β€” fixes for typical problems during prep or on site. +- **[Development](development/index.md)** β€” team onboarding; build or preview the site [locally](development/local.md). + +For release notes and cross-topic search, see **Changelog** and **Tags** in the navigation. diff --git a/facilitator-guide/content/component/data-center.md b/facilitator-guide/content/component/data-center.md index 8874824..d096666 100644 --- a/facilitator-guide/content/component/data-center.md +++ b/facilitator-guide/content/component/data-center.md @@ -1,25 +1,61 @@ --- title: Data Center hero: "Data Center" +description: "Provision the OpenShift data center on Red Hat Demo Platform, optional robot auto-registration, and console branding." icon: material/server --- -## Data Center -The data center environment is available via Red Hat Demo Platform: Search for robot +## Overview + +The **data center** is the hosted OpenShift environment for the hackathon. Facilitators provision it through **Red Hat Demo Platform** (RHDP), optionally enable **robot auto-registration** during order, and can customize console login branding via GitOps in this repository. + +## Provision on Red Hat Demo Platform + +1. Open the [RHDP catalog](https://catalog.demo.redhat.com/catalog/babylon-catalog-prod?search=robot) and search for **robot**, or use the [Cloud Native Robot Hackathon](https://catalog.demo.redhat.com/catalog?search=Cloud+Native+Robot+Hackathon&item=babylon-catalog-prod%2Fsandboxes-gpte.cloud-native-robot.prod) catalog entry directly. +2. Complete the order wizard using the field guidance in [Full day β€” Order OpenShift Data Center env](../run-a-event/full-day.md#order-openshift-data-center-env). ![](demo-portal.png) - +## Robot auto registration (optional) + +In the provisioning form, enable **robot auto registration** if teams should register robots against a GitHub repo automatically: + +![](demo-robot-auto-registration.png) + +Values depend on your teams, robot names, and the associated **robot-auto-register** repository. For setup details and examples, see **[Robot Auto Register](../robot/auto-register.md)**. + +Example repository URL: + +* + +## Customize OpenShift console branding + +Branding lives under **`datacenter/cluster-configuration/`** in the [infrastructure](https://github.com/cloud-native-robotz-hackathon/infrastructure) repo. Work from a clone of that repository on your machine. + +### Login and OAuth HTML templates + +1. Log in to the **data center** OpenShift cluster as an admin (see [Full day](../run-a-event/full-day.md) for ordering and access). +2. Edit the HTML sources in + `datacenter/cluster-configuration/base/namespace/openshift-config/Secret/` + β€” `errors-template.html`, `login-template.html`, and `providers-template.html`. +3. From that **`Secret/`** directory, run: + + ```bash + ./update-secrets.sh + ``` + +### Console logo (light / dark) + +1. In + `datacenter/cluster-configuration/base/namespace/openshift-config/ConfigMap/` + replace or edit **`openshift-robot-black.png`** and **`openshift-robot-white.png`** as needed (for example export from GIMP as PNG). +2. From that **`ConfigMap/`** directory, run: + ```bash + ./update-configmap.sh + ``` -### How to adjust openshift cluster design +### Publish and sync -* Login in into OpenShift Cluster (data-center) -* Go to `datacenter/cluster-configuration/base/namespace/openshift-config/Secret` -* Adjust errors-template.html, login-template.html and providers-template.html -* Run `./update-secrets.sh` -* Go to `datacenter/cluster-configuration/base/namespace/openshift-config/ConfigMap` -* Adjust openshift-robot.png (Optional the openshift-robot.xcf via Gimp and export as png ) -* Run `./update-secrets.sh` -* Commit all changes and push it. -* Open ArgoCD and refresh and sync cluster-configuration +1. Commit and push your changes. +2. In **Argo CD**, refresh and sync the **`cluster-configuration`** application so the cluster picks up the updates. diff --git a/facilitator-guide/content/component/data-center/demo-robot-auto-registration.png b/facilitator-guide/content/component/data-center/demo-robot-auto-registration.png new file mode 100644 index 0000000..b566a3b Binary files /dev/null and b/facilitator-guide/content/component/data-center/demo-robot-auto-registration.png differ diff --git a/facilitator-guide/content/component/nine-robot-travel-kit/index.md b/facilitator-guide/content/component/nine-robot-travel-kit/index.md index f010db9..46fb501 100644 --- a/facilitator-guide/content/component/nine-robot-travel-kit/index.md +++ b/facilitator-guide/content/component/nine-robot-travel-kit/index.md @@ -20,3 +20,17 @@ icon: fontawesome/solid/person-walking-luggage ## Pictures ![](pelicase-a.JPG){ width="150" } + +## List of robots + +|Team|Robot name| +|---|---| +|1|gort| +|2|t-1000| +|3|marvin| +|4|c3po| +|5|r2d2| +|6|marc13| +|7|data| +|8|terminator| +|9|ultron| diff --git a/facilitator-guide/content/component/overview.drawio b/facilitator-guide/content/component/overview.drawio index 713dd57..d7ef947 100644 --- a/facilitator-guide/content/component/overview.drawio +++ b/facilitator-guide/content/component/overview.drawio @@ -1,186 +1,209 @@ - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - + - - + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - + + - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + diff --git a/facilitator-guide/content/component/robot-gipigo/index.md b/facilitator-guide/content/component/robot-gipigo/index.md deleted file mode 100644 index 595825c..0000000 --- a/facilitator-guide/content/component/robot-gipigo/index.md +++ /dev/null @@ -1,197 +0,0 @@ ---- -title: Robot - GiPiGo -hero: "Robot - GiPiGo" -icon: material/robot ---- - -## BOM - -|Name|Example Shop Link| -|---|---| -|**GoPiGo Kit**|| -|**Raspberry Pi 4 B - 8 GB Memory Version**|| -|**Raspberry Pi Camera Modules v2**|| -|**SD Card**
* 128 GB recommended
* 64 GB minimum | -|**3D Printed Camera Mounts**
πŸ› οΈ custom, **you have to print it.**|| -|**WiFi Router**, optional but recommended| - -It is roughly 350 Euro per robot + 200 Euro the optional WiFi router. - -## Pictures - -![](robot-a.JPG){ width="150" } -![](robot-b.JPG){ width="150" } -![](robot-c.JPG){ width="150" } -![](robot-d.JPG){ width="150" } - -## Setup Robot from Scratch - -This should only be neccessary with a new robot or when repairing/updating/replacing a robot. - -### Install image and prepare robot - -* Download image Ubuntu 22.04, Microshift 4.8 : -* Write to SD Card, will be resized to SD Card size at first boot - ```shell - gunzip robot-hackathon-image.20260212.img.gz - sudo dd if=robot-hackathon-image.20260212.img of=/dev/sdXXX status=progress - ``` -* The image will be resized to SD card size on first boot -* The image is preconfigured with: - * Automatic connection to the hackathon WIFI "robot-hackathon-78b09", password in Bitwarden collection. - * Robot hackathon SSH key (Bitwarden Collection) -* Adjust inventory `automation/inventory.yaml`, add the robot to `robots`, for example: - ```yaml - robots: - hosts: - .... - : - team: team-X - ansible_host: 192.168.8.xxx - ``` -* Run playbook to configure the robot - ``` - ansible-navigator run ./configure-robot.yaml -l - ``` -* Login into the robot and reboot. -* Now the boot screen should look like this: - ![](bootscreen.png) - -### Network Setup - -* The robot will automatically connect to a WIFI with the SSID and key/password listed above. -* If you want to configure another WIFI, attach a network cable and SSH into the robot (root / from Bitwarden collection) or mount the SD card. -* Edit /etc/netplan/50-cloud-init.yaml and add your WIFI access point, reboot or run `netplan apply`. Config example: - - ``` - network: - ethernets: - eth0: - dhcp4: true - optional: true - version: 2 - Wifis: - wlan0: - access-points: - "robot-hackathon-78b09": - password: "PASSWORD" - "otherssid": - password: "" - dhcp4: true - ``` - -### Finish configuration - -To finish the configuration, you have to run a number of Playbooks against the robot(s). - -Clone the GitHub repo [infrastructure](https://github.com/cloud-native-robotz-hackathon/infrastructure.git). - -``` -git clone https://github.com/cloud-native-robotz-hackathon/infrastructure.git -``` - -Example inventory: - -``` ---- -all: - vars: - ansible_user: root - ansible_ssh_private_key_file: ~/.ssh/robot-hackathon - -robots: - hosts: - abcwarrior: - team: team-1 -``` - -The robot name has to resolve of course. If not, use the IP address. - -#### Robot Base Config - -The Playbook [automation/configure-robot.yaml](https://github.com/cloud-native-robotz-hackathon/infrastructure/blob/main/automation/configure-robot.yaml): - -- Ensures the robot is running image robot-hackathon-image.20260212 before proceeding. -- Stops and removes the deprecated edgehub service and its associated files. -- Clones and installs edge-controller in a specified version from GitHub to /opt/edge-controller. -- Configures, enables, and restarts the edge-controller systemd unit and makes sure it runs. -- Updates /etc/issue (login banner), /etc/hosts, and sets the system hostname to match the inventory. - -Run it: - -``` -robot-hackathon/infrastructure/automation$ ansible-navigator run configure-robot.yaml -i myinventory.yaml -``` - -After the Playbook has run, reboot the robot. - -#### Microshift Reset - -The Playbook [automation/microshift-reset.yaml](https://github.com/cloud-native-robotz-hackathon/infrastructure/blob/main/automation/microshift-reset.yaml) performs a destructive reset and fresh configuration of MicroShift on the robot. Run it now and whenever the IP or hostname changes: - -- Calculates current disk usage and aborts the process if it exceeds a predefined disk_limit. -- Stops the microshift.service and deletes all existing data in /var/lib/microshift. -- Updates /etc/hosts with the robot's local IP and sets the cluster domain in the MicroShift config. -- Prepares a kustomization.yaml and a specific Pod manifest (pin-triton.yaml) to pin a Triton server image in the local registry. -- Restarts MicroShift and waits for the system to generate a new kubeconfig file. -- Prepares the kubeconfig -- Waits for the API to respond on port 6443 and provides the exact command needed to export the KUBECONFIG environment variable. - -Run it: - -``` -robot-hackathon/infrastructure/automation$ ansible-navigator run microshift-reset.yaml -i myinventory.yaml -``` - -#### Optional: Install Self-Register Service - -Clone the GitHub repo [robot-config-service](https://github.com/cloud-native-robotz-hackathon/robot-config-service.git). - -``` -git clone https://github.com/cloud-native-robotz-hackathon/robot-config-service.git -``` - -Follow the instructions in the readme to install the service to the robot(s) using Ansible. - -After the Playbook has run, reboot the robot to activate the self-registration. - -### Camera Setup (Raspi camera v2) - -Playbook camera-test.yaml is here [https://github.com/cloud-native-robotz-hackathon/infrastructure/tree/main/robot](https://github.com/cloud-native-robotz-hackathon/infrastructure/tree/main/robot) - -* Cable orientation: blue β€œbar” on cable oriented to USB ports, blue bar at camera away from lens -* Test camera is detected: vcgencmd get_camera -* Script to test image acquisition - -``` - import cv2 - # open camera - cap = cv2.VideoCapture('/dev/video0', cv2.CAP_V4L) - - # set dimensions - cap.set(cv2.CAP_PROP_FRAME_WIDTH, 2560) - cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1440) - - # take frame - ret, frame = cap.read() - # write frame to file - cv2.imwrite('/root/ramfilesystem/image.jpg', frame) - # release camera - cap.release() -``` - -### Triton - -[https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/getting\_started/quickstart.html](https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/getting_started/quickstart.html) - -Check model -`curl --location --request GET 'http://localhost:8000/v2/models/densenet_onnx/stats'` - -## Bill of materials - -|#|Item|price in Euro|Example Shop| -|---|---|---|---| -|1|GoPiGo Kits|178|| -|2|Raspberry Pi 4 B - 8 GB Memory Version|79|| -|3|Raspberry Pi Camera Modules v2|17|| -|4|3D Printed Camera Mounts Custom, you have to print it.|30|| \ No newline at end of file diff --git a/facilitator-guide/content/component/robot-gipigo/bootscreen.png b/facilitator-guide/content/component/robot-gopigo/bootscreen.png similarity index 100% rename from facilitator-guide/content/component/robot-gipigo/bootscreen.png rename to facilitator-guide/content/component/robot-gopigo/bootscreen.png diff --git a/facilitator-guide/content/component/robot-gopigo/index.md b/facilitator-guide/content/component/robot-gopigo/index.md new file mode 100644 index 0000000..bbff86e --- /dev/null +++ b/facilitator-guide/content/component/robot-gopigo/index.md @@ -0,0 +1,157 @@ +--- +title: Robot - GoPiGo +hero: "Robot - GoPiGo" +icon: material/robot +--- + +## BOM + +|Name|Example Shop Link| +|---|---| +|**GoPiGo Kit**|| +|**Raspberry Pi 4 B - 8 GB Memory Version**|| +|**Raspberry Pi Camera Modules v2**|| +|**SD Card**
* 128 GB recommended
* 64 GB minimum | +|**3D Printed Camera Mounts**
πŸ› οΈ custom, **you have to print it.**|| +|**WiFi Router**, optional but recommended| + +It is roughly 350 Euro per robot + 200 Euro the optional WiFi router. + +## Pictures + +![](robot-a.JPG){ width="150" } +![](robot-b.JPG){ width="150" } +![](robot-c.JPG){ width="150" } +![](robot-d.JPG){ width="150" } + +## Setup Robot from Scratch + +This should only be neccessary with a new robot or when repairing/updating/replacing a robot. + +### Step 1) Install image + +* Download latest image Ubuntu 22.04, Microshift 4.8 from: +* Write to SD Card, will be resized to SD Card size at first boot + ```shell + gunzip robot-hackathon-image.>.img.gz + sudo dd if=robot-hackathon-image..img of=/dev/sdXXX status=progress + ``` +* The image will be resized to SD card size on first boot +* The image is preconfigured with: + * Automatic connection to the hackathon WIFI "robot-hackathon-78b09", password in Bitwarden collection. + * Robot hackathon SSH key (Bitwarden Collection) + +### Step 2) Network & Hostname configuration + +* Boot robot with new image +* Go to Wifi router Admin page: (Admin password is stored in Bitwarden, collection `Robot hackathon` item `Wifi router admin access`) + * Navigate to "CLIENTS", findout new "Unknown" IP address: + + ![](wifi-router-unknown.png){width=1024} + +* Connect to the robot to configure the hostname: + + ```shell + ssh -i ~/.ssh/robot-hackathon -l root 192.168.8. + ``` + + Optional check via camera where you are: + + ``` + curl -L -O https://raw.githubusercontent.com/cloud-native-robotz-hackathon/infrastructure/refs/heads/v3/robot/lights-on.py + chmod +x ./lights-on.py + ./lights-on.py + ``` + + (If available) open via Browser: `http://192.168.8.:8000/testimage.jpg` + + Change hostname and reboot via: + + Pick robot name aka hostname from the [nine robot travel kit](../nine-robot-travel-kit/#list-of-robots) or choose your own. When choosing your own make sure to update the env robot mapping in the provisioning form and the ansible inventory + + ```shell + hostnamectl set-hostname + reboot + ``` + +* Now the robot should appear with the right hostname aka robot name + + ![](wifi-router-known.png){width=1024} + +* Toggle/Enable the "Reserved IP" switch + +### Step 3) Finish configuration via ansible + +To finish the configuration, you have to run a number of Playbooks against the robot(s) from your laptop. + +Clone the GitHub repo [infrastructure](https://github.com/cloud-native-robotz-hackathon/infrastructure.git). + +```shell +git clone https://github.com/cloud-native-robotz-hackathon/infrastructure.git +cd infrastructure/ +``` + +The Playbook `automation/bootstrap-robot.yaml` does the following steps: + +- Ensures the robot is running [latest](https://github.com/cloud-native-robotz-hackathon/infrastructure/blob/main/automation/bootstrap-robot.yaml#L19-L23) image before proceeding. +- Clones and installs edge-controller in a specified version from GitHub to /opt/edge-controller. +- Clones and installs robot-config-service in a specified version from GitHub to /opt/robot-config-service. +- Configures, enables, and restarts the edge-controller systemd unit and makes sure it runs. +- Updates /etc/issue (login banner), /etc/hosts, and sets the system hostname to match the inventory. + +Create the vars file with the connection details and run the Playbook. You can get these values from the Readme in the referenced Github repo and the Bitwarden vault. + +```shell +cd automation/ + +echo "rcs_git_repo: https://github.com/cloud-native-robotz-hackathon/robot-auto-register-78b09.git" > group_vars/all/robot-config-service.yaml +echo "rcs_gh_token: github_pat_xxx" >> group_vars/all/robot-config-service.yaml +echo "rcs_hubcontroller_user: hub-controller" >> group_vars/all/robot-config-service.yaml +echo "rcs_hubcontroller_password: hub-controller" >> group_vars/all/robot-config-service.yaml + +ansible-navigator run bootstrap-robot.yaml -l +``` + +Then log into the Hubcontroller (/dashboard.html) (username / pass in Bitwarden) and you should see a tile with your registered robot. + +## Advanced rarely used topics + +### Camera Setup (Raspi camera v2) + +Playbook camera-test.yaml is here `camera-test.yaml` to fetch camera image: + +```shell +cd automation/ +ansible-navigator run ./camera-test.yaml -l gort +``` + +Open all `camera-test*jpg` files. + +Cable orientation: blue β€œbar” on cable oriented to USB ports, blue bar at camera away from lens + +### Custom network configurartion + +* The robot will automatically connect to a WIFI with the SSID and key/password listed above. +* If you want to configure another WIFI, attach a network cable and SSH into the robot (root / from Bitwarden collection) or mount the SD card and change on disk. +* Edit /etc/netplan/50-cloud-init.yaml and add your WIFI access point, reboot or run `netplan apply`. Config example: + + ``` + network: + ethernets: + eth0: + dhcp4: true + optional: true + version: 2 + Wifis: + wlan0: + access-points: + "robot-hackathon-78b09": + password: "PASSWORD" + "otherssid": + password: "" + dhcp4: true + ``` +* Reboot the robot + +* Now the boot screen should look like this, and show the new IP address + ![](bootscreen.png) diff --git a/facilitator-guide/content/component/robot-gipigo/robot-a.JPG b/facilitator-guide/content/component/robot-gopigo/robot-a.JPG similarity index 100% rename from facilitator-guide/content/component/robot-gipigo/robot-a.JPG rename to facilitator-guide/content/component/robot-gopigo/robot-a.JPG diff --git a/facilitator-guide/content/component/robot-gipigo/robot-b.JPG b/facilitator-guide/content/component/robot-gopigo/robot-b.JPG similarity index 100% rename from facilitator-guide/content/component/robot-gipigo/robot-b.JPG rename to facilitator-guide/content/component/robot-gopigo/robot-b.JPG diff --git a/facilitator-guide/content/component/robot-gipigo/robot-c.JPG b/facilitator-guide/content/component/robot-gopigo/robot-c.JPG similarity index 100% rename from facilitator-guide/content/component/robot-gipigo/robot-c.JPG rename to facilitator-guide/content/component/robot-gopigo/robot-c.JPG diff --git a/facilitator-guide/content/component/robot-gipigo/robot-d.JPG b/facilitator-guide/content/component/robot-gopigo/robot-d.JPG similarity index 100% rename from facilitator-guide/content/component/robot-gipigo/robot-d.JPG rename to facilitator-guide/content/component/robot-gopigo/robot-d.JPG diff --git a/facilitator-guide/content/component/robot-gopigo/wifi-router-known.png b/facilitator-guide/content/component/robot-gopigo/wifi-router-known.png new file mode 100644 index 0000000..0b69a71 Binary files /dev/null and b/facilitator-guide/content/component/robot-gopigo/wifi-router-known.png differ diff --git a/facilitator-guide/content/component/robot-gopigo/wifi-router-unknown.png b/facilitator-guide/content/component/robot-gopigo/wifi-router-unknown.png new file mode 100644 index 0000000..4349898 Binary files /dev/null and b/facilitator-guide/content/component/robot-gopigo/wifi-router-unknown.png differ diff --git a/facilitator-guide/content/component/wifi-router.md b/facilitator-guide/content/component/wifi-router.md new file mode 100644 index 0000000..a5b2634 --- /dev/null +++ b/facilitator-guide/content/component/wifi-router.md @@ -0,0 +1,73 @@ +--- +title: Wifi Router +hero: "Wifi Router" +icon: material/router-wireless +--- + +## Overview + +### Set Admin password + +Set admin password to the one document in Bitwarden collection `Robot Hackathon` item `Wifi router admin access`. + +### Firmware update + +Update your router to latest firmware version. + +### Network configuration + +Configure network at Network -> LAN + +![Screenshot](lan.png){width=300} + +#### LAN Settings + +Configure the following LAN parameters: + +|Setting|Value|Description| +|---|---|---| +|Router IP Address|`192.168.8.1`|Gateway address for the robot network| +|Netmask|`255.255.255.0`|Provides 254 usable addresses| + +#### DHCP Server Settings + +Enable and configure the DHCP server to automatically assign IP addresses: + +|Setting|Value|Description| +|---|---|---| +|Enabled|Checked βœ…|Automatically assigns IPs to devices| +|Start IP Address|`192.168.8.100`|First address in DHCP pool| +|End IP Address|`192.168.8.249`|Last address in DHCP pool| +|Lease Time|24 hours (default)|How long devices keep their IP| + +#### DHCP Server + +|Setting|Value| +|---|---| +|Enabled|Checked βœ… | +|Start IP Address|192.168.8.100| +|End IP Address|192.168.8.249| + +### Configure SSID `robot-hackathon-78b09` + +Configure the wireless SSID `robot-hackathon-78b09` at the **Wireless** menu item. Both 2.4 GHz and 5 GHz bands should use the same SSID for seamless device roaming. + +#### Wireless - 5 GHz Wi-Fi + +|Setting|Value| +|---|---| +|Enable Wi-Fi|Checked βœ… | +|Wi-Fi Name (SSID)|`robot-hackathon-78b09`| +|Wi-Fi Password|Copy from Bitwarden collection `Robot Hackathon` item `Wifi router WPA2-PSK`.| + +![Screenshot](wifi5-screenshot.png){ width="300" } + +#### Wireless - 2.4 GHz Wi-Fi + +|Setting|Value| +|---|---| +|Enable Wi-Fi|Checked βœ… | +|Wi-Fi Name (SSID)|`robot-hackathon-78b09`| +|Wi-Fi Password|Copy from Bitwarden collection `Robot Hackathon` item `Wifi router WPA2-PSK`.| + +![Screenshot](wifi2-screenshot.png){ width="300" } diff --git a/facilitator-guide/content/component/wifi-router/lan.png b/facilitator-guide/content/component/wifi-router/lan.png new file mode 100644 index 0000000..2298526 Binary files /dev/null and b/facilitator-guide/content/component/wifi-router/lan.png differ diff --git a/facilitator-guide/content/component/wifi-router/wifi2-screenshot.png b/facilitator-guide/content/component/wifi-router/wifi2-screenshot.png new file mode 100644 index 0000000..968c708 Binary files /dev/null and b/facilitator-guide/content/component/wifi-router/wifi2-screenshot.png differ diff --git a/facilitator-guide/content/component/wifi-router/wifi5-screenshot.png b/facilitator-guide/content/component/wifi-router/wifi5-screenshot.png new file mode 100644 index 0000000..482ffb3 Binary files /dev/null and b/facilitator-guide/content/component/wifi-router/wifi5-screenshot.png differ diff --git a/facilitator-guide/content/robot/auto-register-flow.drawio b/facilitator-guide/content/robot/auto-register-flow.drawio new file mode 100644 index 0000000..7dd2454 --- /dev/null +++ b/facilitator-guide/content/robot/auto-register-flow.drawio @@ -0,0 +1,350 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/facilitator-guide/content/robot/auto-register.md b/facilitator-guide/content/robot/auto-register.md new file mode 100644 index 0000000..862584a --- /dev/null +++ b/facilitator-guide/content/robot/auto-register.md @@ -0,0 +1,37 @@ +--- +title: Robot Auto Register +linktitle: Robot Auto Register +--- + +## Flow + +![](auto-register-flow.drawio) + +### How to setup your own `robot-auto-register` repository + +Create new private repo, for example `robot-auto-register-78b09` + +Create Fine-grained token: https://github.com/settings/personal-access-tokens + +![](token-permissions.png) + + +#### Example curl commands + +``` +export TOKEN="github_pat_xxx" + +curl -H "Authorization: token $TOKEN" \ + https://raw.githubusercontent.com/cloud-native-robotz-hackathon/robot-auto-register-78b09/main/terminator +``` + + +#### Run `configure-robot.yml` manualy + +```shell +export RCS_HUBCONTROLLER_USER=admin +export RCS_HUBCONTROLLER_PASSWORD=xxx +export RCS_HUBCONTROLLER_URL=https://web-hub-controller.apps.cluster-kxpkk.kxpkk.sandbox3582.opentlc.com +cd /opt/robot-config-service/ansible +ansible-playbook -i inventory configure-robot.yml +``` \ No newline at end of file diff --git a/facilitator-guide/content/robot/token-permissions.png b/facilitator-guide/content/robot/token-permissions.png new file mode 100644 index 0000000..9f03f3f Binary files /dev/null and b/facilitator-guide/content/robot/token-permissions.png differ diff --git a/facilitator-guide/mkdocs.yml b/facilitator-guide/mkdocs.yml index 78607d8..835c9c6 100644 --- a/facilitator-guide/mkdocs.yml +++ b/facilitator-guide/mkdocs.yml @@ -104,10 +104,12 @@ nav: - "On-Site Prerequisites": run-a-event/on-site-prerequisites.md - Component: - component/index.md - - Robot GiPiGo: component/robot-gipigo/index.md + - Robot GoPiGo: + - component/robot-gopigo/index.md + - Auto register: robot/auto-register.md - Data Center: component/data-center.md - Nine robot travel kit: component/nine-robot-travel-kit/index.md - + - Wifi Router: component/wifi-router.md - Robot Wave Rover: component/robot-waverover/index.md - Troubleshooting: troubleshooting/index.md - Development: diff --git a/facilitator-guide/run-local.sh b/facilitator-guide/run-local.sh index aec6cb3..efa10bf 100755 --- a/facilitator-guide/run-local.sh +++ b/facilitator-guide/run-local.sh @@ -1,9 +1,19 @@ #!/bin/bash -IMAGE=docs-local +IMAGE=quay.io/cloud-native-robotz-hackathon/facilitator-guide-builder:202602141820 -echo "Building documentation container..." -podman build -t $IMAGE . +# Get the directory where this script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +# Change to the facilitator-guide directory +cd "$SCRIPT_DIR" + +# Verify mkdocs.yml exists +if [ ! -f "mkdocs.yml" ]; then + echo "Error: mkdocs.yml not found in $SCRIPT_DIR" + echo "Please run this script from the facilitator-guide directory or ensure mkdocs.yml exists." + exit 1 +fi echo "Starting documentation server with live reload on http://localhost:8080" echo "Press Ctrl+C to stop the server" @@ -13,10 +23,12 @@ echo " - content/" echo " - mkdocs.yml" echo " - overrides/" echo "" +echo "Working directory: $SCRIPT_DIR" +echo "" podman run -ti --rm \ - -v $(pwd):/opt/app-root/src:z \ - --workdir /opt/app-root/src/facilitator-guide/ \ + -v "$SCRIPT_DIR":/opt/app-root/src:z \ + --workdir /opt/app-root/src \ -p 8080:8080 \ --name docs-local \ $IMAGE diff --git a/overview.drawio b/overview.drawio deleted file mode 100644 index 713dd57..0000000 --- a/overview.drawio +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/overview.drawio.v2.png b/overview.drawio.v2.png deleted file mode 100644 index ddc182c..0000000 Binary files a/overview.drawio.v2.png and /dev/null differ diff --git a/robot/lights-on.py b/robot/lights-on.py new file mode 100755 index 0000000..32ac74e --- /dev/null +++ b/robot/lights-on.py @@ -0,0 +1,29 @@ +#!/usr/bin/python3 + +import gopigo3 +import easygopigo3 as easy +import time + +easygpg = easy.EasyGoPiGo3() + +easygpg.open_eyes() +time.sleep(2) +easygpg.close_eyes() +easygpg.set_eye_color((0,255,0)) +easygpg.open_eyes() +time.sleep(2) +easygpg.close_eyes() +easygpg.set_eye_color((255,0,0)) +easygpg.open_eyes() +time.sleep(2) +easygpg.close_eyes() +#time.sleep(5) +#easygpg.open_left_eye() +#time.sleep(2) +#easygpg.close_left_eye() + + +# set_left_eye_color(color) +# set_left_right_color(color) +# set_eye_color(color) +