2016-08-24 13:27:04 +02:00
|
|
|
# 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.
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2017-03-28 09:47:09 +08:00
|
|
|
from kuryr.lib._i18n import _
|
2016-08-24 13:27:04 +02:00
|
|
|
from kuryr.lib import config as lib_config
|
|
|
|
from oslo_config import cfg
|
|
|
|
from oslo_log import log as logging
|
2017-03-21 08:11:41 +00:00
|
|
|
|
2019-01-30 12:52:57 +03:00
|
|
|
from kuryr_kubernetes import constants
|
2017-03-21 08:11:41 +00:00
|
|
|
from kuryr_kubernetes import version
|
2016-08-24 13:27:04 +02:00
|
|
|
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
kuryr_k8s_opts = [
|
|
|
|
cfg.StrOpt('pybasedir',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_('Directory where Kuryr-kubernetes python module is '
|
|
|
|
'installed.'),
|
|
|
|
default=os.path.abspath(
|
|
|
|
os.path.join(os.path.dirname(__file__),
|
|
|
|
'../../'))),
|
2016-08-24 13:27:04 +02:00
|
|
|
]
|
|
|
|
|
2017-10-25 21:29:22 +02:00
|
|
|
daemon_opts = [
|
|
|
|
cfg.StrOpt('bind_address',
|
|
|
|
help=_('Bind address for CNI daemon HTTP server. It is '
|
|
|
|
'recommened to allow only local connections.'),
|
2019-05-20 18:11:42 +03:00
|
|
|
default='127.0.0.1:5036'),
|
2017-10-25 21:29:22 +02:00
|
|
|
cfg.IntOpt('worker_num',
|
|
|
|
help=_('Maximum number of processes that will be spawned to '
|
|
|
|
'process requests from CNI driver.'),
|
|
|
|
default=30),
|
|
|
|
cfg.IntOpt('vif_annotation_timeout',
|
|
|
|
help=_('Time (in seconds) the CNI daemon will wait for VIF '
|
|
|
|
'annotation to appear in pod metadata before failing '
|
|
|
|
'the CNI request.'),
|
|
|
|
default=60),
|
|
|
|
cfg.IntOpt('pyroute2_timeout',
|
|
|
|
help=_('Kuryr uses pyroute2 library to manipulate networking '
|
|
|
|
'interfaces. When processing a high number of Kuryr '
|
|
|
|
'requests in parallel, it may take kernel more time to '
|
|
|
|
'process all networking stack changes. This option '
|
|
|
|
'allows to tune internal pyroute2 timeout.'),
|
|
|
|
default=10),
|
2017-11-03 13:25:15 +01:00
|
|
|
cfg.BoolOpt('docker_mode',
|
|
|
|
help=_('Set to True when you are running kuryr-daemon inside '
|
|
|
|
'a Docker container on Kubernetes host. E.g. as '
|
|
|
|
'DaemonSet on Kubernetes cluster Kuryr is supposed to '
|
2018-11-21 16:04:19 +08:00
|
|
|
'provide networking for. This mainly means that '
|
2017-11-03 13:25:15 +01:00
|
|
|
'kuryr-daemon will look for network namespaces in '
|
|
|
|
'$netns_proc_dir instead of /proc.'),
|
|
|
|
default=False),
|
|
|
|
cfg.StrOpt('netns_proc_dir',
|
|
|
|
help=_("When docker_mode is set to True, this config option "
|
|
|
|
"should be set to where host's /proc directory is "
|
|
|
|
"mounted. Please note that mounting it is necessary to "
|
|
|
|
"allow Kuryr-Kubernetes to move host interfaces between "
|
|
|
|
"host network namespaces, which is essential for Kuryr "
|
|
|
|
"to work."),
|
|
|
|
default=None),
|
2018-01-25 02:05:44 +00:00
|
|
|
cfg.IntOpt('cni_failures_count',
|
|
|
|
help=_('Maximum number of consecutive failures of kuryr-daemon '
|
|
|
|
'when processing requests. If this number is exceeded, '
|
|
|
|
'kuryr-daemon will be marked as unhealthy.'),
|
|
|
|
default=3),
|
2017-10-25 21:29:22 +02:00
|
|
|
]
|
|
|
|
|
2016-08-24 13:27:04 +02:00
|
|
|
k8s_opts = [
|
|
|
|
cfg.StrOpt('api_root',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("The root URL of the Kubernetes API"),
|
|
|
|
default=os.environ.get('K8S_API', 'http://localhost:8080')),
|
2017-03-03 13:54:38 +05:30
|
|
|
cfg.StrOpt('ssl_client_crt_file',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("Absolute path to client cert to "
|
|
|
|
"connect to HTTPS K8S_API")),
|
2017-03-03 13:54:38 +05:30
|
|
|
cfg.StrOpt('ssl_client_key_file',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("Absolute path client key file to "
|
|
|
|
"connect to HTTPS K8S_API")),
|
2017-03-03 13:54:38 +05:30
|
|
|
cfg.StrOpt('ssl_ca_crt_file',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("Absolute path to ca cert file to "
|
2019-12-10 18:15:19 +01:00
|
|
|
"connect to HTTPS K8S_API"),
|
|
|
|
default='/var/run/secrets/kubernetes.io/serviceaccount/ca.crt'),
|
2017-03-03 13:54:38 +05:30
|
|
|
cfg.BoolOpt('ssl_verify_server_crt',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("HTTPS K8S_API server identity verification"),
|
|
|
|
default=False),
|
2017-05-10 11:55:57 -04:00
|
|
|
cfg.StrOpt('token_file',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("The token to talk to the k8s API"),
|
2019-12-10 18:15:19 +01:00
|
|
|
default='/var/run/secrets/kubernetes.io/serviceaccount/token'),
|
2016-11-15 20:21:27 +03:00
|
|
|
cfg.StrOpt('pod_project_driver',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("The driver to determine OpenStack "
|
|
|
|
"project for pod ports"),
|
|
|
|
default='default'),
|
2017-01-31 23:19:32 +03:00
|
|
|
cfg.StrOpt('service_project_driver',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("The driver to determine OpenStack "
|
|
|
|
"project for services"),
|
|
|
|
default='default'),
|
2018-07-10 17:19:53 +02:00
|
|
|
cfg.StrOpt('namespace_project_driver',
|
|
|
|
help=_("The driver to determine OpenStack "
|
|
|
|
"project for namespaces"),
|
|
|
|
default='default'),
|
2018-07-09 04:39:05 -04:00
|
|
|
cfg.StrOpt('network_policy_project_driver',
|
|
|
|
help=_("The driver to determine OpenStack "
|
|
|
|
"project for network policies"),
|
|
|
|
default='default'),
|
2016-11-16 15:19:11 +03:00
|
|
|
cfg.StrOpt('pod_subnets_driver',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("The driver to determine Neutron "
|
|
|
|
"subnets for pod ports"),
|
|
|
|
default='default'),
|
2017-01-31 23:19:32 +03:00
|
|
|
cfg.StrOpt('service_subnets_driver',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("The driver to determine Neutron "
|
|
|
|
"subnets for services"),
|
|
|
|
default='default'),
|
2016-11-18 13:43:46 +03:00
|
|
|
cfg.StrOpt('pod_security_groups_driver',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("The driver to determine Neutron "
|
|
|
|
"security groups for pods"),
|
|
|
|
default='default'),
|
2017-01-31 23:19:32 +03:00
|
|
|
cfg.StrOpt('service_security_groups_driver',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("The driver to determine Neutron "
|
|
|
|
"security groups for services"),
|
|
|
|
default='default'),
|
2016-11-21 04:18:05 +03:00
|
|
|
cfg.StrOpt('pod_vif_driver',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("The driver that provides VIFs for Kubernetes Pods."),
|
|
|
|
default='neutron-vif'),
|
2017-03-28 18:43:26 +03:00
|
|
|
cfg.StrOpt('endpoints_lbaas_driver',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("The driver that provides LoadBalancers for "
|
|
|
|
"Kubernetes Endpoints"),
|
2019-01-16 16:40:03 +01:00
|
|
|
default='lbaasv2'),
|
2018-09-17 17:58:46 +03:00
|
|
|
cfg.StrOpt('endpoints_driver_octavia_provider',
|
|
|
|
help=_("The Octavia load balancer provider that will be used "
|
|
|
|
"to support Kubernetes Endpoints"),
|
|
|
|
default='default'),
|
2017-02-22 10:18:37 +01:00
|
|
|
cfg.StrOpt('vif_pool_driver',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("The driver that manages VIFs pools for "
|
2017-08-30 10:07:11 +00:00
|
|
|
"Kubernetes Pods"),
|
2017-06-08 15:53:52 +03:00
|
|
|
default='noop'),
|
2017-09-18 11:22:22 +00:00
|
|
|
cfg.BoolOpt('port_debug',
|
|
|
|
help=_('Enable port debug to force kuryr port names to be '
|
|
|
|
'set to their corresponding pod names.'),
|
|
|
|
default=False),
|
2017-08-27 12:27:18 +03:00
|
|
|
cfg.StrOpt('service_public_ip_driver',
|
|
|
|
help=_("The driver that provides external IP for LB at "
|
|
|
|
"Kubernetes"),
|
|
|
|
default='neutron_floating_ip'),
|
2017-08-29 08:43:34 +02:00
|
|
|
cfg.BoolOpt('enable_manager',
|
|
|
|
help=_("Enable Manager to manage the pools."),
|
|
|
|
default=False),
|
2018-02-22 16:12:34 +09:00
|
|
|
cfg.IntOpt('watch_retry_timeout',
|
|
|
|
help=_('Time (in seconds) the watcher retries watching for.'),
|
|
|
|
default=60),
|
2019-09-04 18:41:32 +02:00
|
|
|
cfg.IntOpt('watch_connection_timeout',
|
|
|
|
help=_('TCP connection timeout (in seconds) for the watcher '
|
|
|
|
'connections to K8s API.'),
|
|
|
|
default=30),
|
|
|
|
cfg.IntOpt('watch_read_timeout',
|
|
|
|
help=_('TCP read timeout (in seconds) for the watcher '
|
|
|
|
'connections to K8s API. This affects reaction to time '
|
|
|
|
'when there are no events being streamed from K8s API. '
|
|
|
|
'When too low, Kuryr will reconnect more often. When '
|
|
|
|
'too high, Kuryr will take longer to reconnect when K8s '
|
|
|
|
'API stream was being silently broken.'),
|
|
|
|
default=60),
|
2018-03-23 11:46:19 +01:00
|
|
|
cfg.ListOpt('enabled_handlers',
|
|
|
|
help=_("The comma-separated handlers that should be "
|
|
|
|
"registered for watching in the pipeline."),
|
|
|
|
default=['vif', 'lb', 'lbaasspec']),
|
2018-04-23 12:49:37 +02:00
|
|
|
cfg.BoolOpt('controller_ha',
|
|
|
|
help=_('Enable kuryr-controller active/passive HA. Only '
|
|
|
|
'supported in containerized deployments on Kubernetes '
|
|
|
|
'or OpenShift.'),
|
|
|
|
default=False),
|
|
|
|
cfg.PortOpt('controller_ha_elector_port',
|
|
|
|
help=_('Port on which leader-elector pod is listening to.'),
|
|
|
|
default=16401),
|
2018-07-09 04:39:05 -04:00
|
|
|
cfg.StrOpt('network_policy_driver',
|
|
|
|
help=_("Driver for network policies"),
|
|
|
|
default='default'),
|
2018-06-15 14:11:34 +08:00
|
|
|
cfg.ListOpt('multi_vif_drivers',
|
2018-11-21 16:04:19 +08:00
|
|
|
help=_("The drivers that provide additional VIFs for "
|
2018-06-15 14:11:34 +08:00
|
|
|
"Kubernetes Pods."),
|
|
|
|
default='noop'),
|
2019-09-30 14:15:26 +09:00
|
|
|
cfg.StrOpt('additional_ifname_prefix',
|
|
|
|
help=_("The prefix to use for additional vifs created by "
|
|
|
|
" multi_vif drivers"),
|
|
|
|
default='eth'),
|
2016-08-24 13:27:04 +02:00
|
|
|
]
|
|
|
|
|
2016-11-15 20:21:27 +03:00
|
|
|
neutron_defaults = [
|
|
|
|
cfg.StrOpt('project',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("Default OpenStack project ID for "
|
|
|
|
"Kubernetes resources")),
|
2016-11-16 15:19:11 +03:00
|
|
|
cfg.StrOpt('pod_subnet',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("Default Neutron subnet ID for Kubernetes pods")),
|
2016-11-18 13:43:46 +03:00
|
|
|
cfg.ListOpt('pod_security_groups',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("Default Neutron security groups' IDs "
|
|
|
|
"for Kubernetes pods")),
|
2016-11-20 15:45:45 +03:00
|
|
|
cfg.StrOpt('ovs_bridge',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("Default OpenVSwitch integration bridge"),
|
|
|
|
sample_default="br-int"),
|
2017-01-31 23:19:32 +03:00
|
|
|
cfg.StrOpt('service_subnet',
|
2017-06-08 15:53:52 +03:00
|
|
|
help=_("Default Neutron subnet ID for Kubernetes services")),
|
2018-02-16 12:13:17 +01:00
|
|
|
cfg.StrOpt('external_svc_net',
|
|
|
|
help=_("Default external network ID for Kubernetes services")),
|
2017-08-27 12:27:18 +03:00
|
|
|
cfg.StrOpt('external_svc_subnet',
|
2018-02-16 12:13:17 +01:00
|
|
|
help=_("Optional external subnet ID for Kubernetes services"),
|
|
|
|
default=None),
|
2018-03-14 17:41:14 +08:00
|
|
|
cfg.IntOpt('network_device_mtu',
|
|
|
|
help='Default MTU setting for network interface.',
|
|
|
|
default=1500,),
|
2018-03-06 15:02:48 +09:00
|
|
|
cfg.IntOpt('lbaas_activation_timeout',
|
|
|
|
help=_("Time (in seconds) that kuryr controller waits for "
|
|
|
|
"neutron LBaaS to be activated"),
|
|
|
|
default=300),
|
2019-01-10 17:43:21 +03:00
|
|
|
cfg.DictOpt('subnet_mapping',
|
|
|
|
help=_("A mapping of default subnets for certain driverType "
|
|
|
|
"in a form of <driverType>:<SUBNET-ID>"),
|
|
|
|
default={}),
|
2019-02-13 10:04:08 +01:00
|
|
|
cfg.ListOpt('resource_tags',
|
|
|
|
help=_("List of tags that will be applied to all OpenStack "
|
|
|
|
"(Neutron and Octavia) resources created by Kuryr. "
|
|
|
|
"This can be used to identify and garbage-collect "
|
|
|
|
"them when Kubernetes cluster Kuryr was serving is no "
|
|
|
|
"longer needed."),
|
2019-04-24 12:08:20 +02:00
|
|
|
default=[]),
|
2016-11-15 20:21:27 +03:00
|
|
|
]
|
2016-08-24 13:27:04 +02:00
|
|
|
|
2017-08-30 10:07:11 +00:00
|
|
|
octavia_defaults = [
|
|
|
|
cfg.StrOpt('member_mode',
|
|
|
|
help=_("Define the communication mode between load balanacer "
|
|
|
|
"and its members"),
|
|
|
|
default='L3'),
|
svc namespace isolation support for different octavia drivers
This patch ensures svc namespace isolation may work with different
types of octavia drivers. Depending on the ownership of the security
group, as well as the tenant kuryr-controller is running on, there
may be a need to create (and apply) a new security group for the
loadbalancer VIP port, or simply update the existing one.
A new configuration option, names sg_mode has been added that
accepts update|create depending on the desired behavior.
As of today, the options will be:
- Amphora driver: needs to 'update' the SG as the VIP port is connected
to the amphora through the allow_address_pair option, and the SG
rules are enforced on the amphora port rather than on the VIP port.
However, as both ports share the same SG, updating it will ensure
the proper isolation. Note the SG in the amphora driver belongs to
the admin tenant instead of the one creating the loadbalancer.
- OVN driver: SG is applied directly on the VIP port, so both
updating or creating a SG will work as the VIP port belongs to the
tenant. However, as of today OVN-driver does not create a SG for
the loadbalancer and the SG applied is the default one. Thus, there
is a need for setting the sg_mode to 'create', so that a new one is
created and the proper rules are applied there.
Implements: blueprint octavia-ovn-provider
Change-Id: I4ad4d55b75ce7a6d5e102b5f35bedc07af4fbb96
2018-09-24 11:44:36 +02:00
|
|
|
cfg.StrOpt('sg_mode',
|
|
|
|
help=_("Define the LBaaS SG policy."),
|
|
|
|
choices=[('create', 'replace the VIP SG with a new one'),
|
|
|
|
('update', 'add rules to the existing VIP SG')],
|
|
|
|
default='update'),
|
2019-06-13 19:39:16 +00:00
|
|
|
cfg.BoolOpt('enforce_sg_rules',
|
|
|
|
help=_("Enable the enforcement of SG rules at the LB SG "
|
|
|
|
"in case the LB does not maintain the source IP "
|
|
|
|
"of the caller resource"),
|
|
|
|
default=True),
|
2019-11-26 15:15:01 +01:00
|
|
|
cfg.StrOpt('lb_algorithm',
|
|
|
|
help=_("The load-balancer algoritm that distributed traffic "
|
|
|
|
"to the pool members. The options are: ROUND_ROBIN, "
|
|
|
|
"LEAST_CONNECTIONS, SOURCE_IP and SOURCE_IP_PORT."),
|
|
|
|
default='ROUND_ROBIN'),
|
2017-08-30 10:07:11 +00:00
|
|
|
]
|
|
|
|
|
2017-11-14 17:02:23 +00:00
|
|
|
cache_defaults = [
|
|
|
|
cfg.BoolOpt('enabled',
|
|
|
|
help=_("Enable caching."),
|
|
|
|
default=True),
|
|
|
|
cfg.StrOpt('backend',
|
|
|
|
help=_("Select backend cache option."),
|
|
|
|
default="dogpile.cache.memory"),
|
|
|
|
]
|
|
|
|
|
2018-07-10 18:29:07 +02:00
|
|
|
nested_vif_driver_opts = [
|
|
|
|
cfg.StrOpt('worker_nodes_subnet',
|
|
|
|
help=_("Neutron subnet ID for k8s worker node vms."),
|
|
|
|
default=''),
|
2019-04-24 12:08:20 +02:00
|
|
|
cfg.IntOpt('rev_update_attempts',
|
|
|
|
help=_("How many time to try to re-update the neutron resource "
|
|
|
|
"when revision has been changed by other thread"),
|
|
|
|
default=3),
|
2018-07-10 18:29:07 +02:00
|
|
|
]
|
|
|
|
|
2017-10-10 14:30:59 +03:00
|
|
|
DEFAULT_PHYSNET_SUBNET_MAPPINGS = {}
|
2017-10-10 15:06:12 +03:00
|
|
|
DEFAULT_DEVICE_MAPPINGS = []
|
2017-10-10 14:30:59 +03:00
|
|
|
sriov_opts = [
|
2019-03-27 20:05:32 +03:00
|
|
|
cfg.StrOpt('kubelet_root_dir',
|
|
|
|
help=_("The root directory of the Kubelet daemon"),
|
|
|
|
default='/var/lib/kubelet'),
|
2019-04-29 17:29:25 +03:00
|
|
|
cfg.BoolOpt('enable_pod_resource_service',
|
|
|
|
help=_("Enable PodResources service"),
|
|
|
|
default=False),
|
2017-10-10 14:30:59 +03:00
|
|
|
cfg.DictOpt('default_physnet_subnets',
|
|
|
|
help=_("A mapping of default subnets for certain physnets "
|
|
|
|
"in a form of physnet-name:<SUBNET-ID>"),
|
|
|
|
default=DEFAULT_PHYSNET_SUBNET_MAPPINGS),
|
2017-10-10 15:06:12 +03:00
|
|
|
cfg.ListOpt('physical_device_mappings',
|
|
|
|
default=DEFAULT_DEVICE_MAPPINGS,
|
|
|
|
help=_("Comma-separated list of "
|
|
|
|
"<physical_network>:<network_device> tuples mapping "
|
|
|
|
"physical network names to the agent's node-specific "
|
|
|
|
"physical network device interfaces of SR-IOV physical "
|
|
|
|
"function to be used for VLAN networks.")),
|
2019-01-30 12:52:57 +03:00
|
|
|
cfg.DictOpt('physnet_resource_mappings',
|
|
|
|
help=_("A mapping of physnets for certain sriov dp "
|
|
|
|
"resource name in a form of "
|
|
|
|
"physnet-name:resource name. "
|
|
|
|
"Resource name is listed in sriov device plugin "
|
|
|
|
"configuation file."),
|
|
|
|
default=DEFAULT_PHYSNET_SUBNET_MAPPINGS),
|
|
|
|
cfg.StrOpt('device_plugin_resource_prefix',
|
|
|
|
help=_("This prefix is used by sriov-network-device-plugin "
|
|
|
|
"It concatenates with resource suffix defined in "
|
|
|
|
"sriov device plugin configuration file."),
|
|
|
|
default=constants.K8S_SRIOV_PREFIX),
|
2019-04-04 16:58:40 +03:00
|
|
|
cfg.DictOpt('resource_driver_mappings',
|
|
|
|
help=_("A mappping driver names for certain resource "
|
|
|
|
"names. Expected that device of VIF related to "
|
|
|
|
"exact physnet should be binded on specified driver."),
|
|
|
|
default=DEFAULT_PHYSNET_SUBNET_MAPPINGS),
|
2017-10-10 14:30:59 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
|
2016-08-24 13:27:04 +02:00
|
|
|
CONF = cfg.CONF
|
2016-09-21 15:19:53 +02:00
|
|
|
CONF.register_opts(kuryr_k8s_opts)
|
2017-10-25 21:29:22 +02:00
|
|
|
CONF.register_opts(daemon_opts, group='cni_daemon')
|
2016-09-21 15:19:53 +02:00
|
|
|
CONF.register_opts(k8s_opts, group='kubernetes')
|
2016-11-15 20:21:27 +03:00
|
|
|
CONF.register_opts(neutron_defaults, group='neutron_defaults')
|
2017-08-30 10:07:11 +00:00
|
|
|
CONF.register_opts(octavia_defaults, group='octavia_defaults')
|
2017-11-14 17:02:23 +00:00
|
|
|
CONF.register_opts(cache_defaults, group='cache_defaults')
|
2018-07-10 18:29:07 +02:00
|
|
|
CONF.register_opts(nested_vif_driver_opts, group='pod_vif_nested')
|
2017-10-10 14:30:59 +03:00
|
|
|
CONF.register_opts(sriov_opts, group='sriov')
|
2016-08-24 13:27:04 +02:00
|
|
|
|
|
|
|
CONF.register_opts(lib_config.core_opts)
|
|
|
|
CONF.register_opts(lib_config.binding_opts, 'binding')
|
2016-09-21 15:19:53 +02:00
|
|
|
lib_config.register_neutron_opts(CONF)
|
2016-08-24 13:27:04 +02:00
|
|
|
|
|
|
|
logging.register_options(CONF)
|
|
|
|
|
|
|
|
|
|
|
|
def init(args, **kwargs):
|
2017-03-21 08:11:41 +00:00
|
|
|
version_k8s = version.version_info.version_string()
|
2016-08-24 13:27:04 +02:00
|
|
|
CONF(args=args, project='kuryr-k8s', version=version_k8s, **kwargs)
|
2019-10-11 14:00:57 +03:00
|
|
|
if os.environ.get('CNI_COMMAND') == 'VERSION':
|
|
|
|
CONF.set_default('use_stderr', True)
|
2016-08-24 13:27:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
def setup_logging():
|
|
|
|
|
|
|
|
logging.setup(CONF, 'kuryr-kubernetes')
|
|
|
|
logging.set_defaults(default_log_levels=logging.get_default_log_levels())
|
2017-03-21 08:11:41 +00:00
|
|
|
version_k8s = version.version_info.version_string()
|
2017-03-28 09:47:09 +08:00
|
|
|
LOG.info("Logging enabled!")
|
|
|
|
LOG.info("%(prog)s version %(version)s",
|
|
|
|
{'prog': sys.argv[0], 'version': version_k8s})
|