58.7. Kubernetes ConfigMaps Producer 示例
- ListConfigMaps:此操作列出了 configmaps
from("direct:list").
to("kubernetes-config-maps:///?kubernetesClient=#kubernetesClient&operation=listConfigMaps").
to("mock:result");
此操作会返回集群中的 ConfigMap 列表。
- listConfigMapsByLabels:此操作列出了标签选择的 configmaps。
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 列表。