Giter Club home page Giter Club logo

fury-kubernetes-opa's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fury-kubernetes-opa's Issues

Add in pipeline step a conftest to check the requirements for DELETE events

Hello!
since we have introduced the protect namespace rule that now forces each DELETE event through the gatekeeper, now became mandatory to exclude them from the other check in order to avoid misbehavior.
To do that, each violation block must have the following 3 lines :

operation := input.review.operation
any([ operation == "CREATE", operation == "UPDATE" ])
operation != "DELETE"

For this reason, should be a very smart usage of conftest, to add a pipeline step that enforces the presence of those lines.
Probably some rules need to be refactored in order to make the conftest rules easier,anyway, let's see them together!

Impossibile to use gpm module in environments with constrained Internet access

I am not able to deploy the gpm module in an environment with constrained Internet access since we're pulling the Kustomize base directly from GitHub.

I know that it will lead to some duplications, but can we consider to just add the manifests to this repository as well instead of pulling the base from GitHub?

Thank you.

Refactor folder structure

Currently the module folder structure has only 1 package gatekeeper with 3 subpackages, it would be better to have 3 different packages instead. Dropping one nesting level.

Add audit check to E2E tests

We should have test cases that check that when there are violations of a rule in the cluster the audit phase detects them properly.

See #59 and #47 , when the audit pod was healthy but the audit didn't show violations that existed in the cluster.

Rename Module from OPA to Policy

The name for this core module is not correct.

The features that this module provides are policy definition and enforcement. OPA is just an implementation detail, and it is not used directly (Gatekeeper uses it under the hood)

A better name for the module would be Policy -> kubernetes-fury-policy

extensions/v1beta1 for Ingress has been deprecated in K8s 1.22

We still have some references to extensions/v1beta1 and networking.k8s.io/v1beta1 for Ingress that have been deprecated in Kubernetes 1.22.

For example:

- group: "extensions"
version: "v1beta1"
kind: "Ingress"
- group: "networking.k8s.io"
version: "v1beta1"
kind: "Ingress"

This makes errors appear in the logs.

Delete all the references to v1beta1 and use v1 instead.

Can't run opa module on a private GKE Cluster

With @ralgozino we found out that we can't run opa module on a private GKE Cluster (e.g. the one created by the furyctl provisoner).

"By default, firewall rules restrict the cluster master communication to nodes only on ports 443 (HTTPS) and 10250 (kubelet). Although Gatekeeper exposes its service on port 443, GKE by default enables --enable-aggregator-routing option, which makes the master to bypass the service and communicate straight to the POD on port 8443."

From: https://open-policy-agent.github.io/gatekeeper/website/docs/vendor-specific/#running-on-private-gke-cluster-nodes

This results in the following timeout:

$kubectl create ns fury

Error from server (InternalError): Internal error occurred: failed calling webhook "check-ignore-label.gatekeeper.sh": Post https://gatekeeper-webhook-service.gatekeeper-system.svc:443/v1/admitlabel?timeout=3s: dial tcp 10.2.0.3:8443: i/o timeout

Solutions (again from the Gatekeeper documentation):

  • create a new firewall rule from master to private nodes to open port 8443 (or any other custom port)
  • make the pod run on privileged port 443 (need to run the pod as root)

Provided ConstraintTemplates don't get trigger violations when audit runs

Since we added the check for the review.operation to the provided ConstraintTemplates, like this:

not input.parameters.excludeIstio
operation := input.review.operation
any([ operation == "CREATE", operation == "UPDATE" ])
operation != "DELETE"

the audit process doesn't trigger a violation for the constraints created from the template, because the operation is not set when the audit process runs.

Related: open-policy-agent/gatekeeper#333

IMPORTANT: the Admission is not affected, this is only an audit issue. For example, pods that didn't comply with a policy get properly rejected because the review.operation is set.

Review default rules package

The default rules package hasn't been updated in a while.

Check that we didn't miss any updates from upstream and that are all still relevant.

gatekeeper-audit gets OOMKilled

Memory usage of gatekeeper-audit depends on how much resources and constraints there are in the cluster. So if #resources to check increase, memory usage also increase which then leads to OOMKilled.

Recently we had this issue on a cluster and configuring "--audit-chunk-size" parameter resolved the issue. I think we can add this parameter as default to proactively avoid this issue on clusters with potentially growing number of resources.

You can see here a discussion about this problem and the suggestion of the parameter:

open-policy-agent/gatekeeper#1279

Grafana Dashboard: outdated metrics

The Grafana dashboard for Gatekeeper is using metrics that have been changed in the latest versions of Gatekeeper, in particular:

gatekeeper_request_duration_seconds_bucket has been renamed to gatekeeper_validation_request_duration_seconds_bucket and same other metrics for the mutating operations have been added, like gatekeeper_mutator_ingestion_count

the same for the gatekeeper_request_count metric.

The official metrics list is here: https://open-policy-agent.github.io/gatekeeper/website/docs/metrics

Conflict with PodSecurityPolicy

If in the cluster is present PodSecurityPolicy it is necessary to remove the following annotation from Deployment manifest.

template:
metadata:
annotations:
container.seccomp.security.alpha.kubernetes.io/manager: runtime/default

Trying to install this module with PodSecurityPolicy running leaad to this error message in status section of ReplicaSet:

Warning  FailedCreate  11s (x19 over 22m)  replicaset-controller  Error creating: pods "gatekeeper-controller-manager-686c494bcd-" is forbidden: unable to validate against any pod security policy: [pod.metadata.annotations[container.seccomp.security.alpha.kubernetes.io/manager]: Forbidden: seccomp may not be set]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.