Coder Social home page Coder Social logo

iam-policy-controller's Introduction

IAM Policy Controller

Build KinD tests License

Description

The IAM policy controller is a controller that watches IamPolicies created to monitor IAM cluster role bindings used within a Kubernetes cluster. It detects the number of users with cluster role bindings to a given clusterrole and reports whether or not a given IamPolicy is compliant or noncompliant.The controller can be run as a stand-alone program or as an integrated part of governing risk with the Open Cluster Management project.

Field Description
maxClusterRoleBindingUsers Required: Maximum number of cluster role binding still valid before it is considered as non-compliant.
ClusterRole Optional: Cluster role referenced in the cluster role bindings, default to cluster-admin.

Following is an example spec of a IamPolicy resource:

apiVersion: policy.open-cluster-management.io/v1
kind: IamPolicy
metadata:
  name: iam-grc-policy
  labels:
    category: "System-Integrity"
spec:
  # Include are the namespaces for which you want to watch cluster administrator role and IAM rolebinings, while exclude are the namespaces you explicitly do not want to watch
  namespaceSelector:
    include: ["default","kube-*"]
    exclude: ["kube-system"]
  #labelSelector:
    #env: "production"
  # Can be enforce or inform, however enforce doesn't do anything with regards to this controller
     remediationAction: inform # enforce or inform
     severity: medium # low, medium, or high
  # Maximum number of cluster role binding still valid before it is considered as non-compliant
  maxClusterRoleBindingUsers: 5

Go to the Contributing guide to learn how to get involved.

Getting started

Steps for development

  • Build code
    make build
  • Run controller locally against the Kubernetes cluster currently configured with kubectl
    export WATCH_NAMESPACE=<namespace>
    make run
    (WATCH_NAMESPACE can be any namespace on the cluster that you want the controller to monitor for policies.)

Steps for deployment

  • Build container image

    make build-images
    • The image registry, name, and tag used in the image build, are configurable with:
      export REGISTRY=''  # (defaults to 'quay.io/stolostron')
      export IMG=''       # (defaults to the repository name)
      export TAG=''       # (defaults to 'latest')
  • Deploy controller to a cluster

    The controller is deployed to a namespace defined in CONTROLLER_NAMESPACE and monitors the namepace defined in WATCH_NAMESPACE for IamPolicy resources.

    1. Create the deployment namespaces
      make create-ns
      The deployment namespaces are configurable with:
      export CONTROLLER_NAMESPACE=''  # (defaults to 'open-cluster-management-agent-addon')
      export WATCH_NAMESPACE=''       # (defaults to 'managed')
    2. Deploy the controller and related resources
      make deploy

    NOTE: Please be aware of the community's deployment images special note.

Steps for test

  • Code linting
    make lint
  • Unit tests
    • Install prerequisites
      make test-dependencies
    • Run unit tests
      make test
  • E2E tests (NOTE: Currently there are no E2E tests to run)
    1. Prerequisites:
    2. Start KinD cluster (make sure Docker is running first)
      make kind-bootstrap-cluster-dev
    3. Start the controller locally (see Steps for development)
    4. Run E2E tests:
      export WATCH_NAMESPACE=managed
      make e2e-test

References

iam-policy-controller's People

Contributors

ckandag avatar rranjann1 avatar dhaiducek avatar gparvin avatar pakn22 avatar mprahl avatar chunxialexluo avatar justinkuli avatar mikeshng avatar willkutler avatar

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.