def build_config(self) -> dict:
        """ build config for sparkoperator api
        [ref]: https://github.com/GoogleCloudPlatform/spark-on-k8s-operator

        Returns:
            dict: part of sparkoperator body
        """
        config = {
            'cores': self.cores,
            'memory': self.memory,
        }
        if self.instances:
            config['instances'] = self.instances
        if self.core_limit:
            config['coreLimit'] = self.core_limit
        if self.envs and len(self.envs) > 0:
            config['env'] = [{
                'name': k,
                'value': v
            } for k, v in self.envs.items()]
        if self.volume_mounts and len(self.volume_mounts) > 0:
            config['volumeMounts'] = self.volume_mounts

        return config
 build config for sparkoperator api
        [ref]: https://github.com/GoogleCloudPlatform/spark-on-k8s-operator

        Returns:
            dict: part of sparkoperator body
        
web_console_v2/api/fedlearner_webconsole/sparkapp/schema.py