Skip to content

Commit

Permalink
fix: change order of resource-names being prefixed
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsystem committed Dec 19, 2024
1 parent e171026 commit 8bd89e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ If the filename ends with `.url` suffix, the content will be processed as a URL
| `FOLDER_ANNOTATION` | The annotation the sidecar will look for in configmaps to override the destination folder for files. The annotation _value_ can be either an absolute or a relative path. Relative paths will be relative to `FOLDER`. | false | `k8s-sidecar-target-directory` | string |
| `NAMESPACE` | Comma separated list of namespaces. If specified, the sidecar will search for config-maps inside these namespaces. It's also possible to specify `ALL` to search in all namespaces. | false | namespace in which the sidecar is running | string |
| `RESOURCE` | Resource type, which is monitored by the sidecar. Options: `configmap`, `secret`, `both` | false | `configmap` | string |
| `RESOURCE_NAME` | Comma separated list of resource names, which are monitored by the sidecar. Items can be prefixed by the namespace and the resource type. E.g. `namespace/resource-name` or `secret/namespace/resource-name`. Setting this will result `method` set to `WATCH` being treated as `SLEEP` | false | - | string |
| `RESOURCE_NAME` | Comma separated list of resource names, which are monitored by the sidecar. Items can be prefixed by the namespace and the resource type. E.g. `secret/resource-name` or `namespace/secret/resource-name`. Setting this will result `method` set to `WATCH` being treated as `SLEEP` | false | - | string |
| `METHOD` | If `METHOD` is set to `LIST`, the sidecar will just list config-maps/secrets and exit. With `SLEEP` it will list all config-maps/secrets, then sleep for `SLEEP_TIME` seconds. Anything else will continuously watch for changes (see https://kubernetes.io/docs/reference/using-api/api-concepts/#efficient-detection-of-changes). | false | - | string |
| `SLEEP_TIME` | How many seconds to wait before updating config-maps/secrets when using `SLEEP` method. | false | `60` | integer |
| `REQ_URL` | URL to which send a request after a configmap/secret got reloaded | false | - | URI |
Expand Down
4 changes: 2 additions & 2 deletions src/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def list_resources(label, label_value, target_folder, request_url, request_metho
if namespace != "ALL" and resource_name:
for rn in resource_name.split(","):
splitted_rn = list(reversed(rn.split("/")))
if len(splitted_rn) == 3 and splitted_rn[2] != resource:
if len(splitted_rn) == 3 and splitted_rn[2] != namespace:
continue
if len(splitted_rn) == 2 and splitted_rn[1] != namespace:
if len(splitted_rn) == 2 and splitted_rn[1] != resource:
continue
resource_names.append(splitted_rn[0])

Expand Down

0 comments on commit 8bd89e6

Please sign in to comment.