From 50db9a6c58cf74c0dee5d3255aabd7bfbb2ae982 Mon Sep 17 00:00:00 2001 From: Takumi Yanagawa Date: Fri, 8 Sep 2023 11:56:43 +0900 Subject: [PATCH] Fix indent in README Signed-off-by: Takumi Yanagawa --- README.md | 89 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 0a9ed59..adf6f38 100644 --- a/README.md +++ b/README.md @@ -1,74 +1,75 @@ # compliance-to-policy Compliance-to-Policy (C2P) provides the framework to bridge the gap between compliance and policy administration. -## setup pipeline +## C2P as pipeline task +### Setup pipeline 1. Create two repositories (one is configuration repository that's used for pipeline from OSCAL to Policy and another is evidence repository that's used for pipeline from OCM statuses to Compliance result) - - For example, c2p-for-ocm-pipeline01-config and c2p-for-ocm-pipeline01-evidence + - For example, c2p-for-ocm-pipeline01-config and c2p-for-ocm-pipeline01-evidence 1. Create Github Personal Access Token having following permissions - - Repository permission of `Contents`, `Pull Requests`, and `Workflows` with read-and-write against both the configuration repository and the evidence repository. + - Repository permission of `Contents`, `Pull Requests`, and `Workflows` with read-and-write against both the configuration repository and the evidence repository. 1. Fork C2P repository (yana1205/compliance-to-policy.git) and checkout `template` 1. Set required parameters for github action to initialize your configuration and evidence repo - 1. Go to Settings tab - 1. Go to `Actions` under `Secrets and variables` - 1. Create `New repository secret` - - Name: PAT - - Secret: Created Github Personal Access Token - 1. Go to `Variables` tab to create `New repository variable` - 1. Create `CONFIGURATION_REPOSITORY` variable - - Name: CONFIGURATION_REPOSITORY - - Value: `/ (e.g. yana1205/c2p-for-ocm-pipeline01-config)` - 1. Create `EVIDENCE_REPOSITORY` variable - - Name: EVIDENCE_REPOSITORY - - Value: `/ (e.g. yana1205/c2p-for-ocm-pipeline01-evidence)` + 1. Go to Settings tab + 1. Go to `Actions` under `Secrets and variables` + 1. Create `New repository secret` + - Name: PAT + - Secret: Created Github Personal Access Token + 1. Go to `Variables` tab to create `New repository variable` + 1. Create `CONFIGURATION_REPOSITORY` variable + - Name: CONFIGURATION_REPOSITORY + - Value: `/ (e.g. yana1205/c2p-for-ocm-pipeline01-config)` + 1. Create `EVIDENCE_REPOSITORY` variable + - Name: EVIDENCE_REPOSITORY + - Value: `/ (e.g. yana1205/c2p-for-ocm-pipeline01-evidence)` 1. Run Action `Initialize repositories` with branch `template` 1. Go to the configuration repository and create `New repository secret` - - Name: PAT - - Secret: Created Github Personal Access Token + - Name: PAT + - Secret: Created Github Personal Access Token 1. Go to the evidence repository and create `New repository secret` - - Name: PAT - - Secret: Created Github Personal Access Token + - Name: PAT + - Secret: Created Github Personal Access Token -## run oscal-to-pocliy +### Run oscal-to-pocliy 1. Go to the configuration repository 1. Go to `Actions` tab 1. Run `OSCAL to Policy` - 1. This action generates manifests from OSCAL and then generate a PR of changes for a directory `ocm-policy-manifests` containing the generated manifests. + 1. This action generates manifests from OSCAL and then generate a PR of changes for a directory `ocm-policy-manifests` containing the generated manifests. 1. Merge the PR -## integrate with GitOps +### Integrate with GitOps 1. Sync `ocm-policy-manifests` directory with your OCM Hub by OCM GitOps (OCM Channel and Subscription addon) -## deploy collector to your OCM Hub +### Deploy collector to your OCM Hub 1. Apply RBAC for collector - ``` - kubectl apply -f https://raw.githubusercontent.com/yana1205/compliance-to-policy/redesign.0622/scripts/collect/rbac.yaml - ``` + ``` + kubectl apply -f https://raw.githubusercontent.com/yana1205/compliance-to-policy/redesign.0622/scripts/collect/rbac.yaml + ``` 1. Create Secret for Github access - ``` - kubectl -n c2p create secret generic --save-config collect-ocm-status-secret --from-literal=user= --from-literal=token= --from-literal=org= --from-literal=repo= - ``` - e.g. - ``` - kubectl -n c2p create secret generic --save-config collect-ocm-status-secret --from-literal=user=yana1205 --from-literal=token=github_pat_xxx --from-literal=org=yana1205 --from-literal=repo=c2p-for-ocm-pipeline01-evidence - ``` + ``` + kubectl -n c2p create secret generic --save-config collect-ocm-status-secret --from-literal=user= --from-literal=token= --from-literal=org= --from-literal=repo= + ``` + e.g. + ``` + kubectl -n c2p create secret generic --save-config collect-ocm-status-secret --from-literal=user=yana1205 --from-literal=token=github_pat_xxx --from-literal=org=yana1205 --from-literal=repo=c2p-for-ocm-pipeline01-evidence + ``` 1. Deploy collector cronjob - ``` - kubectl apply -f https://raw.githubusercontent.com/yana1205/compliance-to-policy/redesign.0622/scripts/collect/cronjob.yaml - ``` + ``` + kubectl apply -f https://raw.githubusercontent.com/IBM/compliance-to-policy/main/scripts/collect/cronjob.yaml + ``` -## cleanup +### Cleanup ``` -kubectl delete -f https://raw.githubusercontent.com/yana1205/compliance-to-policy/redesign.0622/scripts/collect/cronjob.yaml +kubectl delete -f https://raw.githubusercontent.com/IBM/compliance-to-policy/main/scripts/collect/cronjob.yaml kubectl -n c2p delete secret collect-ocm-status-secret -kubectl delete -f https://raw.githubusercontent.com/yana1205/compliance-to-policy/redesign.0622/scripts/collect/rbac.yaml +kubectl delete -f https://raw.githubusercontent.com/IBM/compliance-to-policy/main/scripts/collect/rbac.yaml ``` --- -# Controller pattern -## Prerequisites +## Utilities +### Prerequisites 1. Install [Policy Generator Plugin](https://github.com/open-cluster-management-io/policy-generator-plugin#as-a-kustomize-plugin) -## C2P Decomposer +### C2P Decomposer Decompose OCM poicy collection to kubernetes resources composing each OCM policy (we call it policy resource). 1. Clone [Policy Collection](https://github.com/open-cluster-management-io/policy-collection) @@ -100,7 +101,7 @@ Decompose OCM poicy collection to kubernetes resources composing each OCM policy │   │   └── License.triliovault-license.0.yaml │   ├── kustomization.yaml ``` -## C2P Composer +### C2P Composer Compose OCM Policy from policy resources from compliance information (for example, [compliance.yaml](cmd/compose/compliance.yaml)) 1. Run C2P Composer @@ -130,7 +131,7 @@ Compose OCM Policy from policy resources from compliance information (for exampl └── policy-sets.yaml ``` -## C2P Controller +## C2P as controller (deprecated) 1. Build image ``` make docker-build docker-push IMG=