@Override
    public List<ManifestSnippet> build(ManifestContext manifestContext, ServiceSpec serviceSpec) throws JsonProcessingException, HyscaleException {
        String podSpecOwner = ((String) manifestContext.getGenerationAttribute(ManifestGenConstants.POD_SPEC_OWNER));
        String serviceName = serviceSpec.get(HyscaleSpecFields.name,String.class);
        List<ManifestSnippet> envSnippets = new ArrayList<ManifestSnippet>();
        List<Agent> agents = getAgents(serviceSpec);
        if(agents == null){
            logger.debug("No Agents found for agents env builder");
            return  envSnippets;
        }
        int agentCount = 1;
        for (Agent agent : agents) {
            ManifestSnippet agentEnvSnippet = new ManifestSnippet();
            agentEnvSnippet.setKind(podSpecOwner);
            agentEnvSnippet.setPath("spec.template.spec.containers[" + agentCount + "].env");
            agentCount++;
            List<V1EnvVar> envVarList = new DecoratedArrayList<V1EnvVar>();
            if (agent.getProps() != null && !agent.getProps().isEmpty()) {
                String configMapName = agentManifestNameGenerator.generateConfigMapName(agent.getName(),serviceName);
                Props props = new Props();
                props.setProps(agent.getProps());
                envVarList.addAll(PodSpecEnvUtil.getPropEnv(props, configMapName));
            }
            if (agent.getSecrets() != null) {
                String secretName = agentManifestNameGenerator.generateSecretName(agent.getName(),serviceName);
                envVarList.addAll(PodSpecEnvUtil.getSecretEnv(agent.getSecrets(), secretName));
            }
            if (!envVarList.isEmpty()) {
                agentEnvSnippet.setSnippet(JsonSnippetConvertor.serialize(envVarList));
                envSnippets.add(agentEnvSnippet);
            }
        }
        return envSnippets;
    }
Pod spec manifest snippet builder for environment variables of agents.
<p>
This class is responsible for building manifest snippets related to Env variables
for agents.
</p>
manifest-generator/generator-services/src/main/java/io/hyscale/generator/services/utils/AgentEnvBuilder.java