• Stars
    star
    208
  • Rank 189,015 (Top 4 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A collection of policy examples for Open Cluster Management

Policy Collection

A collection of policy examples for Open Cluster Management.

Repository structure

This repository hosts policies for Open Cluster Management. You can deploy these policies using Open Cluster Management which includes a policy framework that is available as an addon. Policies are organized in two ways:

  1. By support expectations which are detailed below.
  2. By NIST Special Publication 800-53.

The following folders are used to separate policies by the support expectations:

  • stable -- Policies in the stable folder are contributions that are being supported by the Open Cluster Management Policy SIG.
  • 3rd-party -- Policies in the 3rd-party folder are contributions that are being supported, but not by the Open Cluster Management Policy SIG. See the details of the policy to understand the support being provided.
  • community -- Policies in the community folder are contributed from the open source community. Contributions should start in the community.

In addition to policy contributions, there is the option to contribute groups of policies as a set. This is known as PolicySets and these contributions are made in directories organized as PolicyGenerator projects. The folder containing these contributions is located here: PolicySet projects.

Using GitOps to deploy policies to a cluster

Fork this repository and use the forked version as the target to run the sync against. This is to avoid unintended changes to be applied to your cluster automatically. To get latest policies from the policy-collection repository, you can pull the latest changes from policy-collection to your own repository through a pull request. Any further changes to your repository are automatically be applied to your cluster.

Make sure you have kubectl installed and that you are logged into your hub cluster in terminal.

Run kubectl create ns policies to create a "policies" ns on hub. If you prefer to call the namespace something else, you can run kubectl create ns <custom ns> instead.

From within this directory in terminal, run cd deploy to access the deployment directory, then run bash ./deploy.sh -u <url> -p <path> -n <namespace>. (Details on all of the parameters for this command can be viewed in its README.) This script assumes you have enabled Application lifecycle management as an addon in your Open Cluster Management installation. See Application lifecycle management for details on installing the Application addon.

The policies are applied to all managed clusters that are available, and have the environment set to dev. Specifically, an available managed cluster has the status parameter set to true by the system, for the ManagedClusterConditionAvailable condition. If policies need to be applied to another set of clusters, update the PlacementRule.spec.clusterSelector.matchExpressions section in the policies.

Note: As new clusters are added that fit the criteria previously mentioned, the policies are applied automatically.

Subscription Administrator

In new versions of Open Cluster Management you must be a subscription administrator in order to deploy policies using a subscription. In these cases the subscription is still successfully created, but policy resources are not distributed as expected. You can view the status of the subscription to see the subscription errors. If the subscription administrator role is required, a message similar to the following one appears for any resource that is not created:

        demo-stable-policies-chan-Policy-policy-cert-ocp4:
          lastUpdateTime: "2021-10-15T20:37:59Z"
          phase: Failed
          reason: 'not deployed by a subscription admin. the resource apiVersion: policy.open-cluster-management.io/v1 kind: Policy is not deployed'

To become a subscription administrator, you must add an entry for your user to the ClusterRoleBinding named open-cluster-management:subscription-admin. A new entry may look like the following:

subjects:
  - kind: User
    apiGroup: rbac.authorization.k8s.io
    name: my-username

After updating the ClusterRoleBinding, you need to delete the subscription and deploy the subscription again.

Policy Generator

GitOps through Open Cluster Management is able to handle Kustomize files, so you can also use the Policy Generator Kustomize plugin to generate policies from Kubernetes manifests in your repository. The Policy Generator handles Kubernetes manifests as well as policy engine manifests from policy engines like Gatekeeper and Kyverno.

For additional information about the Policy Generator:

Community, discussion, contribution, and support

Check the Contributing policies document for guidelines on how to contribute to the repository.

Blogs: Read our blogs that are in the blogs folder.

Resources: View the following resources for more information on the components and mechanisms are implemented in the product governance framework.

More Repositories

1

ocm

Core components in the OCM project. Report here if you found any issues in OCM.
Go
736
star
2

api

Core APIs for open cluster management
Go
250
star
3

clusteradm

command line tool to bootstrap open-cluster-management control plane.
Go
79
star
4

community

open-cluster-management governance material.
61
star
5

registration-operator

Minimum cluster registration and work
Go
58
star
6

multicloud-operators-subscription

Enables multicluster application delivery.
Go
44
star
7

cluster-proxy

An OCM addon that automates the installation of Kubernetes' konnectivity servers and agents.
Go
42
star
8

registration

hub / spoke registration controllers
Go
42
star
9

policy-generator-plugin

A Kustomize generator plugin to generate Open Cluster Management policies
Go
29
star
10

work

resource manifest distribution among multiple clusters.
Go
29
star
11

argocd-pull-integration

ArgoCD Application pull model using Open Cluster Management. See https://open-cluster-management.io/ and https://argoproj.github.io/ for more details on both projects.
Go
24
star
12

enhancements

Maintain design docs for core apis and components.
23
star
13

addon-framework

addon apis
Go
23
star
14

placement

Controller to make placement decisions based on Placement APIs
Go
20
star
15

open-cluster-management-io.github.io

website code of open-cluster-management project
HTML
16
star
16

multicluster-controlplane

A standalone controlplane to run ocm core.
Go
15
star
17

governance-policy-propagator

Go
14
star
18

managed-serviceaccount

Go
12
star
19

config-policy-controller

Go
12
star
20

multicloud-integrations

Integrations: Argo CD auto-import
Go
9
star
21

governance-policy-framework-addon

The governance-policy-framework OCM addon that handles syncing from and to the Hub.
Go
7
star
22

ocm-vscode-extension

OCM VScode Extension is a UI tool for creating and managing OCM related Kubernetes resources
TypeScript
6
star
23

multicloud-operators-channel

Provides the source for multicluster application delivery. See https://github.com/open-cluster-management-io/multicloud-operators-subscription for more details.
Go
6
star
24

addon-contrib

This is to host ocm addons in staging
Go
5
star
25

governance-policy-addon-controller

Go
5
star
26

sdk-go

sdk for the go programming language use by other components in open-cluster-management
Go
3
star
27

governance-policy-status-sync

Go
2
star
28

governance-policy-spec-sync

Go
2
star
29

governance-policy-template-sync-archive

Go
2
star
30

helm-charts

hosting helm charts for open-cluster-management subprojects
HTML
2
star
31

cluster-permission

This repo contains the API and controller for automating RBAC resource distribution and lifecycle management for managed clusters.
Go
2
star
32

ocm-kustomize-generator-plugins

Kustomize generator plugins for use with Open Cluster Management
Go
1
star
33

multicluster-mesh

Go
1
star
34

governance-policy-template-sync

Go
1
star
35

governance-policy-nucleus

Go
1
star