Thanks to visit codestin.com
Credit goes to github.com

Skip to content

geowa4/oc-safe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

oc-safe

A safe wrapper for OpenShift CLI (oc) that only allows read-only commands.

What's included

  • oc - A wrapper script that delegates to the actual oc binary but only allows read-only commands
  • kubectl - A script that instructs users to use oc instead of kubectl

Allowed Commands

The oc wrapper only permits the following read-only commands:

  • get - Display one or many resources
  • describe - Show details of a specific resource
  • logs - Print container logs
  • explain - Get documentation for a resource
  • adm top - Display resource usage statistics

Any attempt to run other commands (like apply, delete, edit, etc.) will be blocked.

Usage

# These commands will work
oc get pods
oc describe pod my-pod
oc logs my-pod
oc explain deployment
oc adm top nodes

# These commands will be blocked
oc delete pod my-pod
oc apply -f manifest.yaml
oc edit deployment my-deployment

Installation

  1. Add this directory to your PATH before the actual oc binary location
  2. Update the OC_BINARY path in the oc script to point to your actual oc installation

Configuration

Edit the ALLOWED_COMMANDS array in the oc script to customize which commands are permitted:

ALLOWED_COMMANDS=(
  "get"
  "describe"
  "logs"
  "explain"
  "adm top"
)

Why?

This wrapper is useful when you want to:

  • Prevent accidental modifications to cluster resources
  • Provide safe read-only access to OpenShift clusters
  • Ensure consistent behavior by only allowing vetted commands
  • Reduce the risk of destructive operations

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages