# Copyright 2015 PerfKitBenchmarker Authors. All rights reserved.
#
# 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.

from absl import flags

flags.DEFINE_string(
    'ceph_secret',
    None,
    'Name of the Ceph Secret used by Kubernetes in order to '
    'authenticate with Ceph. If provided, overrides keyring.',
)

flags.DEFINE_string(
    'ceph_keyring', '/etc/ceph/keyring', 'Path to the Ceph keyring file.'
)

flags.DEFINE_string('rbd_pool', 'rbd', 'Name of RBD pool for Ceph volumes.')

flags.DEFINE_string('rbd_user', 'admin', 'Name of RADOS user.')

flags.DEFINE_list(
    'ceph_monitors',
    [],
    'IP addresses and ports of Ceph Monitors. '
    'Must be provided when Ceph scratch disk is required. '
    'Example: "127.0.0.1:6789,192.168.1.1:6789"',
)

flags.DEFINE_string(
    'username',
    'root',
    'User name that Perfkit will attempt to use in order to '
    'SSH into Docker instance.',
)

flags.DEFINE_boolean(
    'docker_in_privileged_mode',
    True,
    'If set to True, will attempt to create Docker containers '
    'in a privileged mode. Note that some benchmarks execute '
    'commands which are only allowed in privileged mode.',
)
flags.DEFINE_boolean(
    'kubernetes_anti_affinity',
    True,
    'If set to True, PKB pods will not be scheduled on the '
    'same nodes as other PKB pods.',
)
flags.DEFINE_multi_string(
    'k8s_volume_parameters',
    None,
    'A colon separated key-value pair that will be '
    'added to Kubernetes storage class parameters.',
)
_K8S_PROVISIONERS = [
    'kubernetes.io/azure-disk',
    'kubernetes.io/gce-pd',
    'kubernetes.io/aws-ebs',
    'kubernetes.io/glusterfs',
]
flags.DEFINE_enum(
    'k8s_volume_provisioner',
    None,
    _K8S_PROVISIONERS,
    'The name of the provisioner to use for K8s storage classes.',
)
flags.DEFINE_string(
    'k8s_sriov_network',
    None,
    'The name of the network with sriov enabled interfaces',
)

SETUP_SSH = flags.DEFINE_boolean(
    'kubernetes_vm_setup_ssh',
    False,
    'Set up SSH on Kubernetes VMs. Probably not needed any more?',
)
DEFAULT_VM_GROUP_NODEPOOL = flags.DEFINE_string(
    # default is container_service.DEFAULT_NODEPOOL, but don't import because it
    # causes a runtime circular dependency.
    'kubernetes_vm_default_nodepool',
    'default',
    'The nodepool to place VMs in the default VM group into. Defaults to the '
    'default nodepool, but can be changed for better isolation.',
)
USE_NODE_SELECTORS = flags.DEFINE_bool(
    'use_k8s_vm_node_selectors',
    True,
    'Whether to require node selectors to be present when creating K8s VMs. '
    'Disable this if you are using a pre-existing k8s cluster without labels.',
)
