Skip to content

Commit

Permalink
Merge pull request #934 from run-ai/policies-mess-218
Browse files Browse the repository at this point in the history
Merge pull request #933 from run-ai/policies-mess
  • Loading branch information
yarongol authored Aug 8, 2024
2 parents 2444d61 + 744343d commit 02a5f20
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 105 deletions.
7 changes: 6 additions & 1 deletion docs/Researcher/Walkthroughs/quickstart-overview.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

Below are a set of Quickstart documents. The purpose of these documents is to get you acquainted with an aspect of Run:ai in the simplest possible form.
Below is a set of Quickstart documents. The purpose of these documents is to get you acquainted with an aspect of Run:ai in the simplest possible form.

!!! Note
The Quickstart documents are based solely on the command-line interface. The same functionality can be achieved by using the [Workloads](../user-interface/workspaces/overview.md) User interface which allows for Workload submission and log viewing.


Follow the Quickstart documents below to learn more:

* [Unattended training sessions](walkthrough-train.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,74 +32,11 @@ To return to the previous *Policy Manager* toggle the switch off.

Kyverno runs as a dynamic admission controller in a Kubernetes cluster. Kyverno receives validating and mutating admission webhook HTTP callbacks from the Kubernetes API server and applies matching policies to return results that enforce admission policies or reject requests. Kyverno policies can match resources using the resource kind, name, label selectors, and much more. For more information, see [How Kyverno Works](https://kyverno.io/docs/introduction/#how-kyverno-works){target=_blank}.

## Policy Types
## Policy Details

When you configure a policy, you need to specify the workload type. The following workload types are available:

* [**Training**](training-policy.md)—places policy restrictions on [trainings](../../../Researcher/user-interface/trainings.md#trainings).
* [**Workspace**](workspaces-policy.md)—places policy restrictions on [Workspaces](../../../Researcher/user-interface/workspaces/overview.md#getting-familiar-with-workspaces).
For details on how to set a policy see [New Policies](workspaces-policy.md).

### Policy Inheritance

A policy configured to a specific scope, is applied to all elements in that scope. You can add more policy restrictions to individual elements in the scope in order to override the base policy or add more restrictions.

## Policy Format

### Policy Editor UI

Policies are added to the system using the policy editor and are written in YAML format. YAML™ is a human-friendly, cross-language, Unicode-based data serialization language designed around the common native data types of dynamic programming languages. It is useful for programming needs ranging from configuration files to internet messaging to object persistence to data auditing and visualization. For more information, see [YAML.org](https://yaml.org/){target=_blank}.

### Policy API

Access the *Policy* [API reference](https://app.run.ai/api/docs#tag/Policy){target=_blank} to see how to apply *Policies* in the Run:ai platform.

### Example Policy

The following is an example of a workspace policy you can apply in your platform. Copy the values and paste them into the policy editor in the UI.

```YAML
defaults:
createHomeDir: true
environmentVariables:
instances:
- name: MY_ENV
value: my_value
security:
allowPrivilegeEscalation: false
rules:
imagePullPolicy:
required: true
options:
- value: Always
displayed: Always
- value: Never
displayed: Never
createHomeDir:
canEdit: false
security:
runAsUid:
min: 1
max: 32700
allowPrivilegeEscalation:
canEdit: false
compute:
cpuCoreLimit:
required: true
min: 0
max: 9
gpuPortionRequest:
min: 0
max: 10
storage:
nfs:
instances:
canAdd: false
s3:
attributes:
url:
options:
- value: https://www.google.com
displayed: https://www.google.com
- value: https://www.yahoo.com
displayed: https://www.yahoo.com
```
8 changes: 6 additions & 2 deletions docs/admin/workloads/policies/policies.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
---
title: Policies
summary: This article is about the V1 policies. These are policies that worked from version 2.15 and lower.
title: Policies (YAML-based)
summary: This article is about the V1 policies.
authors:
- Jason Novich
date: 2023-Dec-12
---

!!! Warning
The below describes the old Policies that rely on YAML-based Policies. While these still work, they have been replaced with Control-plane-based policies which are accessible via API and user interface.
For a description of the new policies, see [API-based Policies](./workspaces-policy.md).

## What are Policies?

Policies allow administrators to _impose restrictions_ and set _default values_ for Researcher Workloads. For example:
Expand Down
19 changes: 5 additions & 14 deletions docs/admin/workloads/policies/workspaces-policy.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---
title: Workspaces Policy
summary: This article outlines what is a workspaces policy and details the variables that are used in the policy.
authors:
- Jason Novich
date: 2023-Dec-18
title: Policies
summary: This article outlines what is a policy and details the variables that are used in the policy.

---

A *Workspaces* policy places resource restrictions and defaults on workspaces in the Run:ai platform. Restrictions and default values can be placed on CPUs, GPUs, and other resources or entities.
A Policy places resource restrictions and defaults on Workloads in the Run:ai platform. Restrictions and default values can be placed on CPUs, GPUs, and other resources or entities.

## Example

Expand All @@ -25,8 +23,6 @@ defaults:
environmentVariables:
- name: MY_ENV
value: my_value
workspace:
allowOverQuota: true
rules:
compute:
cpuCoreLimit:
Expand Down Expand Up @@ -58,9 +54,6 @@ rules:
canEdit: false
allowPrivilegeEscalation:
canEdit: false
workspace:
allowOverQuota:
canEdit: false
imposedAssets:
dataSources:
nfs:
Expand Down Expand Up @@ -91,6 +84,4 @@ To create a policy:
8. When done, press *SAVE POLICY*.
!!! Note
After saving, the form will wait for the policy to sync with the cluster.
--8<-- "../docs/snippets/snippets-policies.md"
After saving, the form will wait for the policy to sync with the cluster.
2 changes: 1 addition & 1 deletion docs/home/whats-new-2-16.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ date: 2023-Dec-4

#### Policies

* <!-- DONE RUN-11125/RUN-11746 TW - Policy Sync - Catch all for the new policies pages and features. -->Added new *Policy Manager. The new *Policy Manager* provides administrators the ability to impose restrictions and default values on system resources. The new *Policy Manager* provides a YAML editor for the configuration of the policies. Administrators can easily add both *Workspace* or *Training* policies. The editor makes it easy to see the configuration that has been applied and provides a quick and easy method to edit the policies. The new *Policy Editor* brings other important policy features such as the ability to see non-compliant resources in workloads. For more information, see [Policies](../admin/workloads/policies/README.md#policy-editor-ui).
* <!-- DONE RUN-11125/RUN-11746 TW - Policy Sync - Catch all for the new policies pages and features. -->Added new *Policy Manager. The new *Policy Manager* provides administrators the ability to impose restrictions and default values on system resources. The new *Policy Manager* provides a YAML editor for the configuration of the policies. Administrators can easily add both *Workspace* or *Training* policies. The editor makes it easy to see the configuration that has been applied and provides a quick and easy method to edit the policies. The new *Policy Editor* brings other important policy features such as the ability to see non-compliant resources in workloads. For more information, see [Policies](../admin/workloads/policies/workspaces-policy.md#viewing-or-edit-a-policy).

* <!-- DONE RUN-9808/RUN-9810 - Show effective project policy from the UI -->Added a new policy manager. Enabling the *New Policy Manager* provides new tools to discover how resources are not compliant. Non-compliant resources and will appear greyed out and cannot be selected. To see how a resource is not compliant, press on the clipboard icon in the upper right hand corner of the resource. Policies can also be applied to specific scopes within the Run:ai platform. For more information, see [Viewing Project Policies](../admin/aiinitiatives/org/projects.md#adding-a-new-project).

Expand Down
2 changes: 1 addition & 1 deletion docs/home/whats-new-2-17.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ date: 2024-Apr-14

#### Assets

* <!-- RUN14616/RUN-14759/RUN-14758/RUN14761/RUN-14772/RUN-14773 - Add configmap as data source, control by policy, CLI -->Added the capability to use a ConfigMap as a data source. The ability to use a ConfigMap as a data source can be configured in the *Data sources* UI, the CLI, and as part of a policy. For more information, see [Setup a ConfigMap as a data source](../Researcher/user-interface/workspaces/create/create-ds.md#create-a-configmap-data-source), [Setup a ConfigMap as a volume using the CLI](../Researcher/cli-reference/runai-submit.md#-configmap-volume-namepath), or [Setup a ConfigMap Resource description fields](../admin/workloads/policies/training-policy.md#configmap-resource-description-fields) in training policies.
* <!-- RUN14616/RUN-14759/RUN-14758/RUN14761/RUN-14772/RUN-14773 - Add configmap as data source, control by policy, CLI -->Added the capability to use a ConfigMap as a data source. The ability to use a ConfigMap as a data source can be configured in the *Data sources* UI, the CLI, and as part of a policy. For more information, see [Setup a ConfigMap as a data source](../Researcher/user-interface/workspaces/create/create-ds.md#create-a-configmap-data-source), [Setup a ConfigMap as a volume using the CLI](../Researcher/cli-reference/runai-submit.md#-configmap-volume-namepath).

* <!-- RUN-16242/RUN-16243/RUN-14596/RUN-14742/RUN-14577/RUN-14743/RUN-16427/RUN-16428 PVC status Add status table for credentials, ConfigMap-DS, PVC-ds -->Added a *Status* column to the *Credentials* table, and the *Data sources* table. The *Status* column displays the state of the resource and provides troubleshooting information about that asset. For more information, see the [Credentials table](../admin/workloads/credentials-setup.md#credentials-table) and the [Data sources table](../Researcher/user-interface/workspaces/create/create-ds.md#data-sources-table).

Expand Down
2 changes: 1 addition & 1 deletion docs/home/whats-new-2-18.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Deprecated features will be available for **two** versions ahead of the notifica

### API support and endpoint deprecations

The endpoints and parameters specified in the API reference are the ones that are officially supported by Run:ai. For more information about Run:ai's API support policy and deprecation process, see [Developer overview](../developer/overview-developer.md#api-support).
The endpoints and parameters specified in the API reference are the ones that are officially supported by Run:ai. For more information about Run:ai's API support policy and deprecation process, see note under [Developer overview](../developer/overview-developer.md#control-plane-api).

#### Deprecated APIs and API fields

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,4 @@ To create a policy:
5. Select a workload type using the dropdown.
6. In the *Policy YAML* pane, press *+ POLICY YAML* to open the policy editor.
7. Enter your policy in the policy editor. Add policy properties and variables in YAML format. When complete, press *APPLY*.
8. When done, press *SAVE POLICY*.

!!! Note
After saving, the form will wait for the policy to sync with the cluster.

--8<-- "snippets-policies.md:1:170"

#### Training

--8<-- "snippets-policies.md:172:775"

#### Training

--8<-- "snippets-policies.md:777:843"
8. When done, press *SAVE POLICY*.
11 changes: 5 additions & 6 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,14 @@ nav:
- 'Review your performance' :
- 'Dashboard Analysis' : 'admin/performance/dashboard-analysis.md'
- 'Workloads' :
- 'admin/workloads/README.md'
- 'Submitting Workloads' : 'admin/workloads/submitting-workloads.md'
- 'Policies' :
- 'admin/workloads/policies/README.md'
- 'Former Policies' : 'admin/workloads/policies/policies.md'
- 'Training Policy' : 'admin/workloads/policies/training-policy.md'
- 'Workspaces Policy' : 'admin/workloads/policies/workspaces-policy.md'
- 'Overview' : 'admin/workloads/policies/overview.md'
# - 'Training Policy' : 'admin/workloads/policies/training-policy.md'
- 'Policies (API-based)' : 'admin/workloads/policies/workspaces-policy.md'
- 'Policies (YAML-based)' : 'admin/workloads/policies/policies.md'
- 'Secrets' : 'admin/workloads/secrets.md'
- 'Inference' : 'admin/workloads/inference-overview.md'
- 'Submitting Workloads' : 'admin/workloads/submitting-workloads.md'
- 'Credentials' : 'admin/workloads/credentials-setup.md'
- 'Templates': 'admin/workloads/templates.md'
- 'Best Practices' :
Expand Down

0 comments on commit 02a5f20

Please sign in to comment.