()
| 61 | namespace_api.delete(name=name) |
| 62 | |
| 63 | def main(): |
| 64 | # Creating a dynamic client |
| 65 | client = dynamic.DynamicClient( |
| 66 | api_client.ApiClient(configuration=config.load_kube_config()) |
| 67 | ) |
| 68 | |
| 69 | # fetching the custom resource definition (CRD) api |
| 70 | crd_api = client.resources.get( |
| 71 | api_version="apiextensions.k8s.io/v1", kind="CustomResourceDefinition" |
| 72 | ) |
| 73 | |
| 74 | namespace_api = client.resources.get(api_version="v1", kind="Namespace") |
| 75 | |
| 76 | # Creating a Namespaced CRD named "ingressroutes.apps.example.com" |
| 77 | name = "ingressroutes.apps.example.com" |
| 78 | |
| 79 | crd_manifest = { |
| 80 | "apiVersion": "apiextensions.k8s.io/v1", |
| 81 | "kind": "CustomResourceDefinition", |
| 82 | "metadata": {"name": name, "namespace": "default"}, |
| 83 | "spec": { |
| 84 | "group": "apps.example.com", |
| 85 | "versions": [ |
| 86 | { |
| 87 | "name": "v1", |
| 88 | "schema": { |
| 89 | "openAPIV3Schema": { |
| 90 | "properties": { |
| 91 | "spec": { |
| 92 | "properties": { |
| 93 | "strategy": {"type": "string"}, |
| 94 | "virtualhost": { |
| 95 | "properties": { |
| 96 | "fqdn": {"type": "string"}, |
| 97 | "tls": { |
| 98 | "properties": { |
| 99 | "secretName": {"type": "string"} |
| 100 | }, |
| 101 | "type": "object", |
| 102 | }, |
| 103 | }, |
| 104 | "type": "object", |
| 105 | }, |
| 106 | }, |
| 107 | "type": "object", |
| 108 | } |
| 109 | }, |
| 110 | "type": "object", |
| 111 | } |
| 112 | }, |
| 113 | "served": True, |
| 114 | "storage": True, |
| 115 | } |
| 116 | ], |
| 117 | "scope": "Namespaced", |
| 118 | "names": { |
| 119 | "plural": "ingressroutes", |
| 120 | "listKind": "IngressRouteList", |
no test coverage detected