Skip to content

Remove nil attributes for CiliumNetworkPolicy

What does this MR do?

Remove nil attributes for CiliumNetworkPolicy: Nil attributes whether ingress or egress will fail API for update.

This will be required when CiliumNetworkPolicy creation makes into the UI.

Related issue: #223623 (closed)

API error:

Kubernetes error: HTTP status code 422, CiliumNetworkPolicy.cilium.io "test-cilium-np" is invalid: []: Invalid value: map[string]interface {}{"apiVersion":"cilium.io/v2", "kind":"CiliumNetworkPolicy", "metadata":map[string]interface {}{"creationTimestamp":"2020-08-31T18:10:12Z", "generation":2, "name":"test-cilium-np", "namespace":"waf-enablement-demo-19-production", "resourceVersion":"408524", "uid":"2ac82c57-caf7-4aa9-9ed7-fa8b1dd38c1c"}, "spec":map[string]interface {}{"egress":interface {}(nil), "endpointSelector":map[string]interface {}{"matchLabels":map[string]interface {}{"network-policy.gitlab.com/disabled_by":"gitlab"}}, "ingress":[]interface {}{map[string]interface {}{"fromEndpoints":[]interface {}{map[string]interface {}{"matchLabels":map[string]interface {}{"app.gitlab.com/managed_by":"gitlab"}}}}}}}: validation failure list: spec.egress in body must be of type array: "null" for PUT https://localhost:8443/apis/cilium.io/v2/namespaces/waf-enablement-demo-19-production/ciliumnetworkpolicies/test-cilium-np

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Zamir Martins

Merge request reports