Giter VIP home page Giter VIP logo

opa-koans's Introduction

opa-koans

opa-koans

OPA入门系列

OPA(OpenPolicyAgent), 云原生时代的通用规则引擎,重新定义策略引擎,灵活而强大的声明式语言全面支持通用策略定义。

而且,2019年4月2号OPA正式进入了CNCF,作为孵化级托管项目,详见声明

什么是OPA

see in OPA philosophy docs

关键词:

  • 轻量级的通用策略引擎
  • 可与服务共存
  • 集成方式可以是sidecar、主机级守护进程或库引入

opa

文字太直白,看看OPA作者怎么说:

优点

  • 强大的声明式策略

    • 上下文感知
    • 表达性强
    • 快速
    • 可移植
  • 输入和输出支持任意格式

配合强大的声明式策略语言Rego,描述任意规则都不是问题

  • 全面支持规则和系统解耦

如图

除了继承做auth外,还可以应用到k8s,terraform,docker,kafka,sql,linux上做规则决策

  • 工具齐全
    • 有命令行,有交互式运行环境
    • 支持测试,性能分析(底层实现Go)
    • 有强大的交互式编辑器扩展vscode-opa
    • playground分享代码

安装

为了性能,推荐使用最新 OPA latest release

# mac
curl -L -o opa https://openpolicyagent.org/downloads/latest/opa_darwin_amd64
chmod +x opa
mv opa /usr/local/bin/opa

# or use brew(not latest version)
brew install opa

入门

几行代码实现一个简单的RBAC认证服务: example_rbac

cd quick-start
opa eval -i input.json -d data.json -d example.rego "data.example_rbac"

语法进阶

实战

文档一点点完善中。。。

opa-koans's People

Contributors

newbmiao avatar dependabot[bot] avatar renovate-bot avatar dependabot-preview[bot] avatar renovate[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.