Skip to content

Commit 2c8cf82

Browse files
A tag added per container on the DeploymentResource to identify k8s name
1 parent b4fd273 commit 2c8cf82

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/java/org/alien4cloud/plugin/kubernetes/modifier/KubernetesAdapterModifier.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public class KubernetesAdapterModifier extends AbstractKubernetesModifier {
6565
public static final String A4C_KUBERNETES_ADAPTER_MODIFIER_TAG = "a4c_kubernetes-adapter-modifier";
6666
/** This tag is added to any K8S resource, it's value will target the node name it replace in the original topology. */
6767
public static final String A4C_KUBERNETES_ADAPTER_MODIFIER_TAG_REPLACEMENT_NODE_FOR = A4C_KUBERNETES_ADAPTER_MODIFIER_TAG + "_ReplacementNodeFor";
68+
public static final String A4C_KUBERNETES_ADAPTER_MODIFIER_TAG_CONTAINER = A4C_KUBERNETES_ADAPTER_MODIFIER_TAG + "_Container_";
6869

6970
public static final String K8S_TYPES_KUBEDEPLOYMENT = "org.alien4cloud.kubernetes.api.types.KubeDeployment";
7071
public static final String K8S_TYPES_KUBECONTAINER = "org.alien4cloud.kubernetes.api.types.KubeContainer";
@@ -1006,10 +1007,10 @@ private static String serializePropertyValue(AbstractPropertyValue value) {
10061007
}
10071008

10081009
private void manageContainer(KubernetesModifierContext context, NodeTemplate containerNode, FunctionEvaluatorContext functionEvaluatorContext, Map<String, List<String>> serviceIpAddressesPerDeploymentResource) { {
1010+
String containerK8sName = generateUniqueKubeName(context.getFlowExecutionContext(), containerNode.getName());
10091011

10101012
// build and set a unique name for the container
1011-
setNodePropertyPathValue(context.getCsar(), context.getTopology(), containerNode, "container.name",
1012-
new ScalarPropertyValue(generateUniqueKubeName(context.getFlowExecutionContext(), containerNode.getName())));
1013+
setNodePropertyPathValue(context.getCsar(), context.getTopology(), containerNode, "container.name", new ScalarPropertyValue(containerK8sName));
10131014

10141015
// exposed enpoint ports
10151016
manageContainerEndpoints(context.getCsar(), context.getTopology(), containerNode, context.getFlowExecutionContext());
@@ -1020,7 +1021,9 @@ private void manageContainer(KubernetesModifierContext context, NodeTemplate con
10201021
NodeTemplate controllerResource = context.getReplacements().get(controllerNode.getName());
10211022
Map<String, AbstractPropertyValue> controllerResourceNodeProperties = context.getYamlResources().get(controllerResource.getName());
10221023

1023-
// if the container if of type ConfigurableDockerContainer we must create a ConfigMapFactory per config_settings entry
1024+
setNodeTagValue(controllerResource, A4C_KUBERNETES_ADAPTER_MODIFIER_TAG_CONTAINER + containerNode.getName(), containerK8sName);
1025+
1026+
// if the container if of type ConfigurableDockerContainer we must create a ConfigMapFactory per config_settings entry
10241027
// a map of input_prefix -> List<NodeTemplate> (where NodeTemplate is an instance of ConfigMapFactory)
10251028
// we can have several configMapFactory using the same prefix
10261029
Map<String, List<NodeTemplate>> configMapFactories = Maps.newHashMap();

0 commit comments

Comments
 (0)