-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve resource kind typing (#1251)
With these changes, `Kube.resourcePlural("Dummy")` is a type error, so the non-existing resource kind test should not be needed anymore.
- Loading branch information
1 parent
37ba9a2
commit eaf12bf
Showing
5 changed files
with
23 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// We explicitly define the plurals here, just in case a generic pluralizer | ||
// isn't sufficient. Note that CRDs can explicitly define pluralized forms, | ||
// which might not match with the Kind. If this becomes difficult to | ||
// maintain we can add a generic pluralizer and a way to override. | ||
export const ResourceKindsWithPlurals = { | ||
ClusterRole: "clusterroles", | ||
ConfigMap: "configmaps", | ||
DaemonSet: "daemonsets", | ||
Deployment: "deployments", | ||
Ingress: "ingresses", | ||
Secret: "secrets", | ||
Service: "services", | ||
StatefulSet: "statefulsets", | ||
} as const; | ||
|
||
export type ResourceKind = keyof typeof ResourceKindsWithPlurals; |
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