Coverage for ocp_resources/image_content_source_policy.py: 0%
14 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, List, Optional
4from ocp_resources.resource import Resource
7class ImageContentSourcePolicy(Resource):
8 """
9 ImageContentSourcePolicy holds cluster-wide information about how to handle registry mirror rules. When multiple policies are defined, the outcome of the behavior is defined on each field.
10 Compatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.
11 """
13 api_group: str = Resource.ApiGroup.OPERATOR_OPENSHIFT_IO
15 def __init__(
16 self,
17 repository_digest_mirrors: Optional[List[Any]] = None,
18 **kwargs: Any,
19 ) -> None:
20 """
21 Args:
22 repository_digest_mirrors (List[Any]): repositoryDigestMirrors allows images referenced by image digests in
23 pods to be pulled from alternative mirrored repository locations.
24 The image pull specification provided to the pod will be compared
25 to the source locations described in RepositoryDigestMirrors and
26 the image may be pulled down from any of the mirrors in the list
27 instead of the specified repository allowing administrators to
28 choose a potentially faster mirror. Only image pull specifications
29 that have an image digest will have this behavior applied to them
30 - tags will continue to be pulled from the specified repository in
31 the pull spec. Each “source” repository is treated
32 independently; configurations for different “source” repositories
33 don’t interact. When multiple policies are defined for the same
34 “source” repository, the sets of defined mirrors will be merged
35 together, preserving the relative order of the mirrors, if
36 possible. For example, if policy A has mirrors `a, b, c` and
37 policy B has mirrors `c, d, e`, the mirrors will be used in the
38 order `a, b, c, d, e`. If the orders of mirror entries conflict
39 (e.g. `a, b` vs. `b, a`) the configuration is not rejected but the
40 resulting order is unspecified.
42 """
43 super().__init__(**kwargs)
45 self.repository_digest_mirrors = repository_digest_mirrors
47 def to_dict(self) -> None:
48 super().to_dict()
50 if not self.kind_dict and not self.yaml_file:
51 self.res["spec"] = {}
52 _spec = self.res["spec"]
54 if self.repository_digest_mirrors:
55 _spec["repositoryDigestMirrors"] = self.repository_digest_mirrors
57 # End of generated code