Kubernetes job with two containers to exit after main container stops

apiVersion: batch/v1
kind: Job
metadata:
  name: my-cronjob
spec:
  template:
    spec:
      containers:
      - name: main-container
        image: chentex/random-logger:latest
        command: ["./entrypoint.sh"]
        args:
          - "100"
          - "400"
          - "60"
      - name: side-container
        image: ubuntu:latest
        command: 
          - sleep 
        args:
          - 300s
      restartPolicy: Never

For this example job the main container exists after 60 seconds means it goes to completed state its task is done.
but consider the side car is never ending process.
I am looking for a soluction to terminate the job after main container exists.

Hi @bonthusaireddy ,

It’s a good point, you can check this blog post on medium talked about various solution Properly Running Kubernetes Jobs with Sidecars | by Steven Aldinger | TeamSnap Engineering | Medium

Thanks.
This is a workaround solution and cannot be applicable for different use cases.
If kubernetes does not provide this functionality by default this can be a good KEPs