stock-k8s-operator

command module
v0.0.0-...-edafbf7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 12 Imported by: 0

README ยถ

๐Ÿ“Š Stock K8s Operator

A Kubernetes operator that dynamically monitors stock prices and integrates financial data into your Kubernetes ecosystem.

Go Report Card License

๐Ÿ” Overview

The Stock K8s Operator enables Kubernetes to interact with financial markets by providing real-time stock price monitoring capabilities within your cluster. This operator extends Kubernetes with custom resources that represent stock quotes and their associated data, allowing your applications to react to market information.

โœจ Features

  • ๐Ÿ“ˆ Stock Quote Monitoring: Query current stock prices from financial data providers
  • ๐Ÿ”„ Automatic Updates: Periodically fetch the latest stock information
  • ๐Ÿ“Š Status Integration: Stock quote data stored directly in Kubernetes resource status
  • ๐Ÿ”— API Provider Flexibility: Compatible with various stock data APIs
  • ๐Ÿงฉ Kubernetes Native: Follows standard Kubernetes operator patterns

๐Ÿ—๏ธ Architecture

Architecture Diagram

The Stock K8s Operator follows standard Kubernetes operator patterns:

  1. Custom Resource Definition: Defines StockQuote resources in your cluster
  2. Controller: Watches for StockQuote resources and queries external APIs for data
  3. Reconciliation Loop: Periodically fetches updated stock information
  4. Status Updates: Records current price and metadata in the resource status

๐Ÿš€ Installation

Prerequisites
  • Kubernetes cluster v1.19+
  • kubectl v1.19+
  • Helm v3+ (optional)
Using kubectl
# Install CRDs
kubectl apply -f https://raw.githubusercontent.com/rodrigc/stock-k8s-operator/main/config/crd/bases/batch.stock-operator.crodrigues.org_stockquotes.yaml

# Install operator
kubectl apply -f https://raw.githubusercontent.com/rodrigc/stock-k8s-operator/main/config/deploy/operator.yaml
Using Helm
helm repo add stock-operator https://rodrigc.github.io/stock-k8s-operator/charts
helm install stock-operator stock-operator/stock-k8s-operator

๐Ÿ“ Usage

Creating a StockQuote Resource
apiVersion: batch.stock-operator.crodrigues.org/v1
kind: StockQuote
metadata:
  name: aapl-stock
spec:
  symbol: AAPL
Checking StockQuote Status
kubectl get stockquotes
NAME        SYMBOL   PRICE    LAST UPDATED
aapl-stock  AAPL     175.23   2025-03-15T14:30:00Z
msft-stock  MSFT     418.07   2025-03-15T14:30:00Z
Detailed View
kubectl describe stockquote aapl-stock

โš™๏ธ Configuration

The operator can be configured through environment variables:

Variable Description Default
WATCH_NAMESPACE Namespace to watch for StockQuote resources All namespaces
API_PROVIDER Stock data provider to use alphavantage
API_KEY API key for the stock data provider ""
RECONCILE_PERIOD How often to update stock quotes 5m

๐Ÿ’ป Development

Building from Source
# Clone the repository
git clone https://github.com/rodrigc/stock-k8s-operator.git
cd stock-k8s-operator

# Build
make build

# Run locally
make run
Running Tests
make test

๐Ÿ”ฎ Use Cases

  • Financial Dashboards: Display real-time market data in Kubernetes-based dashboards
  • Informational Services: Provide stock information to applications running in your cluster
  • Market Data Collection: Gather stock prices for analysis or reporting
  • Financial Applications: Base financial applications on current market data

๐Ÿค Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.

๐Ÿ“œ License

MIT License

Documentation ยถ

The Go Gopher

There is no documentation for this package.

Directories ยถ

Path Synopsis
api
v1
Package v1 contains API Schema definitions for the batch v1 API group.
Package v1 contains API Schema definitions for the batch v1 API group.
internal
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher ๐Ÿ‡ป๐Ÿ‡ณ