# Copyright 2021 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-e2e-np
    parent: devstack
    description: |
        Kuryr-Kubernetes job with OVN and Octavia provider OVN running k8s network policy e2e tests
    required-projects:
      - openstack/devstack-plugin-container
      - openstack/kuryr-kubernetes
      - openstack/neutron
      - openstack/octavia
      - openstack/ovn-octavia-provider
      - openstack/python-octaviaclient
    pre-run: playbooks/get_amphora_tarball.yaml
    post-run:
      - playbooks/run_k8s_e2e_tests.yaml
      - playbooks/copy-k8s-logs.yaml
      - playbooks/copy-crio-logs.yaml
    post-timeout: 7200
    host-vars:
      controller:
        devstack_plugins:
          devstack-plugin-container: https://opendev.org/openstack/devstack-plugin-container
          kuryr-kubernetes: https://opendev.org/openstack/kuryr-kubernetes
          neutron: https://opendev.org/openstack/neutron
          octavia: https://opendev.org/openstack/octavia
          ovn-octavia-provider: https://opendev.org/openstack/ovn-octavia-provider
    vars:
      network_api_extensions_common:
        - tag-ports-during-bulk-creation
      devstack_localrc:
        CONTAINER_ENGINE: crio
        CRIO_VERSION: "1.22"
        ETCD_USE_RAMDISK: true
        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_API_PORT: 6443
        KURYR_K8S_CLOUD_PROVIDER: false
        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
        ML2_L3_PLUGIN: ovn-router,trunk,qos
        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
        OVN_BRANCH: v20.06.2
        OVN_BUILD_FROM_SOURCE: true
        OVN_L3_CREATE_PUBLIC_NETWORK: true
        PHYSICAL_NETWORK: public
        Q_AGENT: ovn
        Q_BUILD_OVS_FROM_GIT: true
        Q_ML2_PLUGIN_MECHANISM_DRIVERS: ovn,logger
        Q_ML2_PLUGIN_TYPE_DRIVERS: local,flat,vlan,geneve
        Q_ML2_TENANT_NETWORK_TYPE: geneve
        Q_USE_PROVIDERNET_FOR_PUBLIC: true
        VAR_RUN_PATH: /usr/local/var/run
      devstack_services:
        # TODO(dmellado):Temporary workaround until proper fix
        base: false
        c-api: false
        c-bak: false
        c-sch: false
        c-vol: false
        cinder: false
        coredns: false
        # Need to disable dstat due to bug https://github.com/dstat-real/dstat/pull/162
        dstat: false
        etcd3: true
        g-api: true
        g-reg: true
        key: true
        kubernetes-master: true
        kuryr-daemon: true
        kuryr-kubernetes: true
        mysql: true
        n-api-meta: true
        n-api: true
        n-cond: true
        n-cpu: true
        n-sch: true
        neutron-tag-ports-during-bulk-creation: true
        neutron: true
        o-api: true
        o-cw: true
        o-da: true
        o-hk: true
        o-hm: true
        octavia: true
        ovn-controller: true
        ovn-northd: true
        placement-api: true
        placement-client: true
        q-agt: false
        q-dhcp: false
        q-l3: false
        q-meta: false
        q-ovn-metadata-agent: true
        q-qos: true
        q-svc: true
        q-trunk: true
        rabbit: true
        s-account: false
        s-container: false
        s-object: false
        s-proxy: 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'
      kubetest_version: v1.20.2
      np_parallel_number: 2
      gopkg: go1.15.2.linux-amd64.tar.gz
      np_sleep: 30
      zuul_copy_output:
        '/home/zuul/np_kubetest.log': 'logs'
        '/home/zuul/np_sctp_kubetest.log': 'logs'
        '{{ devstack_log_dir }}/kubernetes': 'logs'
        '{{ devstack_log_dir }}/crio': 'logs'
    irrelevant-files:
      - ^.*\.rst$
      - ^doc/.*$
      - ^releasenotes/.*$
      - ^contrib/.*$
    voting: false
