|
| 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 |
0 commit comments