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

The Job Controller Should Run #1978

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

cniackz
Copy link
Contributor

@cniackz cniackz commented Feb 9, 2024

Objective:

The Job Controller Should Run when there is a Job's Custom Resource applied

apiVersion: job.min.io/v1alpha1
kind: MinIOJob
metadata:
  name: myminio
  namespace: tenant-lite
spec:
  serviceAccountName: tenant-lite
  tenant:
    name: my-tenant
    namespace: default
  execution: parallel # Sequential
  # disableWaitForReady: true
  commands:
    - op: ready
    - op: make-bucket
      args:
        name: memes
    - name: add-my-user-1
      op: admin/user/add
      args:
        user: daniel
        password: daniel123
    - name: add-my-policy
      op: admin/policy/add
      args:
        name: memes-access
        policy: |
          {
              "Version": "2012-10-17",
              "Statement": [
                  {
                      "Effect": "Allow",
                      "Action": [
                          "s3:*"
                      ],
                      "Resource": [
                          "arn:aws:s3:::memes",
                          "arn:aws:s3:::memes/*"
                      ]
                  }
              ]
          }
    - op: admin/policy/attach
      dependsOn:
        - add-my-user-1
        - add-my-policy
      args:
        policy: memes-access
status:
  phase: Failed # Completed, Pending, Waiting, Running
  commands:
    - name: wait-ready
      result: success
    - result: succes
    - result: failure
      message: this and that

Issue to solve in this PR:

Currently, when we add a Job's CR, the controller does not execute any loops.

Result after applying this PR:

As a result, both loops will be executed in separate goroutines:

I0209 14:47:16.670524   26488 main-controller.go:783] MinIO Tenant Main loop!!!!
I0209 14:47:16.671440   26488 job-controller.go:187] Job Controller Loop!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  • File: operator/pkg/controller/main-controller.go
// syncHandler compares the actual state with the desired, and attempts to
// converge the two. It then updates the Status block of the Tenant resource
// with the current status of the resource.
func (c *Controller) syncHandler(key string) (Result, error) {
	klog.Info("MinIO Tenant Main loop!!!!")
  • File: operator/pkg/controller/job-controller.go
// SyncHandler compares the current Job state with the desired, and attempts to
// converge the two. It then updates the Status block of the Job resource
// with the current status of the resource.
func (c *JobController) SyncHandler(key string) error {
	klog.Info("Job Controller Loop!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")

@cniackz cniackz self-assigned this Feb 9, 2024
@cniackz cniackz changed the title [Work in Progress] - The Job Controller Should Run The Job Controller Should Run Feb 9, 2024
@cniackz cniackz added the enhancement New feature or request label Feb 12, 2024
@dvaldivia dvaldivia merged commit 22d4612 into minio:master Feb 12, 2024
26 checks passed
@cniackz cniackz deleted the job-controller-testing-1 branch February 16, 2024 13:21
@cniackz
Copy link
Contributor Author

cniackz commented Feb 16, 2024

Thank you Daniel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Addition enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants