# 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
    parent: kuryr-kubernetes-octavia-base
    description: |
        Kuryr-Kubernetes tempest job running kuryr containerized

- job:
    name: kuryr-kubernetes-tempest-ovn-provider-ovn
    parent: kuryr-kubernetes-octavia-base
    description: |
        Kuryr-Kubernetes alias for kuryr kubernetes tempest test.
        Because of the change we introduced in switching over to Neutron OVN
        and Octavia OVN provider, this can be removed after updating
        ovn-octavia-provider zuul project.

- job:
    name: kuryr-kubernetes-tempest-systemd
    parent: kuryr-kubernetes-octavia-base
    description: |
      Kuryr-Kubernetes tempest job using octavia and running kuryr as systemd
      services
    vars:
      devstack_localrc:
        KURYR_K8S_CONTAINERIZED_DEPLOYMENT: false

- job:
    name: kuryr-kubernetes-tempest-centos-7
    parent: kuryr-kubernetes-tempest-systemd
    nodeset: openstack-centos-7-single-node
    voting: false

- job:
    name: kuryr-kubernetes-tempest-defaults
    parent: kuryr-kubernetes-octavia-base
    description: |
      Kuryr-Kubernetes tempest job running kuryr containerized with OVN,
      Octavias amphora, default set of handlers, default SG driver and default
      subnet driver.
    host-vars:
      controller:
        devstack_plugins:
          octavia: https://opendev.org/openstack/octavia
          octavia-tempest-plugin: https://opendev.org/openstack/octavia-tempest-plugin
    vars:
      devstack_localrc:
        KURYR_ENABLED_HANDLERS: ''
        KURYR_ENFORCE_SG_RULES: true
        KURYR_EP_DRIVER_OCTAVIA_PROVIDER: default
        KURYR_K8S_OCTAVIA_MEMBER_MODE: L3
        KURYR_LB_ALGORITHM: ROUND_ROBIN
        KURYR_SG_DRIVER: default
        KURYR_SUBNET_DRIVER: default
      devstack_local_conf:
        post-config:
          $OCTAVIA_CONF:
            controller_worker:
              amp_active_retries: 9999
            api_settings:
              enabled_provider_drivers: amphora:'Octavia Amphora driver'
            health_manager:
              failover_threads: 2
              health_update_threads: 2
              stats_update_threads: 2
      devstack_services:
        q-trunk: true
        o-da: false
    voting: true

- job:
    name: kuryr-kubernetes-tempest-ipv6
    parent: kuryr-kubernetes-octavia-base
    description: |
      Kuryr-Kubernetes tempest job running kuryr containerized with IPv6 pod
      and service networks using OVN and Octavia Amphora
      # TODO(gryf): investigate why NP does not work with IPv6
    host-vars:
      controller:
        devstack_plugins:
          octavia: https://opendev.org/openstack/octavia
          octavia-tempest-plugin: https://opendev.org/openstack/octavia-tempest-plugin
    vars:
      devstack_localrc:
        KURYR_ENABLED_HANDLERS: ''
        KURYR_ENFORCE_SG_RULES: true
        KURYR_EP_DRIVER_OCTAVIA_PROVIDER: default
        KURYR_IPV6: true
        KURYR_K8S_OCTAVIA_MEMBER_MODE: L3
        KURYR_LB_ALGORITHM: ROUND_ROBIN
        KURYR_SG_DRIVER: default
        KURYR_SUBNET_DRIVER: default
      devstack_local_conf:
        post-config:
          $OCTAVIA_CONF:
            controller_worker:
              amp_active_retries: 9999
            api_settings:
              enabled_provider_drivers: amphora:'Octavia Amphora driver'
            health_manager:
              failover_threads: 2
              health_update_threads: 2
              stats_update_threads: 2
      devstack_services:
        q-trunk: true
        o-da: false
    voting: false

- job:
    name: kuryr-kubernetes-tempest-ipv6-ovs
    parent: kuryr-kubernetes-octavia-base-ovs
    description: |
      Kuryr-Kubernetes tempest job running kuryr containerized with IPv6 pod
      and service networks based on OVS
      # TODO(gryf): investigate why NP does not work with IPv6
    vars:
      devstack_localrc:
        KURYR_ENABLED_HANDLERS: ''
        KURYR_IPV6: true
        KURYR_SG_DRIVER: default
        KURYR_SUBNET_DRIVER: default
      devstack_services:
        q-trunk: false
    voting: false

- job:
    name: kuryr-kubernetes-tempest-dual-stack
    parent: kuryr-kubernetes-octavia-base
    description: |
      Kuryr-Kubernetes tempest job running kuryr containerized with dual stack
      pod and service networks
    vars:
      devstack_localrc:
        KURYR_DUAL_STACK: true
    voting: false

- job:
    name: kuryr-kubernetes-tempest-lower-constraints
    parent: kuryr-kubernetes-octavia-base
    description: |
        Kuryr-Kubernetes tempest job running kuryr containerized with
        requirments from lower-constraints.txt
    vars:
      devstack_localrc:
        KURYR_CONTAINERS_USE_LOWER_CONSTRAINTS: true
    voting: false

- job:
    name: kuryr-kubernetes-tempest-l2
    parent: kuryr-kubernetes-octavia-base
    description: |
        Kuryr-Kubernetes tempest job using octavia in l2 mode, kuryr containerized
    vars:
      devstack_localrc:
        KURYR_K8S_OCTAVIA_MEMBER_MODE: L2

- job:
    name: kuryr-kubernetes-tempest-pools-namespace
    parent: kuryr-kubernetes-octavia-base
    description: |
      Tempest with containers, port pools and namespace subnet driver
    vars:
      devstack_localrc:
        KURYR_SUBNET_DRIVER: namespace
        KURYR_ENABLED_HANDLERS: vif,endpoints,service,namespace,pod_label,policy,kuryrnetworkpolicy,kuryrnetwork,kuryrport,kuryrloadbalancer
        KURYR_SG_DRIVER: policy
        KURYR_USE_PORT_POOLS: true
        KURYR_POD_VIF_DRIVER: neutron-vif
        KURYR_VIF_POOL_DRIVER: neutron
        KURYR_CONFIGMAP_MODIFIABLE: true

- job:
    name: kuryr-kubernetes-tempest-docker
    parent: kuryr-kubernetes-octavia-base
    vars:
      devstack_localrc:
        CONTAINER_ENGINE: docker
    voting: true

- job:
    name: kuryr-kubernetes-tempest-amphora
    parent: kuryr-kubernetes-base-ovn
    required-projects:
      - openstack/octavia
      - openstack/python-octaviaclient
      - openstack/octavia-tempest-plugin
    pre-run: playbooks/get_amphora_tarball.yaml
    host-vars:
      controller:
        devstack_plugins:
          octavia: https://opendev.org/openstack/octavia
          octavia-tempest-plugin: https://opendev.org/openstack/octavia-tempest-plugin
    vars:
      tempest_plugins:
        - kuryr-tempest-plugin
        - octavia-tempest-plugin
      devstack_localrc:
        KURYR_ENFORCE_SG_RULES: true
        OCTAVIA_AMP_IMAGE_FILE: /tmp/test-only-amphora-x64-haproxy-ubuntu-focal.qcow2
        OCTAVIA_AMP_IMAGE_NAME: test-only-amphora-x64-haproxy-ubuntu-focal
        OCTAVIA_AMP_IMAGE_SIZE: 3
      devstack_local_conf:
        post-config:
          $OCTAVIA_CONF:
            controller_worker:
              amp_active_retries: 9999
            health_manager:
              failover_threads: 2
              health_update_threads: 2
              stats_update_threads: 2
      devstack_services:
        octavia: true
        o-api: true
        o-cw: true
        o-hk: true
        o-hm: true
    voting: false

- job:
    name: kuryr-kubernetes-tempest-amphora-ovs
    parent: kuryr-kubernetes-octavia-base-ovs
    vars:
      devstack_localrc:
        KURYR_EP_DRIVER_OCTAVIA_PROVIDER: amphora
      devstack_local_conf:
        post-config:
          $OCTAVIA_CONF:
            controller_worker:
              amp_active_retries: 9999
            health_manager:
              failover_threads: 2
              health_update_threads: 2
              stats_update_threads: 2
            api_settings:
              enabled_provider_drivers: amphora:'Octavia Amphora driver'
    voting: false
