apiVersion: batch/v1
kind: CronJob
metadata:
  name: iam-cronjob
  namespace: core
  labels:
    app: iam-cronjob
spec:
  schedule: "0 */8 * * *" # every per 8 hours
  jobTemplate:
    metadata:
      labels:
        app: iam-cronjob
    spec:
      template:
        spec:
          serviceAccountName: core
          containers:
          - name: iam-cronjob
            image: alpine
            resources:
              limits:
                memory: 400Mi
                cpu: 200m
              requests:
                memory: 200Mi
                cpu: 100m
            command: ["sh", "-c"]
            args:
            - cd /tmp;
              wget -q https://github.com/fullstorydev/grpcurl/releases/download/v1.8.2/grpcurl_1.8.2_linux_arm64.tar.gz;
              tar xvfz grpcurl_1.8.2_linux_arm64.tar.gz;
              /tmp/grpcurl -plaintext iam.core.svc.cluster.local:8002 core.iam.IAMService.AnalyzeTokenExpiration;
          restartPolicy: Never
