1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

performed cleanups (#1552)

This commit is contained in:
Yashvardhan Kukreja 2021-02-08 10:49:25 +05:30 committed by GitHub
parent 2f2d6c2e38
commit d141f74015
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 11 deletions

View file

@ -245,10 +245,6 @@ func applyPoliciesFromPath(fs billy.Filesystem, policyBytes []byte, valuesFile s
fmt.Printf("Error: failed to load resources\nCause: %s\n", err) fmt.Printf("Error: failed to load resources\nCause: %s\n", err)
os.Exit(1) os.Exit(1)
} }
if err != nil {
fmt.Printf("Error: failed to load resources\nCause: %s\n", err)
os.Exit(1)
}
msgPolicies := "1 policy" msgPolicies := "1 policy"
if len(mutatedPolicies) > 1 { if len(mutatedPolicies) > 1 {
msgPolicies = fmt.Sprintf("%d policies", len(policies)) msgPolicies = fmt.Sprintf("%d policies", len(policies))

View file

@ -92,7 +92,7 @@ func generateDebugMutatingWebhook(name, url string, caData []byte, validate bool
}, },
SideEffects: &sideEffect, SideEffects: &sideEffect,
Rules: []admregapi.RuleWithOperations{ Rules: []admregapi.RuleWithOperations{
admregapi.RuleWithOperations{ {
Operations: operationTypes, Operations: operationTypes,
Rule: admregapi.Rule{ Rule: admregapi.Rule{
APIGroups: []string{ APIGroups: []string{
@ -122,7 +122,7 @@ func generateDebugValidatingWebhook(name, url string, caData []byte, validate bo
}, },
SideEffects: &sideEffect, SideEffects: &sideEffect,
Rules: []admregapi.RuleWithOperations{ Rules: []admregapi.RuleWithOperations{
admregapi.RuleWithOperations{ {
Operations: operationTypes, Operations: operationTypes,
Rule: admregapi.Rule{ Rule: admregapi.Rule{
APIGroups: []string{ APIGroups: []string{
@ -195,7 +195,7 @@ func generateValidatingWebhook(name, servicePath string, caData []byte, validati
}, },
SideEffects: &sideEffect, SideEffects: &sideEffect,
Rules: []admregapi.RuleWithOperations{ Rules: []admregapi.RuleWithOperations{
admregapi.RuleWithOperations{ {
Operations: operationTypes, Operations: operationTypes,
Rule: admregapi.Rule{ Rule: admregapi.Rule{
APIGroups: []string{ APIGroups: []string{

View file

@ -217,7 +217,7 @@ func stripNonPolicyFields(obj, newRes map[string]interface{}, logger logr.Logger
keyInData := make([]string, 0) keyInData := make([]string, 0)
switch dataMap.(type) { switch dataMap.(type) {
case map[string]interface{}: case map[string]interface{}:
for k, _ := range dataMap.(map[string]interface{}) { for k := range dataMap.(map[string]interface{}) {
keyInData = append(keyInData, k) keyInData = append(keyInData, k)
} }
} }

View file

@ -16,7 +16,7 @@ func Test_updateFeildsInSourceAndUpdatedResource(t *testing.T) {
} }
testcases := []TestCase{ testcases := []TestCase{
TestCase{ {
obj: map[string]interface{}{ obj: map[string]interface{}{
"apiVersion": "v1", "apiVersion": "v1",
"data": map[string]interface{}{ "data": map[string]interface{}{
@ -75,7 +75,7 @@ func Test_updateFeildsInSourceAndUpdatedResource(t *testing.T) {
"metadata": map[string]interface{}{}, "metadata": map[string]interface{}{},
}, },
}, },
TestCase{ {
obj: map[string]interface{}{ obj: map[string]interface{}{
"apiVersion": "v1", "apiVersion": "v1",
"data": map[string]interface{}{ "data": map[string]interface{}{
@ -150,7 +150,7 @@ func Test_updateFeildsInSourceAndUpdatedResource(t *testing.T) {
}, },
}, },
}, },
TestCase{ {
obj: map[string]interface{}{ obj: map[string]interface{}{
"apiVersion": "v1", "apiVersion": "v1",
"kind": "Pod", "kind": "Pod",