vpc_endpoints_cluster_role.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. from kubernetes.client import V1ClusterRole, V1ObjectMeta, V1PolicyRule
  10. from materialize.cloudtest import DEFAULT_K8S_NAMESPACE
  11. from materialize.cloudtest.k8s.api.k8s_cluster_role import K8sClusterRole
  12. class VpcEndpointsClusterRole(K8sClusterRole):
  13. def __init__(self, namespace: str = DEFAULT_K8S_NAMESPACE) -> None:
  14. super().__init__(namespace)
  15. metadata = V1ObjectMeta(
  16. name="vpcendpoints",
  17. labels={"rbac.authorization.k8s.io/aggregate-to-admin": "true"},
  18. )
  19. self.role = V1ClusterRole(
  20. api_version="rbac.authorization.k8s.io/v1",
  21. kind="ClusterRole",
  22. metadata=metadata,
  23. rules=[
  24. V1PolicyRule(
  25. api_groups=["materialize.cloud"],
  26. resources=["vpcendpoints"],
  27. verbs=[
  28. "get",
  29. "list",
  30. "watch",
  31. "create",
  32. "update",
  33. "patch",
  34. "delete",
  35. ],
  36. ),
  37. ],
  38. )