Coverage for ocp_resources/dns_operator_openshift_io.py: 0%
32 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
1# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md
3from typing import Any, Dict, List, Optional
4from ocp_resources.resource import Resource
7class DNS(Resource):
8 """
9 DNS manages the CoreDNS component to provide a name resolution service for pods and services in the cluster.
10 This supports the DNS-based service discovery specification: https://github.com/kubernetes/dns/blob/master/docs/specification.md
11 More details: https://kubernetes.io/docs/tasks/administer-cluster/coredns
12 Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
13 """
15 api_group: str = Resource.ApiGroup.OPERATOR_OPENSHIFT_IO
17 def __init__(
18 self,
19 cache: Optional[Dict[str, Any]] = None,
20 log_level: Optional[str] = "",
21 management_state: Optional[str] = "",
22 node_placement: Optional[Dict[str, Any]] = None,
23 operator_log_level: Optional[str] = "",
24 servers: Optional[List[Any]] = None,
25 upstream_resolvers: Optional[Dict[str, Any]] = None,
26 **kwargs: Any,
27 ) -> None:
28 """
29 Args:
30 cache (Dict[str, Any]): cache describes the caching configuration that applies to all server
31 blocks listed in the Corefile. This field allows a cluster admin
32 to optionally configure: * positiveTTL which is a duration for
33 which positive responses should be cached. * negativeTTL which is
34 a duration for which negative responses should be cached. If this
35 is not configured, OpenShift will configure positive and negative
36 caching with a default value that is subject to change. At the
37 time of writing, the default positiveTTL is 900 seconds and the
38 default negativeTTL is 30 seconds or as noted in the respective
39 Corefile for your version of OpenShift.
41 log_level (str): logLevel describes the desired logging verbosity for CoreDNS. Any one
42 of the following values may be specified: * Normal logs errors
43 from upstream resolvers. * Debug logs errors, NXDOMAIN responses,
44 and NODATA responses. * Trace logs errors and all responses.
45 Setting logLevel: Trace will produce extremely verbose logs. Valid
46 values are: "Normal", "Debug", "Trace". Defaults to "Normal".
48 management_state (str): managementState indicates whether the DNS operator should manage
49 cluster DNS
51 node_placement (Dict[str, Any]): nodePlacement provides explicit control over the scheduling of DNS
52 pods. Generally, it is useful to run a DNS pod on every node so
53 that DNS queries are always handled by a local DNS pod instead of
54 going over the network to a DNS pod on another node. However,
55 security policies may require restricting the placement of DNS
56 pods to specific nodes. For example, if a security policy
57 prohibits pods on arbitrary nodes from communicating with the API,
58 a node selector can be specified to restrict DNS pods to nodes
59 that are permitted to communicate with the API. Conversely, if
60 running DNS pods on nodes with a particular taint is desired, a
61 toleration can be specified for that taint. If unset, defaults
62 are used. See nodePlacement for more details.
64 operator_log_level (str): operatorLogLevel controls the logging level of the DNS Operator. Valid
65 values are: "Normal", "Debug", "Trace". Defaults to "Normal".
66 setting operatorLogLevel: Trace will produce extremely verbose
67 logs.
69 servers (List[Any]): servers is a list of DNS resolvers that provide name query delegation
70 for one or more subdomains outside the scope of the cluster
71 domain. If servers consists of more than one Server, longest
72 suffix match will be used to determine the Server. For example,
73 if there are two Servers, one for "foo.com" and another for
74 "a.foo.com", and the name query is for "www.a.foo.com", it will be
75 routed to the Server with Zone "a.foo.com". If this field is
76 nil, no servers are created.
78 upstream_resolvers (Dict[str, Any]): upstreamResolvers defines a schema for configuring CoreDNS to proxy
79 DNS messages to upstream resolvers for the case of the default
80 (".") server If this field is not specified, the upstream used
81 will default to /etc/resolv.conf, with policy "sequential"
83 """
84 super().__init__(**kwargs)
86 self.cache = cache
87 self.log_level = log_level
88 self.management_state = management_state
89 self.node_placement = node_placement
90 self.operator_log_level = operator_log_level
91 self.servers = servers
92 self.upstream_resolvers = upstream_resolvers
94 def to_dict(self) -> None:
95 super().to_dict()
97 if not self.kind_dict and not self.yaml_file:
98 self.res["spec"] = {}
99 _spec = self.res["spec"]
101 if self.cache:
102 _spec["cache"] = self.cache
104 if self.log_level:
105 _spec["logLevel"] = self.log_level
107 if self.management_state:
108 _spec["managementState"] = self.management_state
110 if self.node_placement:
111 _spec["nodePlacement"] = self.node_placement
113 if self.operator_log_level:
114 _spec["operatorLogLevel"] = self.operator_log_level
116 if self.servers:
117 _spec["servers"] = self.servers
119 if self.upstream_resolvers:
120 _spec["upstreamResolvers"] = self.upstream_resolvers
122 # End of generated code