Skip to content

Commit

Permalink
A tag added per container on the DeploymentResource to identify k8s name
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienLaurent committed Dec 6, 2019
1 parent b4fd273 commit 2c8cf82
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class KubernetesAdapterModifier extends AbstractKubernetesModifier {
public static final String A4C_KUBERNETES_ADAPTER_MODIFIER_TAG = "a4c_kubernetes-adapter-modifier";
/** This tag is added to any K8S resource, it's value will target the node name it replace in the original topology. */
public static final String A4C_KUBERNETES_ADAPTER_MODIFIER_TAG_REPLACEMENT_NODE_FOR = A4C_KUBERNETES_ADAPTER_MODIFIER_TAG + "_ReplacementNodeFor";
public static final String A4C_KUBERNETES_ADAPTER_MODIFIER_TAG_CONTAINER = A4C_KUBERNETES_ADAPTER_MODIFIER_TAG + "_Container_";

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

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

// build and set a unique name for the container
setNodePropertyPathValue(context.getCsar(), context.getTopology(), containerNode, "container.name",
new ScalarPropertyValue(generateUniqueKubeName(context.getFlowExecutionContext(), containerNode.getName())));
setNodePropertyPathValue(context.getCsar(), context.getTopology(), containerNode, "container.name", new ScalarPropertyValue(containerK8sName));

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

// if the container if of type ConfigurableDockerContainer we must create a ConfigMapFactory per config_settings entry
setNodeTagValue(controllerResource, A4C_KUBERNETES_ADAPTER_MODIFIER_TAG_CONTAINER + containerNode.getName(), containerK8sName);

// if the container if of type ConfigurableDockerContainer we must create a ConfigMapFactory per config_settings entry
// a map of input_prefix -> List<NodeTemplate> (where NodeTemplate is an instance of ConfigMapFactory)
// we can have several configMapFactory using the same prefix
Map<String, List<NodeTemplate>> configMapFactories = Maps.newHashMap();
Expand Down

0 comments on commit 2c8cf82

Please sign in to comment.