我已经在K8S集群中部署了微服务。 以下是“舵图”详细信息-
CHART_NAME = eric-bss-sd-dxp-adaptation-staging,CHART_VERSION = 1.0.262,NAMESPACE = anindya-ns
现在我想编写一个Python脚本,它将获取此版本的图表(即1.0.262)
如果您以前曾就此要求进行过工作或提出了建议,请提供帮助
答案 0 :(得分:0)
我可以给您一些步骤,可能会有所帮助。
创建服务/吊舱/部署...,如下所示
SQL> with
2 -- sample data
3 t1 (pid, name) as
4 (select 123, 'xyz' from dual union all
5 select 234, 'pqr' from dual
6 ),
7 t2 (id, name, start_date, end_date) as
8 (select 1, 'xyz', date '2020-01-01', date '2020-07-20' from dual union all
9 select 2, 'xyz', date '2020-02-01', date '2020-05-30' from dual union all
10 select 3, 'xyz', date '2020-06-30', date '2020-07-30' from dual union all
11 --
12 select 1, 'pqr', date '2020-04-30', date '2020-09-30' from dual union all
13 select 2, 'pqr', date '2020-05-30', date '2020-09-30' from dual union all
14 select 3, 'pqr', date '2020-06-30', date '2020-07-01' from dual
15 )
16 select a.pid,
17 x.name,
18 max(x.start_date) start_date,
19 max(x.end_date) end_date
20 from t1 a join
21 (
22 -- start_date: always for the lowest T2.ID value row
23 -- end_date : always for the highest T2.ID value row
24 select b.name,
25 first_value(b.start_date) over (partition by b.name order by b.id ) start_date,
26 first_value(b.end_date) over (partition by b.name order by b.id desc) end_date
27 from t2 b
28 ) x
29 on a.name = x.name
30 group by a.pid,
31 x.name
32 order by a.pid;
PID NAME START_DATE END_DATE
---------- ---- ---------- ----------
123 xyz 01/01/2020 07/30/2020
234 pqr 04/30/2020 07/01/2020
SQL>
您可以在任何名称,全名,标签...等地方使用.Chart.Version。
使用kubectl命令来获取yaml文件,例如:-https://github.com/kubernetes/kubernetes/issues/24873
然后编写您自己的python代码以读取它,获取聊天版本。
请参考以下链接 https://github.com/kubernetes-client/python https://pypi.org/project/kube/