1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 07:57:07 +00:00
kyverno/cmd/cli/kubectl-kyverno/deprecations/check.go

53 lines
1.5 KiB
Go
Raw Normal View History

package deprecations
import (
"fmt"
"io"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/apis/v1alpha1"
)
func CheckUserInfo(out io.Writer, path string, resource *v1alpha1.UserInfo) bool {
if resource != nil {
if resource.APIVersion == "" || resource.Kind == "" {
if out != nil {
fmt.Fprintf(out, "\nWARNING: user infos file (%s) uses a deprecated schema that will be removed in 1.13\n", path)
}
return true
}
}
return false
}
func CheckValues(out io.Writer, path string, resource *v1alpha1.Values) bool {
if resource != nil {
if resource.APIVersion == "" || resource.Kind == "" {
if out != nil {
fmt.Fprintf(out, "\nWARNING: values file (%s) uses a deprecated schema that will be removed in 1.13\n", path)
}
return true
}
}
return false
}
func CheckTest(out io.Writer, path string, resource *v1alpha1.Test) bool {
if resource != nil {
if resource.APIVersion == "" || resource.Kind == "" || resource.Name != "" {
if out != nil {
fmt.Fprintf(out, "\nWARNING: test file (%s) uses a deprecated schema that will be removed in 1.13\n", path)
}
return true
}
for _, result := range resource.Results {
if result.TestResultDeprecated.Status != "" || result.TestResultDeprecated.Namespace != "" || result.TestResultDeprecated.Resource != "" {
if out != nil {
fmt.Fprintf(out, "\nWARNING: test file (%s) uses a deprecated schema that will be removed in 1.13\n", path)
}
return true
}
}
}
return false
}