Skip to content

Commit 0e1f8f8

Browse files
authored
feat: Add Config resources (#2486)
1 parent 148ac09 commit 0e1f8f8

File tree

4 files changed

+392
-0
lines changed

4 files changed

+392
-0
lines changed
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md
2+
3+
4+
from typing import Any
5+
from ocp_resources.resource import Resource, MissingRequiredArgumentError
6+
7+
8+
class Config(Resource):
9+
"""
10+
Config is the configuration object for a registry instance managed by
11+
the registry operator
12+
13+
Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
14+
"""
15+
16+
api_group: str = Resource.ApiGroup.IMAGEREGISTRY_OPERATOR_OPENSHIFT_IO
17+
18+
def __init__(
19+
self,
20+
affinity: dict[str, Any] | None = None,
21+
default_route: bool | None = None,
22+
disable_redirect: bool | None = None,
23+
http_secret: str | None = None,
24+
log_level: str | None = None,
25+
logging: int | None = None,
26+
management_state: str | None = None,
27+
node_selector: dict[str, Any] | None = None,
28+
observed_config: dict[str, Any] | None = None,
29+
operator_log_level: str | None = None,
30+
proxy: dict[str, Any] | None = None,
31+
read_only: bool | None = None,
32+
replicas: int | None = None,
33+
requests: dict[str, Any] | None = None,
34+
resources: dict[str, Any] | None = None,
35+
rollout_strategy: str | None = None,
36+
routes: list[Any] | None = None,
37+
storage: dict[str, Any] | None = None,
38+
tolerations: list[Any] | None = None,
39+
topology_spread_constraints: list[Any] | None = None,
40+
unsupported_config_overrides: dict[str, Any] | None = None,
41+
**kwargs: Any,
42+
) -> None:
43+
r"""
44+
Args:
45+
affinity (dict[str, Any]): affinity is a group of node affinity scheduling rules for the image
46+
registry pod(s).
47+
48+
default_route (bool): defaultRoute indicates whether an external facing route for the
49+
registry should be created using the default generated hostname.
50+
51+
disable_redirect (bool): disableRedirect controls whether to route all data through the
52+
Registry, rather than redirecting to the backend.
53+
54+
http_secret (str): httpSecret is the value needed by the registry to secure uploads,
55+
generated by default.
56+
57+
log_level (str): logLevel is an intent based logging for an overall component. It does
58+
not give fine grained control, but it is a simple way to manage
59+
coarse grained logging choices that operators have to interpret
60+
for their operands. Valid values are: "Normal", "Debug", "Trace",
61+
"TraceAll". Defaults to "Normal".
62+
63+
logging (int): logging is deprecated, use logLevel instead.
64+
65+
management_state (str): managementState indicates whether and how the operator should manage
66+
the component
67+
68+
node_selector (dict[str, Any]): nodeSelector defines the node selection constraints for the registry
69+
pod.
70+
71+
observed_config (dict[str, Any]): observedConfig holds a sparse config that controller has observed from
72+
the cluster state. It exists in spec because it is an input to
73+
the level for the operator
74+
75+
operator_log_level (str): operatorLogLevel is an intent based logging for the operator itself.
76+
It does not give fine grained control, but it is a simple way to
77+
manage coarse grained logging choices that operators have to
78+
interpret for themselves. Valid values are: "Normal", "Debug",
79+
"Trace", "TraceAll". Defaults to "Normal".
80+
81+
proxy (dict[str, Any]): proxy defines the proxy to be used when calling master api, upstream
82+
registries, etc.
83+
84+
read_only (bool): readOnly indicates whether the registry instance should reject
85+
attempts to push new images or delete existing ones.
86+
87+
replicas (int): replicas determines the number of registry instances to run.
88+
89+
requests (dict[str, Any]): requests controls how many parallel requests a given registry instance
90+
will handle before queuing additional requests.
91+
92+
resources (dict[str, Any]): resources defines the resource requests+limits for the registry pod.
93+
94+
rollout_strategy (str): rolloutStrategy defines rollout strategy for the image registry
95+
deployment.
96+
97+
routes (list[Any]): routes defines additional external facing routes which should be
98+
created for the registry.
99+
100+
storage (dict[str, Any]): storage details for configuring registry storage, e.g. S3 bucket
101+
coordinates.
102+
103+
tolerations (list[Any]): tolerations defines the tolerations for the registry pod.
104+
105+
topology_spread_constraints (list[Any]): topologySpreadConstraints specify how to spread matching pods among
106+
the given topology.
107+
108+
unsupported_config_overrides (dict[str, Any]): unsupportedConfigOverrides overrides the final configuration that was
109+
computed by the operator. Red Hat does not support the use of this
110+
field. Misuse of this field could lead to unexpected behavior or
111+
conflict with other configuration options. Seek guidance from the
112+
Red Hat support before using this field. Use of this property
113+
blocks cluster upgrades, it must be removed before upgrading your
114+
cluster.
115+
116+
"""
117+
super().__init__(**kwargs)
118+
119+
self.affinity = affinity
120+
self.default_route = default_route
121+
self.disable_redirect = disable_redirect
122+
self.http_secret = http_secret
123+
self.log_level = log_level
124+
self.logging = logging
125+
self.management_state = management_state
126+
self.node_selector = node_selector
127+
self.observed_config = observed_config
128+
self.operator_log_level = operator_log_level
129+
self.proxy = proxy
130+
self.read_only = read_only
131+
self.replicas = replicas
132+
self.requests = requests
133+
self.resources = resources
134+
self.rollout_strategy = rollout_strategy
135+
self.routes = routes
136+
self.storage = storage
137+
self.tolerations = tolerations
138+
self.topology_spread_constraints = topology_spread_constraints
139+
self.unsupported_config_overrides = unsupported_config_overrides
140+
141+
def to_dict(self) -> None:
142+
super().to_dict()
143+
144+
if not self.kind_dict and not self.yaml_file:
145+
if self.replicas is None:
146+
raise MissingRequiredArgumentError(argument="self.replicas")
147+
148+
self.res["spec"] = {}
149+
_spec = self.res["spec"]
150+
151+
_spec["replicas"] = self.replicas
152+
153+
if self.affinity is not None:
154+
_spec["affinity"] = self.affinity
155+
156+
if self.default_route is not None:
157+
_spec["defaultRoute"] = self.default_route
158+
159+
if self.disable_redirect is not None:
160+
_spec["disableRedirect"] = self.disable_redirect
161+
162+
if self.http_secret is not None:
163+
_spec["httpSecret"] = self.http_secret
164+
165+
if self.log_level is not None:
166+
_spec["logLevel"] = self.log_level
167+
168+
if self.logging is not None:
169+
_spec["logging"] = self.logging
170+
171+
if self.management_state is not None:
172+
_spec["managementState"] = self.management_state
173+
174+
if self.node_selector is not None:
175+
_spec["nodeSelector"] = self.node_selector
176+
177+
if self.observed_config is not None:
178+
_spec["observedConfig"] = self.observed_config
179+
180+
if self.operator_log_level is not None:
181+
_spec["operatorLogLevel"] = self.operator_log_level
182+
183+
if self.proxy is not None:
184+
_spec["proxy"] = self.proxy
185+
186+
if self.read_only is not None:
187+
_spec["readOnly"] = self.read_only
188+
189+
if self.requests is not None:
190+
_spec["requests"] = self.requests
191+
192+
if self.resources is not None:
193+
_spec["resources"] = self.resources
194+
195+
if self.rollout_strategy is not None:
196+
_spec["rolloutStrategy"] = self.rollout_strategy
197+
198+
if self.routes is not None:
199+
_spec["routes"] = self.routes
200+
201+
if self.storage is not None:
202+
_spec["storage"] = self.storage
203+
204+
if self.tolerations is not None:
205+
_spec["tolerations"] = self.tolerations
206+
207+
if self.topology_spread_constraints is not None:
208+
_spec["topologySpreadConstraints"] = self.topology_spread_constraints
209+
210+
if self.unsupported_config_overrides is not None:
211+
_spec["unsupportedConfigOverrides"] = self.unsupported_config_overrides
212+
213+
# End of generated code
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md
2+
3+
4+
from typing import Any
5+
from ocp_resources.resource import Resource
6+
7+
8+
class Config(Resource):
9+
"""
10+
Config specifies the behavior of the config operator which is responsible for creating the initial configuration of other components
11+
on the cluster. The operator also handles installation, migration or synchronization of cloud configurations for AWS and Azure cloud based clusters
12+
13+
Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
14+
"""
15+
16+
api_group: str = Resource.ApiGroup.OPERATOR_OPENSHIFT_IO
17+
18+
def __init__(
19+
self,
20+
log_level: str | None = None,
21+
management_state: str | None = None,
22+
observed_config: dict[str, Any] | None = None,
23+
operator_log_level: str | None = None,
24+
unsupported_config_overrides: dict[str, Any] | None = None,
25+
**kwargs: Any,
26+
) -> None:
27+
r"""
28+
Args:
29+
log_level (str): logLevel is an intent based logging for an overall component. It does
30+
not give fine grained control, but it is a simple way to manage
31+
coarse grained logging choices that operators have to interpret
32+
for their operands. Valid values are: "Normal", "Debug", "Trace",
33+
"TraceAll". Defaults to "Normal".
34+
35+
management_state (str): managementState indicates whether and how the operator should manage
36+
the component
37+
38+
observed_config (dict[str, Any]): observedConfig holds a sparse config that controller has observed from
39+
the cluster state. It exists in spec because it is an input to
40+
the level for the operator
41+
42+
operator_log_level (str): operatorLogLevel is an intent based logging for the operator itself.
43+
It does not give fine grained control, but it is a simple way to
44+
manage coarse grained logging choices that operators have to
45+
interpret for themselves. Valid values are: "Normal", "Debug",
46+
"Trace", "TraceAll". Defaults to "Normal".
47+
48+
unsupported_config_overrides (dict[str, Any]): unsupportedConfigOverrides overrides the final configuration that was
49+
computed by the operator. Red Hat does not support the use of this
50+
field. Misuse of this field could lead to unexpected behavior or
51+
conflict with other configuration options. Seek guidance from the
52+
Red Hat support before using this field. Use of this property
53+
blocks cluster upgrades, it must be removed before upgrading your
54+
cluster.
55+
56+
"""
57+
super().__init__(**kwargs)
58+
59+
self.log_level = log_level
60+
self.management_state = management_state
61+
self.observed_config = observed_config
62+
self.operator_log_level = operator_log_level
63+
self.unsupported_config_overrides = unsupported_config_overrides
64+
65+
def to_dict(self) -> None:
66+
super().to_dict()
67+
68+
if not self.kind_dict and not self.yaml_file:
69+
self.res["spec"] = {}
70+
_spec = self.res["spec"]
71+
72+
if self.log_level is not None:
73+
_spec["logLevel"] = self.log_level
74+
75+
if self.management_state is not None:
76+
_spec["managementState"] = self.management_state
77+
78+
if self.observed_config is not None:
79+
_spec["observedConfig"] = self.observed_config
80+
81+
if self.operator_log_level is not None:
82+
_spec["operatorLogLevel"] = self.operator_log_level
83+
84+
if self.unsupported_config_overrides is not None:
85+
_spec["unsupportedConfigOverrides"] = self.unsupported_config_overrides
86+
87+
# End of generated code
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md
2+
3+
4+
from typing import Any
5+
from ocp_resources.resource import Resource
6+
7+
8+
class Config(Resource):
9+
"""
10+
Config contains the configuration and detailed condition status for the Samples Operator.
11+
Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
12+
"""
13+
14+
api_group: str = Resource.ApiGroup.SAMPLES_OPERATOR_OPENSHIFT_IO
15+
16+
def __init__(
17+
self,
18+
architectures: list[Any] | None = None,
19+
management_state: str | None = None,
20+
samples_registry: str | None = None,
21+
skipped_imagestreams: list[Any] | None = None,
22+
skipped_templates: list[Any] | None = None,
23+
**kwargs: Any,
24+
) -> None:
25+
r"""
26+
Args:
27+
architectures (list[Any]): architectures determine which hardware architecture(s) to install,
28+
where x86_64, ppc64le, and s390x are the only supported choices
29+
currently.
30+
31+
management_state (str): managementState is top level on/off type of switch for all operators.
32+
When "Managed", this operator processes config and manipulates the
33+
samples accordingly. When "Unmanaged", this operator ignores any
34+
updates to the resources it watches. When "Removed", it reacts
35+
that same wasy as it does if the Config object is deleted, meaning
36+
any ImageStreams or Templates it manages (i.e. it honors the
37+
skipped lists) and the registry secret are deleted, along with the
38+
ConfigMap in the operator's namespace that represents the last
39+
config used to manipulate the samples,
40+
41+
samples_registry (str): samplesRegistry allows for the specification of which registry is
42+
accessed by the ImageStreams for their image content. Defaults on
43+
the content in https://github.com/openshift/library that are
44+
pulled into this github repository, but based on our pulling only
45+
ocp content it typically defaults to registry.redhat.io.
46+
47+
skipped_imagestreams (list[Any]): skippedImagestreams specifies names of image streams that should NOT
48+
be created/updated. Admins can use this to allow them to delete
49+
content they don’t want. They will still have to manually delete
50+
the content but the operator will not recreate(or update) anything
51+
listed here.
52+
53+
skipped_templates (list[Any]): skippedTemplates specifies names of templates that should NOT be
54+
created/updated. Admins can use this to allow them to delete
55+
content they don’t want. They will still have to manually delete
56+
the content but the operator will not recreate(or update) anything
57+
listed here.
58+
59+
"""
60+
super().__init__(**kwargs)
61+
62+
self.architectures = architectures
63+
self.management_state = management_state
64+
self.samples_registry = samples_registry
65+
self.skipped_imagestreams = skipped_imagestreams
66+
self.skipped_templates = skipped_templates
67+
68+
def to_dict(self) -> None:
69+
super().to_dict()
70+
71+
if not self.kind_dict and not self.yaml_file:
72+
self.res["spec"] = {}
73+
_spec = self.res["spec"]
74+
75+
if self.architectures is not None:
76+
_spec["architectures"] = self.architectures
77+
78+
if self.management_state is not None:
79+
_spec["managementState"] = self.management_state
80+
81+
if self.samples_registry is not None:
82+
_spec["samplesRegistry"] = self.samples_registry
83+
84+
if self.skipped_imagestreams is not None:
85+
_spec["skippedImagestreams"] = self.skipped_imagestreams
86+
87+
if self.skipped_templates is not None:
88+
_spec["skippedTemplates"] = self.skipped_templates
89+
90+
# End of generated code

0 commit comments

Comments
 (0)