|
| 1 | +package com.boozallen.aiops.mda.generator; |
| 2 | + |
| 3 | +/*- |
| 4 | + * #%L |
| 5 | + * AIOps Foundation::AIOps MDA |
| 6 | + * %% |
| 7 | + * Copyright (C) 2021 Booz Allen |
| 8 | + * %% |
| 9 | + * This software package is licensed under the Booz Allen Public License. All Rights Reserved. |
| 10 | + * #L% |
| 11 | + */ |
| 12 | + |
| 13 | +import com.boozallen.aiops.mda.generator.common.PipelineEnum; |
| 14 | +import com.boozallen.aiops.mda.generator.common.VelocityProperty; |
| 15 | +import com.boozallen.aiops.mda.metamodel.AissembleModelInstanceRepository; |
| 16 | +import com.boozallen.aiops.mda.metamodel.element.Pipeline; |
| 17 | +import com.boozallen.aiops.mda.metamodel.element.python.MachineLearningPipeline; |
| 18 | +import org.apache.velocity.VelocityContext; |
| 19 | +import org.technologybrewery.fermenter.mda.generator.GenerationContext; |
| 20 | + |
| 21 | +import java.util.Map; |
| 22 | + |
| 23 | +public class S3LocalValuesKubernetesGenerator extends AbstractKubernetesGenerator { |
| 24 | + /*--~-~-~~ |
| 25 | + * Usages: |
| 26 | + * | Target | Template | Generated File | |
| 27 | + * |----------------------|--------------------------------------------------|------------------------------| |
| 28 | + * | s3LocalValuesFileV2 | deployment/localstack/localstack.values.yaml.vm | apps/${appName}/values.yaml | |
| 29 | + */ |
| 30 | + |
| 31 | + @Override |
| 32 | + public void generate(GenerationContext context) { |
| 33 | + VelocityContext vc = this.configureWithoutGeneration(context); |
| 34 | + AissembleModelInstanceRepository metamodelRepository = (AissembleModelInstanceRepository) context.getModelInstanceRepository(); |
| 35 | + Map<String, Pipeline> pipelineMap = metamodelRepository.getPipelinesByContext(metadataContext); |
| 36 | + for (Pipeline pipeline: pipelineMap.values()) { |
| 37 | + String pipelineType = pipeline.getType().getName(); |
| 38 | + if (PipelineEnum.DATA_FLOW.equalsIgnoreCase(pipelineType)) { |
| 39 | + // pyspark/spark pipelines |
| 40 | + vc.put(VelocityProperty.DATAFLOW_PIPELINES, true); |
| 41 | + } else if (PipelineEnum.MACHINE_LEARNING.equalsIgnoreCase(pipelineType)) { |
| 42 | + // training/inference pipelines |
| 43 | + vc.put(VelocityProperty.MACHINE_LEARNING_PIPELINES, true); |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + |
| 48 | + generateFile(context, vc); |
| 49 | + } |
| 50 | + |
| 51 | +} |
0 commit comments