1
2
3
4
5
6
7
8
9
10
11
12
13
|
apiVersion: tekton.dev/v1alpha1
kind: Condition
metadata:
name: file-exists
spec:
params:
- name: "path"
resources:
- name: workspace
type: git
check:
image: alpine
script: 'test -f $(resources.workspace.path)/$(params.path)'
|
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: conditional-pipeline
spec:
resources:
- name: source-repo
type: git
params:
- name: "path"
default: "README.md"
tasks:
- name: if-condition-then-run
conditions:
- conditionRef: "file-exists"
params:
- name: "path"
value: "$(params.path)"
resources:
- name: workspace
resource: source-repo
taskRef:
name: my-task
|
kubectl get pipelineruns.tekton.dev
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
cancel-pipelinerun-r-67qsr Unknown Running 51m
|
kubectl patch PipelineRun cancel-pipelinerun-r-67qsr --type=merge -p '{"spec":{"status":"PipelineRunCancelled"}}'
|
kubectl get pipelineruns.tekton.dev
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
cancel-pipelinerun-r-67qsr False PipelineRunCancelled 52m 3s
|
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: pending-pipelinerun
spec:
params:
- name: pl-param-x
value: "100"
- name: pl-param-y
value: "500"
pipelineRef:
name: pending-pipeline
status: "PipelineRunPending"
|
kubectl get pipelineruns.tekton.dev
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
pending-pipelinerun Unknown PipelineRunPending
|
kubectl patch PipelineRun pending-pipelinerun --type=merge -p '{"spec":{"status":""}}'
|
kubectl get pipelineruns.tekton.dev
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
pending-pipelinerun Unknown Running 4s
|
kubectl get pipelineruns.tekton.dev
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
cancel-pipelinerun Unknown Running 9s
|
kubectl patch PipelineRun cancel-pipelinerun --type=merge -p '{"spec":{"status":"PipelineRunPending"}}'
Error from server (BadRequest): admission webhook "validation.webhook.pipeline.tekton.dev" denied the request: validation failed: invalid value: PipelineRun cannot be Pending after it is started: spec.status
|
apiVersion: v1
kind: ConfigMap
metadata:
name: approve-cm
data:
status: init
|
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: approve-task
spec:
workspaces:
- name: data
params:
- name: timeout
description: The max seconds to approve
type: string
default: "86400"
steps:
- name: sleep-a-while
image: bash:latest
script: |
#!/usr/bin/env bash
end=$((SECONDS+$(params.timeout)))
while [ $SECONDS -lt $end ]; do
name=$(cat "$(workspaces.data.path)"/status)
if [ "$name" = "success" ]
then
echo "approved!"
exit 0
elif [ "$name" = "refused" ]
then
echo "refused!"
exit 1
fi
sleep 2
echo "waiting"
done
echo "too long not to approve"
exit 1
|
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: something
annotations:
description: |
A simple task that do something
spec:
steps:
- name: do-something
image: bash:latest
script: |
#!/usr/bin/env bash
uname -a
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: approve-pipeline
spec:
workspaces:
- name: workspace
tasks:
- name: wait-for-approve
workspaces:
- name: data
workspace: workspace
taskRef:
name: approve-task
- name: do-something
taskRef:
name: something
runAfter:
- wait-for-approve
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: approve-pipelinerun
spec:
workspaces:
- name: workspace
configmap:
name: approve-cm
pipelineRef:
name: approve-pipeline
|
kubectl patch ConfigMap approve-cm --type=merge -p '{"data":{"status":"success"}}'
|
相关推荐
© 2023 Kubernetes中文社区 粤ICP备16060255号 版权说明 联系我们 广告投放 法律声明:本网站不隶属于谷歌或 Alphabet 公司 | kubernetes、kubernetes 标识及任何相关标志均为 Google LLC 公司的商标。
Kubernetes 作为 eBay 的统一云平台,统管了在线业务、大数据、搜索后台等多种异构应用。集群数量高达上百,其中的大型集群中,单个集群运行数千个微服务,数十万 Pod。不同类型的应用,针对流量管控的需求也各有不同,如何用一套统一的模型将各种流量管控需求统一起来是 eBay 多年来一直面临的挑战。 以云应用为例,为实现跨数据中心高可用的需求,生产应用的网络拓扑可以简要描述如下: eBay
以往有很多文章讲解 Istio 是如何做 Sidecar 注入的,但是没有讲解注入之后 Sidecar 工作的细节。本文将带大家详细了解 Istio 是如何将 Envoy 作为 Sidecar 的方式注入到应用程序 Pod 中,及 Sidecar 是如何做劫持流量的。 在讲解 Istio 如何将 Envoy 代理注入到应用程序 Pod 中之前,我们需要先了解以下几个概念: Sidecar 模式:容
Istio授权功能是基于角色的访问控制(RBAC),支持在Istio Mesh中,为服务提供名称空间级别,服务级别和方法级别的访问控制。它具有以下特点: 基于角色的语义,简单易用。 支持服务到服务,以及终端用户到服务授权。 灵活性的自定义属性支持,例如角色和角色绑定中的条件。 高性能,Istio授权在Envoy上本地执行。 高兼容性,本地支持HTTP,HTTPS和HTTP2,以及任何普通的TCP协
云原生月度动态 云原生是企业数字创新的最短路径。 《阿里云云原生每月动态》,从趋势热点、产品新功能、服务客户、开源与开发者动态等方面,为企业提供数字化的路径与指南。 趋势热点 🥇 阿里云参编业内首个代码大模型标准,通义灵码获 2023 AI4SE “银弹” 案例 阿里云作为 AI4SE 首批成员单位,与中国信息通信研究院等组织联合发起的《智能化软件工程技术和应用要求第一部分:代码大模型》(标准编号
回到顶部