{"id":207285,"date":"2025-07-08T08:09:35","date_gmt":"2025-07-08T00:09:35","guid":{"rendered":"https:\/\/server.hk\/cnblog\/207285\/"},"modified":"2025-07-08T08:09:35","modified_gmt":"2025-07-08T00:09:35","slug":"%e5%a6%82%e4%bd%95%e4%bc%a0%e9%80%92%e6%88%96%e8%a7%a3%e6%9e%90%e4%bb%8e-argo-%e5%b7%a5%e4%bd%9c%e6%b5%81%e7%94%9f%e6%88%90%e7%9a%84%e8%b5%84%e6%ba%90%e4%ba%8b%e4%bb%b6%e6%ba%90%e4%b8%bb%e4%bd%93","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/207285\/","title":{"rendered":"\u5982\u4f55\u4f20\u9012\u6216\u89e3\u6790\u4ece argo \u5de5\u4f5c\u6d41\u751f\u6210\u7684\u8d44\u6e90\u4e8b\u4ef6\u6e90\u4e3b\u4f53\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<p>\u5f53\u524d\u4f4d\u7f6e\uff1a <span>&gt;<\/span> <span>&gt;<\/span> <span>&gt;<\/span> <span>&gt;<\/span> <span>\u5982\u4f55\u4f20\u9012\u6216\u89e3\u6790\u4ece argo \u5de5\u4f5c\u6d41\u751f\u6210\u7684\u8d44\u6e90\u4e8b\u4ef6\u6e90\u4e3b\u4f53\uff1f<\/span><\/p>\n<p><span>\u6765\u6e90\uff1astackoverflow<\/span><br \/>\n<span>2024-04-21 13:39:34<\/span><br \/>\n<span><i><\/i>0\u6d4f\u89c8<\/span><br \/>\n<span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>IT\u884c\u4e1a\u76f8\u5bf9\u4e8e\u4e00\u822c\u4f20\u7edf\u884c\u4e1a\uff0c\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u66f4\u5feb\uff0c\u4e00\u65e6\u505c\u6b62\u4e86\u5b66\u4e60\uff0c\u5f88\u5feb\u5c31\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u6240\u4ee5\u6211\u4eec\u9700\u8981\u8e0f\u8e0f\u5b9e\u5b9e\u7684\u4e0d\u65ad\u5b66\u4e60\uff0c\u7cbe\u8fdb\u81ea\u5df1\u7684\u6280\u672f\uff0c\u5c24\u5176\u662f\u521d\u5b66\u8005\u3002\u4eca\u5929\u7ed9\u5927\u5bb6\u6574\u7406\u4e86\u300a\u5982\u4f55\u4f20\u9012\u6216\u89e3\u6790\u4ece argo \u5de5\u4f5c\u6d41\u751f\u6210\u7684\u8d44\u6e90\u4e8b\u4ef6\u6e90\u4e3b\u4f53\uff1f\u300b\uff0c\u804a\u804a\uff0c\u6211\u4eec\u4e00\u8d77\u6765\u770b\u770b\u5427\uff01<\/p>\n<p> \u95ee\u9898\u5185\u5bb9<br \/>\n <\/p>\n<p>\u6211\u6709\u4e00\u4e2a\u8d44\u6e90\u4f20\u611f\u5668\u6765\u89e6\u53d1\u4e00\u4e2a\u5de5\u4f5c\u6d41\u7a0b\uff0c\u8be5\u5de5\u4f5c\u6d41\u7a0b\u62a5\u544a\u5bfc\u81f4\u8be5\u4e8b\u4ef6\u7684\u539f\u59cb\u5de5\u4f5c\u6d41\u7a0b &#8211; \u4e00\u79cd\u8bb0\u5f55\u5668\u3002 \u5728\u4f20\u611f\u5668\u7684\u53c2\u6570\u4e2d\uff0c\u6211\u60f3\u83b7\u53d6\u539f\u59cb\u5de5\u4f5c\u6d41\u7a0b\u7684\u4e3b\u4f53\uff0c\u4ee5\u4fbf\u4ece\u4e2d\u63d0\u53d6\u67d0\u4e9b\u503c &#8211; \u76ee\u524d\u6211\u8ba1\u5212\u7b80\u5355\u5730\u5c06\u6574\u4e2a json \u4f5c\u4e3a\u8f93\u5165\u5b57\u7b26\u4e32\u4f20\u9012\u3002<\/p>\n<p>\u5f53\u5de5\u4f5c\u6d41\u7a0b\u4e0d\u5e73\u51e1\u5e76\u4e14\u5305\u542b\u53d8\u91cf\u6587\u4ef6\u65f6\uff0c\u5c31\u4f1a\u51fa\u73b0\u95ee\u9898\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre>apiversion: argoproj.io\/v1alpha1\nkind: workflow\nmetadata:\n  generatename: test-es-workflow-\n  labels:\n    class: dummy-in\nspec:\n  entrypoint: whalesay\n  arguments:\n    parameters:\n      - name: message\n        value: hello world\n  templates:\n    - name: whalesay\n      inputs:\n        parameters:\n          - name: message\n      container:\n        image: docker\/whalesay:latest\n        command: [cowsay]\n        args: [\"{{inputs.parameters.message}}\"]<\/pre>\n<p>\u5f53\u53d1\u751f\u8fd9\u79cd\u60c5\u51b5\u65f6\uff0c\u89e6\u53d1\u7684\u5de5\u4f5c\u6d41\u7a0b\uff1a<\/p>\n<pre>apiVersion: argoproj.io\/v1alpha1\nkind: Sensor\nmetadata:\n  name: demo-sensor\nspec:\n  template:\n    serviceAccountName: operate-workflow-sa\n  dependencies:\n    - name: test-dep-sensor\n      eventSourceName: demo-wf-submit\n      eventName: demo-log\n  triggers:\n    - template:\n        name: argo-workflow\n        k8s:\n          operation: create\n          source:\n            resource:\n              apiVersion: argoproj.io\/v1alpha1\n              kind: Workflow\n              metadata:\n                generateName: demo-log-\n              spec:\n                entrypoint: demolog\n                arguments:\n                  parameters:\n                    - name: body\n                      value: hello world\n                templates:\n                - name: demolog\n                  inputs:\n                    parameters:\n                      - name: body\n                  container:\n                    image: demolog:latest\n                    imagePullPolicy: \"Always\"\n                    command: [\/app\/demoapp.py]\n                    args: [\"-j\", \"{{inputs.parameters.body}}\"]\n          parameters:\n            - src:\n                dependencyName: test-dep-sensor\n                dataKey: body\n                value: wow! a default value\n              dest: spec.arguments.parameters.0.value\n      retryStrategy:\n        steps: 3<\/pre>\n<p>\u5931\u8d25\uff0c\u5e76\u663e\u793a\u6d88\u606f <code>message\uff1a\u65e0\u6548\u89c4\u8303\uff1atemplates.demolog\uff1a\u65e0\u6cd5\u89e3\u6790 {{inputs.parameters.message}}<\/code><\/p>\n<p>\u5982\u679c\u5de5\u4f5c\u6d41\u4e0d\u5305\u542b\u4efb\u4f55\u53d8\u91cf\uff08{{}} \u4e2d\u6ca1\u6709\u5305\u542b\u4efb\u4f55\u53d8\u91cf\uff09\uff0c\u5219\u89e6\u53d1\u7684\u5de5\u4f5c\u6d41\u5c06\u6309\u9884\u671f\u6267\u884c\u3002<\/p>\n<p>\u6211\u5f88\u4e50\u610f\u5f04\u6e05\u695a\u5982\u4f55\u83b7\u5f97\u4ee5\u4e0b\u4efb\u4f55\u6216\u6240\u6709\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<ol>\n<li>\u8b66\u544a\u53d8\u91cf\u65e0\u6cd5\u89e3\u6790\u5e76\u66ff\u6362 null<\/li>\n<li>\u4e0d\u8981\u89e3\u6790\u4e8b\u4ef6\u6b63\u6587\u4e2d\u7684\u53d8\u91cf\uff0c\u5373\u5c06\u5176\u5448\u73b0\u4e3a\u7eaf\u5b57\u7b26\u4e32<\/li>\n<li>\u5728\u521b\u5efa\u4e8b\u4ef6\u65f6\u89e3\u6790\u53d8\u91cf\uff0c\u4ee5\u4fbf\u53ef\u4ee5\u89e3\u6790\u6b63\u6587<\/li>\n<\/ol>\n<p>\u73af\u5883\uff1a \u5e93\u4f2f\u5185\u7279\u65af\uff1av1.20.15\uff1b \u963f\u5c14\u6208\uff1av3.2.9\uff1b \u963f\u5c14\u6208\u6d3b\u52a8\uff1av1.6.3<\/p>\n<p> <\/p>\n<h2>\u6b63\u786e\u7b54\u6848<\/h2>\n<p> <\/p>\n<p>\u6211\u5f00\u53d1\u4e86\u7c7b\u578b 2 \u7684\u7b54\u6848\uff0c\u5373\u6e32\u67d3\u7528\u53cc\u82b1\u62ec\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u3002 \u5b83\u5e76\u4e0d\u4f18\u96c5\uff0c\u4f46\u4f3c\u4e4e\u6709\u6548\uff1a<\/p>\n<p>\u4f7f\u7528 jq \u4fee\u8865\u4f20\u611f\u5668\u7684\u4f9d\u8d56\u9879\u90e8\u5206\uff0c\u4ee5\u7528\u5176\u4ed6\u5185\u5bb9\u66ff\u6362\u53cc\u82b1\u62ec\u53f7\uff08\u6211\u9009\u62e9\u201c%%\u201d\uff09<\/p>\n<pre>dependencies:\n    - name: test-dep-sensor\n      eventSourceName: demo-wf-submit\n      eventName: demo-log\n      transform:\n        jq: 'walk( if type==\"string\" then gsub(\"{{\";\"%%\") else . end ) | walk( if type==\"string\" then gsub(\"}}\";\"%%\") else . end )'<\/pre>\n<p>\u5176\u4ed6\u4fe1\u606f\uff1a<\/p>\n<\/p>\n<p>\u672c\u7bc7\u5173\u4e8e\u300a\u5982\u4f55\u4f20\u9012\u6216\u89e3\u6790\u4ece argo \u5de5\u4f5c\u6d41\u751f\u6210\u7684\u8d44\u6e90\u4e8b\u4ef6\u6e90\u4e3b\u4f53\uff1f\u300b\u7684\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\u5566\uff0c\u4f46\u662f\u5b66\u65e0\u6b62\u5883\uff0c\u60f3\u8981\u4e86\u89e3\u5b66\u4e60\u66f4\u591a\u5173\u4e8eGolang\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u5173\u6ce8\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u524d\u4f4d\u7f6e\uff1a &gt; &gt; &#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-207285","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/207285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=207285"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/207285\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=207285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=207285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=207285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}