-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deal with internally created ConfigMap mounted onto SPARK_CONF_DIR #216
Comments
@liyinan926 I was reading up on this topic, seems like one approach would be to leverage an init container that has access to both conf dirs, copying / merging files to the final destination (SPARK_CONF_DIR). Does that sound like a viable solution? Given that Spark recently removed support for init containers, is this something we could accomplish with the webhook? If you're not in a hurry, I'd like to try this one out (maybe after spark 2.4.0 comes out?) as a ramp-up issue. |
@aditanase sorry for not responding sooner. I think that's a viable approach. And yes the admission webhook can be used to inject an init-container for doing that. Thanks for being willing to take on this. Looking forward to your implementation! |
No worries. What are your thoughts on apache/spark#22146? |
The pod template support will make the webhook obsolete for users using Spark 3.0 (assuming that's the version in which the PR will get into). For users who use Spark 2.4 and earlier, the webhook is still needed. So I wouldn't say it's disruptive, but it definitely requires some changes to the operator to make use of that. |
@aditanase in the available timeline I don't see it disruptive - if webhook wont be needed for some users better it is. But to support earlier versions one would need webhook in the operator. |
Hey @aditanase @liyinan926 @mrow4a, wondering what's the plan to resolve this? One use case is to provide |
The approach proposed above of using an init-container to copy the files in |
Thanks @liyinan926 ! I'll dig a bit and see if I can help. |
I setup an init-container and mount spark generated Volume(based on a configmap) and the operator generated Volume(based on a configmap) to it.
Then I do a
It throws error:
This is by design according to k8s(kubernetes/kubernetes#62099, https://github.com/kubernetes/kubernetes/pull/58720/files). A volume created from ConfigMap will be read only. So it won't work out continuing this direction. Another idea is to patch the spark generated ConfigMap with our ConfigMap(I'll need to figure out how), or we use |
@liyinan926 To follow up on the solution, I propose we patch driver/executor Pod's ConfigMaps to mount files defined in |
@wweic how about patching the internally created ConfigMap to append data stored in the user-specified ConfigMap (defined in |
@liyinan926 Thanks for reply! I'm open to this option as well. Let me double check if we have access to full ConfigMap content in |
@liyinan926 I looked at https://github.com/GoogleCloudPlatform/spark-on-k8s-operator/blob/3df703098970fbf7326ed4296470ea4c3688dec8/pkg/webhook/patch.go#L307-L326. We can patch the ConfigMap here. But we need to call apiserver to get actual spec for 2 ConfigMaps for the following reasons:
I looked around in the codebase, seems like we don't have a client obj to apiserver yet? Do you think we should add one? Or for the subpath approach, we don't need to retrieve the actual ConfigMap spec, just need to patch VolumeMounts. here is a quick patch I tried, I now have Appreciate your advice to move forward. |
With the |
@liyinan926 Yes, currently when we mount a ConfigMap to a directory, every key in the ConfigMap will become a file in the directory automatically, named by the key name. Using subPath, we have to mount each key in ConfigMap manually. Example subPath spec:
|
@liyinan926 What do you think about the |
Hi, from the GuideDoc SPARK_CONF_DIR by default is set as "/opt/spark/conf" and will be modified to "/etc/spark/conf" when we specify spec.sparkConfigMap. And at the meanwhile "--properties-file /opt/spark/conf/spark.properties" is added automatically. So it seems the internal spark configs and the one under /etc/spark/conf will both be applied but the former one might be override if there are duplicated parameters. This is also what I observed in my experimentations, am I understanding correctly? Thanks! |
We are running into an issue that may potentially be solved by the proposed Is this issue being worked on actively or planned to be resolved soon? |
@jaesong-mongo I have a quick patch here, pending @liyinan926's comment, I can send a more detailed RFC about it. |
Would love to know the status of this issue. We build spark docker images from scratch for internal use at my company, and include a |
Hi all, I would like to know the status of this. My use case is also same as #786 where I want to have my Spark application talk to AWS glue metastore. Can someone please guide me whether we can set the spark-hive-site using "SparkConf" or any other way? |
@dfarr @batCoder95 We have a simple implementation here that we use internally, based on the changes @wweic suggested, iterating over the configmap keys. We didn't add a PR as we weren't sure it met proper code style / architecture, but it seems to work well for our use case. I'll be happy to PR this if it can help. |
Hi @bbenzikry, This is really really helpful of you. I'll try out the sample implementation that you have mentioned immediately and let you know if I face any issues :) Thanks a ton for this guidance :) |
@bbenzikry I deployed this image, it dosn't support kerberos authentication,is there any solution?Thanks! |
Hi @joanjiao2016, the example image is based on the operator version available at that time - it hasn't been updated with any upstream changes ( specifically for kerberos, I saw there's still a PR open, so I really don't know the status ) @liyinan926 As this is getting some traction, do you want me to PR so it can be available upstream? |
Hi all, |
For what it's worth, we've open sourced a fully contained build and docker image for Spark 3.1.1 (with the kubernetes deps), Hadoop 3.2.0, Hive 2.3.7, and this glue client (largely building on @bbenzikry's work): |
Hi All, I am trying to make spark operator work with glue meta store since last 2 days without success. I am slightly new to this domain. Can someone please provide a bit more detailed steps of any solution/workarounds of this problem? I tried @jpugliesi image for my sparkapplication but my jobs are still failing to with MetaException
|
Hi @jpugliesi - just wanted to say I love this. |
Hello Guys, Any workaround to this? Thank you |
@wweic do we have any traction on this? . Seems I am facing similar issue when I wanted to add few more spark conf properties to spark.properties via the configMap but though the configMap is getting mounted and adding SPARK_CONF_DIR env variable but to /etc/spark/conf folder and the driver startup log shows that its still using /opt/spark/conf/properties file instead of the configMap file path One more observation, though SPARK_CONF_DIR is set to /etc/spark/conf in the driver pod but due to the following driver's args: which is by default loading /opt/spark/conf/spark.properties hence the configMap mounted file will not be loaded. example
any directions are highly appreciated. Thanks |
@wweic @bbenzikry is it possible that you could start a PR with the changes that you guys have made to get this working? We have been wanting to try this approach but do not want to use a very old version of the operator. |
This issue is almost 4 years old. And while several ideas & solutions have been put forward and merged in other repositories, none of them made it to the upstream of this repository. |
@Sudeepam97 @tahesse If the current implementation was not problematic I would assume one of my past iterations would get an approval here, which I've requested a response to several times in the course of this thread. We have been using our own version of the operator in production since this started - so while I personally consider any PR as constructive, I think most participants of the thread will only benefit from such a PR if it is:
Were I a maintainer I would've tried to push this through quickly, so I'm sorry in advance for everyone who has been tagging me and did not receive a prompt answer. If anyone does decide to push a proper and extensive PR through, I'll be willing to help with CR for this, as I remember we did encounter some edge cases in our private fork |
@bbenzikry Thank you for your offer in regards the CR. I have read through the PR from apache/spark mentioned in the first post of this issue. I tried to grasp the introduced changes that are incompatible with how to spark-operator on k8s was designed for
Issue on k8s-on-spark-operator side:
apiVersion: v1
kind: ConfigMap
metadata:
name: spark-op-conf
namespace: sparkapps
data:
spark-hadoop.conf: |
spark.hadoop.fs.s3a.endpoint http://minio:9000
spark.hadoop.fs.s3a.aws.credentials.provider org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider
spark.hadoop.fs.s3a.access.key accesskey
spark.hadoop.fs.s3a.secret.key secretkey
spark.hadoop.fs.s3a.path.style.access true
spark.hadoop.fs.s3a.impl org.apache.hadoop.fs.s3a.S3AFileSystem
spark.hadoop.fs.s3a.bucket.all.committer.magic.enabled true
spark-metrics.conf: |
spark.metrics.conf.*.sink.graphite.class org.apache.spark.metrics.sink.GraphiteSink
spark.metrics.conf.*.sink.graphite.host spark-dashboard-influx.spark-operator
spark.metrics.conf.*.sink.graphite.port 1337
spark.metrics.conf.*.source.jvm.class org.apache.spark.metrics.source.JvmSource
spark.metrics.appStatusSource.enabled true
How does spark-on-k8s-operator handle Given all the collected information, I'd like to move forward with the following design:
My reasoning does not consider runtime related order of execution issues, I'm glad for helpful pointers in that regards. So far, I roughly understand that changing the Based on my findings, I will try to draft a first version of a PR which I will test for my use cases and the edge cases I can think of. Disclaimer: must not be complete, feel free to add what you think I missed. |
@tahesse Thanks for your thoughts - I wouldn't put that much emphasis on my specific point on best practices, I want this to be something that is properly maintained, has the proper follow-ups and the right tests to alert to future issues while accommodating several needs that were raised here and in other relevant issues. I didn't quite understand how your suggestion aligns with some of what we're trying to achieve besides patching spark.properties specifically. Adding files on the same folder / mount is important for dependencies such as hive-site.xml - which the subpath approach solves inherently and was the path of least resistance when we first encountered it due to the read only way the internal CM is mounted by default and those pesky constants in the spark codebase. I will say that for me, from the user / DX perspective, the optimal approach should include:
If I understand correctly, and please do correct me if I'm wrong, your solution touches on 4,5 and some of 2 I would love to brainstorm a bit more in a private chat so we can correlate efforts and see if we can create the right PRs as required for overarching goals surrounding the original issue while maintaining compatibility and allowing these items to be gradually implemented ( I'm beni on Keybase ) |
@bbenzikry Sorry, I don't have keybase but I agree that a private chat for brainstorming makes more sense. Let me see if I can create an account for this very purpose.
I think the current design with the mutating webhook will not work for updating
Out of scope at this point because IMO it is incompatible with the spark semantics and complicates things at this early stage. However, a single
Out of scope at this time because the spec
Yes!
For a second iteration, yes. I'd drop it in the first iteration to not further complicate things.
I will try to document everything I learned and add to the |
@yuchaoran2011 You're mentioned as maintainer in the helm chart. Any points from your side regarding @bbenzikry valid concerns? |
…d onto SPARK_CONF_DIR
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
this is still broken... |
PR apache/spark#20669 introduced a ConfigMap carrying Spark configuration properties in a file for the driver. The environment variable SPARK_CONF_DIR is set to point to the mount path /opt/spark/conf of the ConfigMap. This is in conflict with what spec.sparkConfigMap is designed to do. We need to find a solution to work with the internally created and mounted ConfigMap.
The text was updated successfully, but these errors were encountered: