-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
I successfully use iam-docker roles for containers running in a Rancher v1.6.x platform finally, but only with an old version v1.0.0, no luck with v1.1.0 and v1.2.0.
Please reference the issue #25 for details.
I don't want to miss the new features and need understand what's the problem between the commits from v1.0.0 to v1.1.0, because I got this issue start from v1.1.0
The only notable change is about new IAM_ROLE environment variable (26680c8)
Seems some bugs in below codes, which was added into v1.1.0
https://github.com/swipely/iam-docker/blame/master/src/docker/container_store.go#L177-L185
- iamRole, hasKey := container.Config.Labels[iamLabel]
- if !hasKey {
- return nil, fmt.Errorf("Unable to find label named '%s' for container: %s", iamLabel, id)
+ iamRole, hasLabel := container.Config.Labels[iamLabel]
+ if !hasLabel {
+ env := dockerClient.Env(container.Config.Env)
+ envRole := env.Get(iamEnvironmentVariable)
+ if envRole != "" {
+ iamRole = envRole
+ } else {
+ return nil, fmt.Errorf("Unable to find label named '%s' or environment variable '%s' for container: %s", iamLabel, iamEnvironmentVariable, id)
+ }Could you take a look?
Metadata
Metadata
Assignees
Labels
No labels