Skip to content

ITlusions/ITLAuth

Repository files navigation

ITLC - ITL Control Plane CLI

Keycloak authentication and resource management CLI for ITlusions

Quick Start

# Install
pip install itlc

# Setup OIDC authentication for kubectl
itlc configure oidc

# Interactive login
itlc login

# Check current user
itlc whoami

# Get service account token
itlc get-token --client-id=my-app --client-secret=secret

Features

  • Interactive Authentication - Browser-based OAuth login (Azure CLI-style)
  • Token Management - Automatic caching and refresh
  • Realm Management - Multi-tenant realm switching
  • Core Resource Management - Tenants, subscriptions, resource groups, management groups, locations
  • Kubernetes Integration - OIDC authentication for kubectl
  • Service Accounts - CI/CD automation support
  • Cluster Management - Register and manage Kubernetes clusters

Installation

From Source

git clone https://github.com/ITlusions/ITL.ControlPlane.Cli.git
cd ITL.ControlPlane.Cli
pip install -e .

Using pip (when published)

pip install itlc

Documentation

πŸ“š Complete documentation is available in the docs/ folder:

Environment Variables

export KEYCLOAK_URL=https://sts.itlusions.com       # Keycloak server
export KEYCLOAK_REALM=itlusions                     # Keycloak realm
export KEYCLOAK_CLIENT_ID=my-app                    # Service account client ID
export KEYCLOAK_CLIENT_SECRET=secret                # Service account secret
export CONTROLPLANE_URL=http://localhost:8000       # Control Plane API (direct)
export CONTROLPLANE_GATEWAY_URL=https://api.itlusions.com  # API Gateway

Common Commands

Authentication

# Interactive login
itlc login

# Check current user
itlc whoami

# Logout
itlc logout

Token Management

# Get access token
itlc get-token

# Inspect JWT token
itlc inspect <token> --decode

# List cached tokens
itlc cache-list

# Clear cache
itlc clear-cache --all

Realm Management

# List available realms
itlc realm list

# Switch realm
itlc realm set production

# Show realm info
itlc realm info

Resource Management

# Create tenant
itlc tenant create my-tenant --display-name "My Tenant" --domain mycompany.com

# List tenants
itlc tenant list

# Create subscription
itlc subscription create my-sub --display-name "My Subscription" --tenant-id my-tenant

# List subscriptions
itlc subscription list

# Create resource group
itlc resourcegroup create my-rg my-sub --location westeurope

# Create management group hierarchy
itlc managementgroup create root-mg --display-name "Organization Root"
itlc managementgroup create platform-mg --display-name "Platform" --parent-id root-mg

# List management groups
itlc managementgroup list

# List locations
itlc location list

# Create custom location
itlc location create my-datacenter --display-name "My Datacenter" --region "Netherlands" --location-type DataCenter

Kubernetes Clusters

# Setup OIDC authentication
itlc configure oidc

# List registered clusters
itlc cluster list

# Add cluster
itlc cluster add --name k8s-prod --server https://api.k8s.example.com

# Use with kubectl
kubectl --context=k8s-prod get nodes

Development

# Clone repository
git clone https://github.com/ITlusions/ITLAuth.git
cd ITLAuth

# Install in development mode
pip install -e .

# Run tests
pytest

# Run specific test
python -m unittest tests.test_basic

Project Structure

ITL.ControlPlane.Cli/
β”œβ”€β”€ src/itlc/              # Main CLI package
β”‚   β”œβ”€β”€ __main__.py        # CLI entry point
β”‚   β”œβ”€β”€ keycloak_client.py # Keycloak integration
β”‚   β”œβ”€β”€ interactive_auth.py# Browser-based login
β”‚   β”œβ”€β”€ token_cache.py     # Token caching
β”‚   β”œβ”€β”€ controlplane_client.py  # Control Plane API
β”‚   β”œβ”€β”€ core_commands.py   # Core resource commands
β”‚   └── ...                # Other modules
β”œβ”€β”€ docs/                  # Documentation
β”œβ”€β”€ tests/                 # Test suite
β”œβ”€β”€ pyproject.toml         # Package configuration
β”œβ”€β”€ setup.py               # Setup script
└── README.md              # This file

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add/update tests
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Links


Made by ITlusions - Kubernetes β€’ OIDC β€’ Keycloak β€’ Enterprise Auth

About

Module for configuring Kubernetes OIDC config

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors