惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Vercel News
Vercel News
T
Threatpost
G
Google Developers Blog
T
Threat Research - Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
The Exploit Database - CXSecurity.com
H
Heimdal Security Blog
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
Hacker News: Ask HN
Hacker News: Ask HN
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Schneier on Security
B
Blog
V2EX - 技术
V2EX - 技术
NISL@THU
NISL@THU
C
CERT Recently Published Vulnerability Notes
W
WeLiveSecurity
C
Cybersecurity and Infrastructure Security Agency CISA
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Y
Y Combinator Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Spread Privacy
Spread Privacy
The Last Watchdog
The Last Watchdog
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
Schneier on Security
Schneier on Security
F
Fortinet All Blogs
N
News | PayPal Newsroom
Attack and Defense Labs
Attack and Defense Labs
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
S
Security @ Cisco Blogs
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
Project Zero
Project Zero
I
Intezer
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
SecWiki News
SecWiki News
Martin Fowler
Martin Fowler

博客园 - lswweb

Drone概念与答疑 Centos8通过X11使用GUI应用 Linux自己常用命令记录(待续) K8S Master节点灾备与恢复 - ETCD K8S Master节点灾备与恢复 - Host文件Copy Rook Ceph出现daemons have recently crashed异常 Ceph rbd删除image遭遇watchers异常处理 Ceph OSD更换硬盘后遭遇PG Inconsistent异常与处理 Rook Ceph OSD异常,格式化osd硬盘重新挂载 进入K8S Pod执行操作,遭遇Operation not permitted错误 K8S Pod挂载rook ceph pv报not found in the list of registered CSI drivers异常处理 Vs中调试MVC源代码步骤 手动创建vsct文件 快速查找找VS菜单信息(Guid、GuidId、CmdId等) 在多排序条件下SQL获文章上一条、下一条记录 Knockout中ViewModel与Model的互转 Asp.Net MVC 表单验证 AjaxOptions.OnSuccess回调方法返回的参数信息 一次自定义Configuration的悲惨经历。
Drone基于K8S的Secrets管理
lswweb · 2021-01-07 · via 博客园 - lswweb

如果Drone部署在K8S中,那么可以通过k8s secret来为drone runner提供secret。

注:必须安装drone-kubernetes-secrets组件,且runner配置evn参数DRONE_SECRET_PLUGIN_TOKEN、DRONE_SECRET_PLUGIN_ENDPOINT指向访问drone-kubernetes-secrets服务。而drone-kubernetes-secrets需配置evn参数SECRET_KEY与DRONE_SECRET_PLUGIN_TOKEN一致。

一、创建k8s secret

apiVersion: v1
kind: Secret
type: Opaque
data:
  username: ZHJvbmUtcm9vdA==
  password: MTIzNA==
metadata:
  name: drone-docker-register-secret
  namespace: shendu-ops

二、使用Secret

1、在pipeline中定义外部drone secret资源关联k8s secret,以供调用

kind: pipeline
type: kubernetes
name: drone-build-demo
metadata:
  namespace: shendu-ops

---
kind: secret
name: username
get:
  path: drone-docker-register-secret
  name: username

---
kind: secret
name: password
get:
  path: drone-docker-register-secret
  name: password

2、通过from_seecret参数使用secret变量

kind: pipeline
type: kubernetes
name: sd.services.modules.demo
metadata:
  namespace: shendu-ops
steps:
- name: test
  image: busybox
  environment:
    USERNAME:
      from_secret: username
    PASSWORD:
      from_secret: password
  commands:
  - echo $USERNAME
  - echo $PASSWORD

三、限制使用

       默认情况下创建的k8s secret是对所有git repositories和build events有效的。我们可以通过metadata.annotations添加对secret的使用范围限制。

1、使用X-Drone-Repos限制那些git repositories可以访问secret。该值采用shell glob模式匹配,多个值用”,“隔开。

metadata:
  name: drone-docker-register-secret
  annotations:
    X-Drone-Repos: dev/demo,release/*

2、使用X-Drone-Events按事件限制访问secret

metadata:
  name: drone-docker-register-secret
  annotations:
    X-Drone-Events: push,tag