Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Address feedbacks from comments/reviews
1. Improve errors handling 2. Flattering some nested conditional loops 3. Refactoring supported types 4. Handle plain type validation Signed-off-by: Vu Dinh <vdinh@redhat.com>
- Loading branch information
1 parent
1f920b9
commit 8e47858
Showing
5 changed files
with
103 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -449,6 +449,7 @@ bin | |
|
||
# Ignore sqlite | ||
*.db | ||
*.db-journal | ||
|
||
# Ignore vscode | ||
.vscode | ||
|
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,41 @@ | ||
package bundle | ||
|
||
const ( | ||
CSVKind = "ClusterServiceVersion" | ||
CRDKind = "CustomResourceDefinition" | ||
SecretKind = "Secret" | ||
ClusterRoleKind = "ClusterRole" | ||
ClusterRoleBindingKind = "ClusterRoleBinding" | ||
ServiceAccountKind = "ServiceAccount" | ||
ServiceKind = "Service" | ||
RoleKind = "Role" | ||
RoleBindingKind = "RoleBinding" | ||
PrometheusRuleKind = "PrometheusRule" | ||
ServiceMonitorKind = "ServiceMonitor" | ||
) | ||
|
||
var supportedResources map[string]bool | ||
|
||
// Add a list of supported resources to the map | ||
// Key: Kind name | ||
// Value: If namaspaced kind, true. Otherwise, false | ||
func init() { | ||
supportedResources = make(map[string]bool, 11) | ||
|
||
supportedResources[CSVKind] = true | ||
supportedResources[CRDKind] = false | ||
supportedResources[ClusterRoleKind] = false | ||
supportedResources[ClusterRoleBindingKind] = false | ||
supportedResources[ServiceKind] = true | ||
supportedResources[ServiceAccountKind] = true | ||
supportedResources[RoleKind] = true | ||
supportedResources[RoleBindingKind] = true | ||
supportedResources[PrometheusRuleKind] = true | ||
supportedResources[ServiceMonitorKind] = true | ||
} | ||
|
||
// IsSupported checks if the object kind is OLM-supported and if it is namespaced | ||
func IsSupported(kind string) (bool, bool) { | ||
namespaced, ok := supportedResources[kind] | ||
return ok, namespaced | ||
} |
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