Cloud Native - Security & Compliance - OPA - Glance
Overview Policy-based control for cloud native environments Flexible, fine-grained control for administrators across the stack Use OPA for a unified toolset and framework for policy across the cloud native stack. Decouple policy from the service’s code, so you can release, analyze, and review policies without sacrificing availability or performance. Declarative Policy Declarative Express policy in a high-level, declarative language that promotes safe, performant, fine-grained controls. DSL : Use a lan...
Go Engineering - Specification - Life Cycle
生命周期管理 研发模式瀑布模式 按照预先规划好的研发阶段来推进研发进度,串行执行(在每个阶段完美完成后,才会进入到下一阶段) 迭代模式 研发任务被切成一系列轮次,每一个轮次是一个迭代,每一次迭代都是从设计到实现的完整过程 不要求每个阶段的任务都做到最完美,先把主要功能搭建起来,然后再通过客户的反馈信息不断完善 缺点:比较专注于开发过程,很少从项目管理的视角去加速和优化项目开发过程 敏捷模式 将一个大的需求分成多个、可分阶段完成的小迭代,在开发过程中,软件一直处于可用状态! 敏捷模式需要高频地开发、构建、测试、发布和部署,进而催生了 CICD 技术 CICD CICD 通过自动化的手段,快速执行代码检查、测试、构建、部署等任务,解决敏捷模式带来的弊端 CI:Continuous Integration 频繁地将开发者的代码合并到主干上 流程 开发人员完成代码开发,push 到 git 仓库 CI 工具对代码进行扫描、单元测试和构建,并将结果反馈给开发者 CI 通过后会将代码合并到主干 CI 可以让问题在开发阶段暴露,CI 执行很频繁,需要自动化工具支撑 CD:Continuous ...
Go Engineering - Specification - Workflow
集中式 在本地仓库的 master 分支开发,将修改后的代码 commit 到远程仓库,如有冲突先本地解决再提交 适合场景:团队人员少、开发不频繁、不需要同时维护多个版本的小项目 功能分支 12345678910# git checkout -b feature/rate-limiting# git add limit.go# git commit -m "add rate limiting"# git push origin feature/rate-limiting# Github: Compare & pull request -> Create pull request# Github: Code Review -> Merge pull request Merge PR Create a merge commit – 推荐 底层操作:git merge --no-ff With --no-ff, create a merge commit in all cases, even when the merge could instead be...
Go Engineering - Specification - Directory
平铺式 主要用在 Go 包(框架、库)中,相对来说比较简单,如 glog 12# lsLICENSE README.md glog.go glog_file.go glog_test.go go.mod 结构化 主要用在 Go 应用中,相对来说比较复杂,事实规范:project-layout 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485├── api│ ├── openapi│ └── swagger├── build│ ├── ci│ ├── docker│ │ ├── iam-apiserver│ │ ├── iam-authz-server│ │ └── iam-pump│ ├── package├── CHANGELOG├── cmd│ ├...
Infrastructure - Authentication - LDAP
What is LDAP 目录服务 目录 ≈ 树状结构的数据库 目录服务 ≈ 以树状结构的目录数据库为基础,外加各种访问协议的信息查询服务 目录数据库 vs 关系型数据库:读取性能极高,写入性能非常差(不支持事务),不适合频繁修改数据 用途:具有层次性且不需要频繁修改的数据,例如企业员工信息、企业设备信息等 LDAP DAP = Directory Access Protocol X.500 是一套目录服务的标准(协议族) 通过 X.500 可以将局部的目录服务连接起来,构建基于 Internet 的分布在全球的目录服务系统 DAP 是 X.500 的核心组成之一,但非常复杂,因此诞生了 LDAP LDAP 是基于 X.500 的 DAP 发展而来,目前是第 3 版 LDAP 特点 基于 TCP/IP 以树状结构存储数据 读取速度快,写入速度慢 服务端用于存放数据,客户端用于操作数据 跨平台,维护简单 支持 SSL/TLS 加密 协议是开放的 样例
Infrastructure - Authentication - Basic + JWT
HTTP Authentication Some common authentication schemes include: Basic Bearer The server responds to a client with a 401 (Unauthorized) response status and provides information on how to authorize with a WWW-Authenticate response header containing at least one challenge. A client that wants to authenticate itself with the server can then do so by including an Authorization request header with the credentials. Usually a client will present a password prompt to the user and will then issue the request inc...
Infrastructure - Authentication - Scheme
ConceptSecrets and Keys Authentication is the art of unlocking things with a secret. At the heart of every authentication is a shared secret! The secret has two copies. One copy is with the system and the other copy is with you. Your copy is what is called the private key. The server only has a highly encrypted version of the secret; it doesn’t know what the decrypted value would look like. That’s why if you forget your password, you’d need to reset it. Public and Private Keys Your copy which is th...
Go Engineering - Specification - Commit
规范化的优势 优势:Commit Message 可读性更好 + 自动化 清晰地知道每个 Commit 的变更内容 基于 Commit Message 进行过滤查找:git log --oneline --grep "^feat|^fix|^perf" 基于 Commit Message 生成 Change Log 基于 Commit Message 触发 CICD 流程 确定语义化版本的版本号 fix 类型映射为 PATCH 版本 feat 类型映射为 MINOR 版本 带有 BREAKING CHANGE 的 Commit 映射为 MAJOR 版本 Angular 规范 Angular 格式清晰,使用最为广泛;Angular 规范是一种语义化的提交规范 Commit Message 是语义化的 Commit Message 都会被归为一个有意义的类型,用来说明本次 Commit 的类型 Commit Message 是规范化的 Commit Message 遵循预先定义好的规范,可以被开发者和工具识别 样例 规范 Commit Message 组成部分:...
Go Engineering - Specification - Open Source + Document + Version
规范 分类 规范 非编码类规范 开源规范 文档规范 版本规范 提交规范 发布规范 编码类规范 目录规范 代码规范 接口规范 日志规范 错误码规范 开源规范开源协议 Apache 是对商业应用友好的协议,大公司的开源项目通常会采用 Apache 2.0 开源协议 开源项目 较高的单元覆盖率 代码库中不能包含敏感信息 及时处理 PR、ISSUE 等 持续更新和 Bug Fix 文档规范 文档属于软件交付的一个重要组成部分 README12345678910111213141516171819202122# 项目名称## 功能特性## 软件架构(可选)## 快速开始### 依赖检查### 构建### 运行## 使用指南## 如何贡献## 社区(可选)## 关于作者## 谁在用(可选)## 许可证 项目文档12345678910111213141516171819202122232425262728docs├── devel # 开发文档,可以提前规划好,英文版文档和中文版文档│...
Go Engineering - IAM
概述 IAM:Identity and Access Management 用途:在特定条件下,用户能够对哪些资源做哪些操作 工作流程 3 种平台资源:User、Secret、Policy 系统架构 核心功能 创建平台资源 用户通过 iam-webconsole 或者 iamctl 请求 iam-apiserver,完成 User、Secret、Policy 的 CRUD iam-apiserver 将这些资源持久化到 MySQL 中 请求 API 完成资源授权 用户通过 iam-authz-server 的 /v1/authz 接口进行资源授权 请求 /v1/authz 接口需要通过密钥认证,认证通过后会查询授权策略,从而决定资源是否被允许 为了提高 /v1/authz 接口的性能,iam-authz-server 将密钥和策略缓存在内存中 iam-authz-server 通过 gRPC 调用 iam-apiserver,将密钥和策略缓存到内存中 为了保证数据的一致性,借助 Redis Channel 当 iam-ap...















