-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: ownerReference cross ns deprecation on v1.20
- Loading branch information
1 parent
d01dc6c
commit dcdf93b
Showing
8 changed files
with
78 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
import kopf | ||
|
||
from k8spin_common.resources import organization | ||
from pykube.exceptions import ObjectDoesNotExist | ||
|
||
|
||
@kopf.on.create("k8spin.cloud", "v1", "organizations") | ||
@kopf.on.update("k8spin.cloud", "v1", "organizations") | ||
def create_organization(name, **kwargs): # pylint: disable=W0613 | ||
organization.ensure_organization_resources(organization_name=name) | ||
|
||
|
||
@kopf.on.delete("k8spin.cloud", "v1", "organizations") | ||
def delete_organization(name, **kwargs): # pylint: disable=W0613 | ||
try: | ||
org = organization.get_organization(name) # pylint: disable=E1120 | ||
tenants = org.tenants | ||
for tenant in tenants: | ||
spaces = tenant.spaces | ||
for space in spaces: | ||
space_namespace = space.space_namespace | ||
space_namespace.delete() | ||
tenant_namespace = tenant.tenant_namespace | ||
tenant_namespace.delete() | ||
organization_namespace = org.organization_namespace | ||
organization_namespace.delete() | ||
except ObjectDoesNotExist: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters