Skip to content
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

Not able to enable video recording #397

Closed
buettner123 opened this issue Oct 9, 2023 · 8 comments
Closed

Not able to enable video recording #397

buettner123 opened this issue Oct 9, 2023 · 8 comments
Milestone

Comments

@buettner123
Copy link

buettner123 commented Oct 9, 2023

Hi there,

I'm currently evaluating moon for running our tests in kubernetes and struggling to get the video recording running.

I'm using the moon2 helm chart with version 2.5.4 on an amazon eks cluster.

What I did:

  • setup a bucket
  • create an IAM policy for the bucket access:
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "s3:List*",
        "s3:Get*",
        "s3:Put*"
      ],
      "Effect": "Allow",
      "Resource": [
        "arn:aws:s3:::${TargetBucket}/*",
        "arn:aws:s3:::${TargetBucket}"
      ]
    }
  ]
}
  • allow the service account to assume the IAM policy by a role with the attached policy from above and the following trust relationship (working fine for other helm charts with the same setup):
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Federated": "arn:aws:iam::xxxxx:oidc-provider/oidc.eks.eu-central-1.amazonaws.com/id/xxxxxx"
            },
            "Action": "sts:AssumeRoleWithWebIdentity",
            "Condition": {
                "StringLike": {
                    "oidc.eks.eu-central-1.amazonaws.com/id/xxxxxx:sub": [
                        "system:serviceaccount:moon:aerokube-moon",
                        "system:serviceaccount:moon-*:aerokube-moon"
                    ]
                }
            }
        }
    ]
}
  • configure the video recording in the values file for the helm chart:
configs:
  default:
    serviceAccountName: aerokube-moon
    storage:
      bucket: "xxxxxx" # real bucket name masked
      endpoint: "https://s3.eu-central-1.amazonaws.com"
quota:
  moon: null
  test:
    namespace: moon-test
    password: ''
    serviceAccountName: aerokube-moon
  • configure video recording by setting the capabilities:
    desiredCapabilities.setCapability("enableVideo", true)
    desiredCapabilities.setCapability("enableVNC", true)
    desiredCapabilities.setCapability("videoName", GebBasicSpec.caller + ': ' + GebBasicSpec.testName.methodName + ".mp4")
    desiredCapabilities.setCapability("pattern", '$quota/$sessionId')

The test execution works fine and the VNC is enabled successful, but no video is recorded and I can see that for the browserpods no video-recorder pod is created and if I describe the browserpods, I can see that the label "enableVideo" is set to false.

I don't know how to continue here and where to start debugging, as there is no hint how to figure out whats missing in the documentation about the s3 configuration.

Hope you can help. If you need any more details, let me know!

@vania-pooh
Copy link
Member

@buettner123 actually these capabilities should go under moon:options key. I.e. you create a capability called moon:options and then put a HashMap<String, Object> inside with all capabilities from your example. https://github.com/aerokube/moon-cloud-java-example/blob/master/src/test/java/com/aerokube/moon/MoonCloudExampleTest.java#L25-L31

@buettner123
Copy link
Author

buettner123 commented Oct 11, 2023

Thanks for the hint @vania-pooh. This helped to get the video recording starting.

However I encountered some AccessDenied issues with the saving to the bucket. I think there might be some missing/incomplete documentation for the serviceAccount stuff.

Looking at the values file for the helm chart, I see that it suggest adding:

configs:
  default:
    serviceAccountName: aerokube-moon
    serviceAccountAnnotations: {...}

However, digging into the helm chart I found out that this is actually supposed to be placed on the quota level and the one on config.default.serviceAccount* level doesn't seem to have any effect.

My values.yml now looks like this:

quota:
  moon: null
  test:
    namespace: moon-test
    password: ''
    serviceAccountName: aerokube-moon
    serviceAccountAnnotations: {
      "eks.amazonaws.com/role-arn": "arn:aws:iam::xxxx:role/MoonIAMRole"
    }

With this changes and by providing the role-arn to the service account, it works fine for my eks+iam roles and service account setup.

Maybe it makes sense to adjust the default values.yml file to reflect this or add some more context to the documentation in https://aerokube.com/moon/latest/#faq-kubernetes-service-account

And for the sake of completeness, I adapted the above IAM policy a bit to feature less actions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "s3:PutObject",
        "s3:ListBucket",
        "s3:GetObject"
      ],
      "Effect": "Allow",
      "Resource": [
        "arn:aws:s3:::${TargetBucket}/*",
        "arn:aws:s3:::${TargetBucket}"
      ]
    }
  ]
}

In addition, TargetBucket is replaced with the bucket name on creation of the policy.

@vania-pooh vania-pooh added this to the 2.6.0 milestone Oct 16, 2023
@vania-pooh
Copy link
Member

vania-pooh commented Oct 26, 2023

@buettner123 started fixing this and can't find an exact location where we suggest adding the following:

configs:
  default:
    serviceAccountName: aerokube-moon
    serviceAccountAnnotations: {...}

Only found correct example. Could you please provide some reference?

@vania-pooh vania-pooh modified the milestones: 2.6.0, 2.6.1 Oct 26, 2023
@buettner123
Copy link
Author

For the serviceAccountName there is https://github.com/aerokube/charts/blob/master/moon2/values.yaml#L350 which seems to have no effect.
The configs.default.serviceAccountAnnotations was an assumption from my side not reflected in the values file (but would make sense in my opinion, if there will be some defaults available)

@aandryashin
Copy link
Member

aandryashin commented Oct 26, 2023 via email

@vania-pooh vania-pooh modified the milestones: 2.6.1, 2.6.2 Jan 22, 2024
@vania-pooh vania-pooh modified the milestones: 2.6.2, 2.6.3 Mar 2, 2024
@vania-pooh
Copy link
Member

@buettner123 just to be sure, were you able to fix this?

@buettner123
Copy link
Author

@buettner123 just to be sure, were you able to fix this?

yes, I was able to resolve it with your hints, just tried to point out the unclear documentation.

@vania-pooh
Copy link
Member

Ok, closing then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants