public Map<String, Object> generatePodStartArgs(
      Resource resource, Map<String, String> groupProperties) {
    long memoryPerThread;
    long memory;
    long jvmHeapMemory;

    if (resource.getMemoryMb() > 0) {
      memory = resource.getMemoryMb();
    } else {
      memoryPerThread = Long.parseLong(checkAndGetProperty(groupProperties, MEMORY_PROPERTY));
      memory = memoryPerThread * resource.getThreadCount();
    }

    double jvmHeapRatio = Double.parseDouble(getExtraProperty(groupProperties, "jvm.heap.ratio"));
    jvmHeapMemory = (long) (memory * jvmHeapRatio);

    // point at amoro home in docker image
    String startUpArgs =
        String.format(
            "/entrypoint.sh optimizer %s %s",
            jvmHeapMemory, super.buildOptimizerStartupArgsString(resource));
    LOG.info("Starting k8s optimizer using k8s client with start command : {}", startUpArgs);

    String namespace = groupProperties.getOrDefault(NAMESPACE, "default");
    String image = checkAndGetProperty(groupProperties, IMAGE);
    String pullPolicy = checkAndGetProperty(groupProperties, PULL_POLICY);
    String pullSecrets = groupProperties.getOrDefault(PULL_SECRETS, "");
    String cpuLimitFactorString = groupProperties.getOrDefault(CPU_FACTOR_PROPERTY, "1.0");
    double cpuLimitFactor = Double.parseDouble(cpuLimitFactorString);
    int cpuLimit = (int) (Math.ceil(cpuLimitFactor * resource.getThreadCount()));

    List<LocalObjectReference> imagePullSecretsList =
        Arrays.stream(pullSecrets.split(";"))
            .map(secret -> new LocalObjectReferenceBuilder().withName(secret).build())
            .collect(Collectors.toList());

    String resourceId = resource.getResourceId();
    String groupName = resource.getGroupName();

    Map<String, Object> argsList = Maps.newHashMap();
    argsList.put(NAMESPACE, namespace);
    argsList.put(IMAGE, image);
    argsList.put(PULL_POLICY, pullPolicy);
    argsList.put(PULL_SECRETS, imagePullSecretsList);
    argsList.put(MEMORY_PROPERTY, memory);
    argsList.put("cpuLimit", cpuLimit);
    argsList.put("resourceId", resourceId);
    argsList.put("groupName", groupName);
    argsList.put("startUpArgs", startUpArgs);

    return argsList;
  }
Kubernetes Optimizer Container with Standalone Optimizer
amoro-ams/src/main/java/org/apache/amoro/server/manager/KubernetesOptimizerContainer.java