69.7. Kubernetes ConfigMap Producer 示例
- listConfigMaps:此操作列出了 configmaps
from("direct:list"). to("kubernetes-config-maps:///?kubernetesClient=#kubernetesClient&operation=listConfigMaps"). to("mock:result");
此操作返回来自集群的 ConfigMap 列表。
- listConfigMapsByLabels :此操作列出了按标签选择的 configmap。
from("direct:listByLabels").process(new Processor() { @Override public void process(Exchange exchange) throws Exception { Map<String, String> labels = new HashMap<>(); labels.put("key1", "value1"); labels.put("key2", "value2"); exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_CONFIGMAPS_LABELS, labels); } }); to("kubernetes-config-maps:///?kubernetesClient=#kubernetesClient&operation=listConfigMapsByLabels"). to("mock:result");
此操作使用标签选择器(带有 key1 和 key2,值为 value1 和 value2)从集群中返回 ConfigMap 列表。