diff --git a/README.md b/README.md index 5c672fb..aabddf4 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,11 @@ This is all done in the `createPatch` function. The very first thing that is don From there the `existing-shares` configmap is iterated through in order to create a new sidecar spec for each entry. ### Getting the values to use in the json patch -For the sidecar spec we have to use the `filer-sidecar-injector-json` configmap object from the `das` namespace, this works as the model / structure that we will modify and inject into the `pod` spec. +For the sidecar spec we have to use the `filer-sidecar-injector-json` configmap object, this works as the model / structure that we will modify and inject into the `pod` spec. -We also need to get the bucket url, name, secret and access key for the particular svm. The bucket url is taken from the `filers-list` cm in the `das` namespace that is read in at injector startup. The bucket name is taken from the `existing-shares` cm and is put through the same hashing function used when creating the bucket in order to mount to the correct one. The secret and access keys are read in from a secret in the user's namespace. If any of these key values are empty then the sidecar will skip as the mounting would just fail. +We also need to get the bucket url, name, secret and access key for the particular svm. The bucket url is taken from the `filers-list` cm that is read in at injector startup. The bucket name is taken from the `existing-shares` cm and is put through the same hashing function used when creating the bucket in order to mount to the correct one. The secret and access keys are read in from a secret in the user's namespace. If any of these key values are empty then the sidecar will skip as the mounting would just fail. + +The configmaps should be located in the same namespace as the injector. ### Inserting the values Using the json template that we deep copy (to avoid modifying the same one over and over again and thus only getting the last changes), we substitute the values in and call various `addX` or `updateX` functions whose only purpose is to return a `[]patchOperation`. These are self explanatory but we will note any exceptional cases below. @@ -34,4 +36,4 @@ We also must limit the length of the names in the spec. There is a hard 64 chara We built in a [retry on failure](https://github.com/StatCan/filer-sidecar-injector/pull/13) command for `goofys` as it is currently unclear why goofys sometimes fails to mount, but in general having it retry a few times seems to fix things with more investigation being done in [BTIS-523](https://jirab.statcan.ca/browse/BTIS-523) ### Building and Deploying for testing -Create a PR with the `auto-deploy` label, and after the image has successfully pushed to the ACR, go to the `netapp` application in das argocd and turn off autosync and update the `filer-sidecar-injector` image tag with the pushed image. Start up a notebook and ensure it patches correctly. \ No newline at end of file +Create a PR with the `auto-deploy` label, and after the image has successfully pushed to the ACR, go to the `netapp` application in argocd and turn off autosync and update the `filer-sidecar-injector` image tag with the pushed image. Start up a notebook and ensure it patches correctly. \ No newline at end of file diff --git a/cmd/webhook.go b/cmd/webhook.go index 625d165..589a77d 100644 --- a/cmd/webhook.go +++ b/cmd/webhook.go @@ -500,7 +500,7 @@ func (whsvr *WebhookServer) serve(w http.ResponseWriter, r *http.Request) { func getSvmInfoList(client *kubernetes.Clientset) (map[string]SvmInfo, error) { klog.Infof("Getting filers list...") - filerListCM, err := client.CoreV1().ConfigMaps("das").Get(context.Background(), "filers-list", metav1.GetOptions{}) + filerListCM, err := client.CoreV1().ConfigMaps(os.Getenv("POD_NAMESPACE")).Get(context.Background(), "filers-list", metav1.GetOptions{}) if err != nil { klog.Errorf("Error occured while getting the filers list: %v", err) return nil, err