# Copyright 2018 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- job:
    name: kuryr-kubernetes-tempest-multinode
    parent: kuryr-kubernetes-octavia-base
    description: |
        Kuryr-Kubernetes tempest multinode job with OVN
    nodeset: openstack-two-node-focal
    host-vars:
      controller:
        devstack_plugins:
          octavia: https://opendev.org/openstack/octavia
          octavia-tempest-plugin: https://opendev.org/openstack/octavia-tempest-plugin
    group-vars:
      subnode:
        devstack_plugins:
          devstack-plugin-container: https://opendev.org/openstack/devstack-plugin-container
          kuryr-kubernetes: https://opendev.org/openstack/kuryr-kubernetes
        devstack_services:
          c-bak: false
          c-vol: false
          dstat: false
          kubernetes-master: false
          kubernetes-worker: true
          kuryr-daemon: true
          kuryr-kubernetes: false
          neutron: true
          ovn-northd: false
          ovn-octavia-provider: true
          placement-client: true
          q-svc: false
        devstack_local_conf:
          post-config:
            $OCTAVIA_CONF:
              controller_worker:
                amp_active_retries: 9999
              api_settings:
                enabled_provider_drivers: amphora:'Octavia Amphora driver',ovn:'Octavia OVN driver'
              health_manager:
                failover_threads: 2
                health_update_threads: 2
                stats_update_threads: 2
        devstack_localrc:
          CONTAINER_ENGINE: crio
          CRIO_VERSION: "1.22"
          KURYR_ENABLED_HANDLERS: vif,endpoints,service,namespace,pod_label,policy,kuryrnetworkpolicy,kuryrnetwork,kuryrport,kuryrloadbalancer
          KURYR_ENFORCE_SG_RULES: false
          KURYR_EP_DRIVER_OCTAVIA_PROVIDER: ovn
          KURYR_K8S_OCTAVIA_MEMBER_MODE: L2
          KURYR_LB_ALGORITHM: SOURCE_IP_PORT
          KURYR_NEUTRON_DEFAULT_ROUTER: kuryr-router
          KURYR_SG_DRIVER: policy
          KURYR_SUBNET_DRIVER: namespace
          OVN_BRANCH: v20.06.2
          OVN_BUILD_FROM_SOURCE: true
          OVN_L3_CREATE_PUBLIC_NETWORK: true
          VAR_RUN_PATH: /usr/local/var/run
    vars:
      tempest_test_regex: '^(kuryr_tempest_plugin.tests.scenario.test_cross_ping_multi_worker.TestCrossPingScenarioMultiWorker)'
      devstack_localrc:
        KURYR_K8S_MULTI_WORKER_TESTS: true
      devstack_local_conf:
        post-config:
          $OCTAVIA_CONF:
            controller_worker:
              amp_active_retries: 9999
            api_settings:
              enabled_provider_drivers: amphora:'Octavia Amphora driver',ovn:'Octavia OVN driver'
            health_manager:
              failover_threads: 2
              health_update_threads: 2
              stats_update_threads: 2
      devstack_services:
        kubernetes-master: true
        kubernetes-worker: false
        kuryr-daemon: true
        kuryr-kubernetes: true
      zuul_copy_output:
        '{{ devstack_base_dir }}/data/ovn': 'logs'
        '{{ devstack_log_dir }}/ovsdb-server-nb.log': 'logs'
        '{{ devstack_log_dir }}/ovsdb-server-sb.log': 'logs'
    voting: false

- job:
    name: kuryr-kubernetes-tempest-multinode-ovs
    parent: kuryr-kubernetes-octavia-base-ovs
    description: |
        Kuryr-Kubernetes tempest multinode job with OVS
    nodeset: openstack-two-node-focal
    group-vars:
      subnode:
        devstack_plugins:
          devstack-plugin-container: https://opendev.org/openstack/devstack-plugin-container
          kuryr-kubernetes: https://opendev.org/openstack/kuryr-kubernetes
        devstack_services:
          c-bak: false
          c-vol: false
          dstat: false
          kubernetes-master: false
          kubernetes-worker: true
          kuryr-daemon: true
          kuryr-kubernetes: false
          neutron: true
          ovn-controller: false
          ovs-vswitchd: false
          ovsdb-server: false
          placement-client: true
          q-agt: true
          q-dhcp: true
          q-l3: true
          q-meta: true
          q-ovn-metadata-agent: false
          q-svc: false
        devstack_localrc:
          CONTAINER_ENGINE: crio
          CRIO_VERSION: "1.22"
          KURYR_ENABLED_HANDLERS: vif,endpoints,service,namespace,pod_label,policy,kuryrnetworkpolicy,kuryrnetwork,kuryrport,kuryrloadbalancer
          KURYR_ENFORCE_SG_RULES: true
          KURYR_SG_DRIVER: policy
          KURYR_SUBNET_DRIVER: namespace
          ML2_L3_PLUGIN: router
          Q_AGENT: openvswitch
          Q_ML2_PLUGIN_MECHANISM_DRIVERS: openvswitch,linuxbridge
          Q_ML2_TENANT_NETWORK_TYPE: vxlan
    vars:
      tempest_test_regex: '^(kuryr_tempest_plugin.tests.scenario.test_cross_ping_multi_worker.TestCrossPingScenarioMultiWorker)'
      devstack_services:
        dstat: false
        kubernetes-master: true
        kubernetes-worker: false
        kuryr-daemon: true
        kuryr-kubernetes: true
        neutron: true
      devstack_localrc:
        KURYR_K8S_MULTI_WORKER_TESTS: true
    voting: false

- job:
    name: kuryr-kubernetes-tempest-multinode-ha
    parent: kuryr-kubernetes-tempest-multinode
    description: |
        Kuryr-Kubernetes tempest multinode job running containerized in HA
    timeout: 7800
    vars:
      devstack_localrc:
        KURYR_CONTROLLER_REPLICAS: 2
        KURYR_K8S_SERIAL_TESTS: true
      tempest_concurrency: 1
    group-vars:
      subnode:
        devstack_plugins:
          devstack-plugin-container: https://opendev.org/openstack/devstack-plugin-container
          kuryr-kubernetes: https://opendev.org/openstack/kuryr-kubernetes
        devstack_services:
          kubernetes-worker: true
