Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
remove IsSupportedResourceType, by using the dynamic client all types…
Browse files Browse the repository at this point in the history
… can be supported
  • Loading branch information
jerr committed May 30, 2022
1 parent d792db5 commit 1b4f526
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 21 deletions.
6 changes: 0 additions & 6 deletions internal/k8sinternal/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ func TestEncodeDecode(t *testing.T) {

func TestGetContainers(t *testing.T) {
for _, resource := range getAllResources(t) {
if !k8s.IsSupportedResourceType(resource) {
continue
}
containers := k8s.GetContainers(resource)
switch resource.(type) {
case *k8s.NamespaceV1:
Expand Down Expand Up @@ -96,9 +93,6 @@ func TestGetObjectMeta(t *testing.T) {

func TestGetPodTemplateSpec(t *testing.T) {
for _, resource := range getAllResources(t) {
if !k8s.IsSupportedResourceType(resource) {
continue
}
podTemplateSpec := k8s.GetPodTemplateSpec(resource)
switch resource.(type) {
case *k8s.PodV1, *k8s.NamespaceV1:
Expand Down
5 changes: 0 additions & 5 deletions pkg/k8s/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,3 @@ type TypeMetaV1 = metav1.TypeMeta

// UnsupportedType is a type alias for v1 version of the k8s apps API, this is meant for testing
type UnsupportedType = apiv1.Binding

// IsSupportedResourceType returns true if obj is a supported Kubernetes resource type
func IsSupportedResourceType(obj Resource) bool {
return true
}
10 changes: 0 additions & 10 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ func auditResource(resource KubeResource, resources []KubeResource, auditables [
return result, nil
}

if !k8s.IsSupportedResourceType(resource.Object()) {
auditResult := &AuditResult{
Name: ErrorUnsupportedResource,
Severity: Warn,
Message: "Resource is not currently supported.",
}
result.AuditResults = append(result.AuditResults, auditResult)
return result, nil
}

for _, auditable := range auditables {
auditResults, err := auditable.Audit(resource.Object(), unwrapResources(resources))
if err != nil {
Expand Down

0 comments on commit 1b4f526

Please sign in to comment.