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

feat: Support Resources/EnvFrom/Env/VolumeMounts/Volumes to minioJob #2124

Merged
merged 7 commits into from
May 24, 2024

Conversation

jiuker
Copy link
Contributor

@jiuker jiuker commented May 17, 2024

WIP: Support ref resource

  • Support mc support callhome
  • Support mc license register
  • Support Env/Volumes/resources/EnvFrom

testYaml:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: mc-job-sa
---
apiVersion: sts.min.io/v1alpha1
kind: PolicyBinding
metadata:
  name: mc-job-bingding
spec:
  application:
    serviceaccount: mc-job-sa
  policies:
    - consoleAdmin
---
apiVersion: v1
kind: Secret
metadata:
  name: mytestsecret
data:
  PASSWORD: ZGFuaWVsMTIz
---
apiVersion: v1
kind: Secret
metadata:
  name: mytestsecretenvs
data:
  USER: ZGFuaWVs
  PASSWORD: ZGFuaWVsMTIz
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: mytestconfig
data:
  policy.json:  |
    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "s3:*"
                ],
                "Resource": [
                    "arn:aws:s3:::memes",
                    "arn:aws:s3:::memes/*"
                ]
            }
        ]
    }
---
apiVersion: job.min.io/v1alpha1
kind: MinIOJob
metadata:
  name: minio-test-job
spec:
  serviceAccountName: mc-job-sa
  tenant:
    name: mytest-minio
  commands:
    - op: make-bucket
      args:
        name: memes
    - name: add-my-user-1
      op: admin/user/add
      args:
        user: ${USER}
        password: ${PASSWORD}
      envFrom:
        - secretRef:
            name: mytestsecretenvs
    - name: add-my-user-2
      op: admin/user/add
      args:
        user: pedro
        password: $PASSWORD
      env:
        - name: PASSWORD
          valueFrom:
            secretKeyRef:
              name: mytestsecret
              key: PASSWORD
    - name: add-my-policy
      op: admin/policy/create
      args:
        name: memes-access
        policy: /temp/policy.json
      volumeMounts:
        - name: policy
          mountPath: /temp
      volumes:
        - name: policy
          configMap:
            name: mytestconfig
            items:
              - key: policy.json
                path: policy.json
    - op: admin/policy/attach
      dependsOn:
        - add-my-user-1
        - add-my-user-2
        - add-my-policy
      args:
        policy: memes-access
        user: daniel
    - op: admin/policy/attach
      dependsOn:
        - add-my-user-1
        - add-my-user-2
        - add-my-policy
      args:
        policy: memes-access
        user: pedro

@jiuker jiuker marked this pull request as draft May 17, 2024 03:51
@jiuker jiuker force-pushed the support_ref_resource branch 2 times, most recently from 272aae4 to 6098607 Compare May 17, 2024 07:32
@jiuker jiuker changed the title WIP: Support ref resource feat: Support ref resource May 17, 2024
@jiuker jiuker marked this pull request as ready for review May 17, 2024 07:33
@jiuker jiuker requested review from harshavardhana, pjuarezd, ramondeklein, shtripat and dvaldivia and removed request for harshavardhana May 17, 2024 07:33
support ref resource
@jiuker jiuker force-pushed the support_ref_resource branch from 6098607 to e544732 Compare May 17, 2024 07:39
rename
@jiuker jiuker changed the title feat: Support ref resource feat: Support Resources/EnvFrom/Env/VolumeMounts/Volumes to minioJob May 20, 2024
@jiuker jiuker self-assigned this May 20, 2024
@jiuker jiuker requested a review from shtripat May 21, 2024 02:06
jiuker added 4 commits May 21, 2024 10:13
support port
rename
ignore nil object
shtripat
shtripat previously approved these changes May 21, 2024
Copy link
Contributor

@shtripat shtripat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Verified.

Copy link
Contributor

@ramondeklein ramondeklein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless there is a good reason, I propose to keep IP port numbers as integers.

pkg/utils/miniojob/types.go Outdated Show resolved Hide resolved
change type
@jiuker jiuker requested a review from shtripat May 22, 2024 10:37
Copy link
Contributor

@shtripat shtripat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@pjuarezd pjuarezd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can you please add an example of how to use EnvFrom and Env in the PR description @jiuker? thanks

@jiuker
Copy link
Contributor Author

jiuker commented May 24, 2024

企业微信截图_c35a9560-7ac4-4402-9427-f19fca24dbfa
企业微信截图_c56374ed-0ff1-4211-a05f-795883ddd236
企业微信截图_c68e98d5-c5ef-4ae9-86e3-bf64c020ebaf
@pjuarezd

@jiuker jiuker requested a review from pjuarezd May 24, 2024 07:17
@pjuarezd pjuarezd merged commit ce0a300 into minio:master May 24, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants