apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  labels:
    kustomize.component: argo
  name: workflows.argoproj.io
spec:
  group: argoproj.io
  names:
    kind: Workflow
    listKind: WorkflowList
    plural: workflows
    shortNames:
    - wf
    singular: workflow
  scope: Namespaced
  version: v1alpha1
---
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    kustomize.component: argo
  name: argo
  namespace: kubeflow
---
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    kustomize.component: argo
  name: argo-ui
  namespace: kubeflow
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  labels:
    app: argo
    kustomize.component: argo
  name: argo
rules:
- apiGroups:
  - ""
  resources:
  - pods
  - pods/exec
  verbs:
  - create
  - get
  - list
  - watch
  - update
  - patch
- apiGroups:
  - ""
  resources:
  - configmaps
  verbs:
  - get
  - watch
  - list
- apiGroups:
  - ""
  resources:
  - persistentvolumeclaims
  verbs:
  - create
  - delete
- apiGroups:
  - argoproj.io
  resources:
  - workflows
  verbs:
  - get
  - list
  - watch
  - update
  - patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  labels:
    app: argo
    kustomize.component: argo
  name: argo-ui
rules:
- apiGroups:
  - ""
  resources:
  - pods
  - pods/exec
  - pods/log
  verbs:
  - get
  - list
  - watch
- apiGroups:
  - ""
  resources:
  - secrets
  verbs:
  - get
- apiGroups:
  - argoproj.io
  resources:
  - workflows
  verbs:
  - get
  - list
  - watch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  labels:
    app: argo
    kustomize.component: argo
  name: argo
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: argo
subjects:
- kind: ServiceAccount
  name: argo
  namespace: kubeflow
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  labels:
    app: argo-ui
    kustomize.component: argo
  name: argo-ui
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: argo-ui
subjects:
- kind: ServiceAccount
  name: argo-ui
  namespace: kubeflow
---
apiVersion: v1
data:
  config: |
    {
    executorImage: {{ .Values.argo.executorImage | quote }},
    artifactRepository:
    {
        s3: {
            bucket: {{ .Values.argo.artifactRepositoryBucket | quote }},
            keyPrefix: {{ .Values.argo.artifactRepositoryKeyPrefix | quote }},
            endpoint: {{ .Values.argo.artifactRepositoryEndpoint | quote }},
            insecure: {{ .Values.argo.artifactRepositoryInsecure }},
            accessKeySecret: {
                name: {{ .Values.argo.artifactRepositoryAccessKeySecretName | quote }},
                key: {{ .Values.argo.artifactRepositoryAccessKeySecretKey | quote }}
            },
            secretKeySecret: {
                name: {{ .Values.argo.artifactRepositorySecretKeySecretName | quote }},
                key: {{ .Values.argo.artifactRepositorySecretKeySecretKey | quote }}
            }
        }
    }
    }
kind: ConfigMap
metadata:
  labels:
    kustomize.component: argo
  name: workflow-controller-configmap
  namespace: kubeflow
---
apiVersion: v1
data:
  artifactRepositoryAccessKeySecretKey: {{ .Values.argo.artifactRepositoryAccessKeySecretKey | quote }}
  artifactRepositoryAccessKeySecretName: {{ .Values.argo.artifactRepositoryAccessKeySecretName | quote }}
  artifactRepositoryBucket: {{ .Values.argo.artifactRepositoryBucket | quote }}
  artifactRepositoryEndpoint: {{ .Values.argo.artifactRepositoryEndpoint | quote }}
  artifactRepositoryInsecure: {{ .Values.argo.artifactRepositoryInsecure | quote }}
  artifactRepositoryKeyPrefix: {{ .Values.argo.artifactRepositoryKeyPrefix }}
  artifactRepositorySecretKeySecretKey: {{ .Values.argo.artifactRepositorySecretKeySecretKey | quote }}
  artifactRepositorySecretKeySecretName: {{ .Values.argo.artifactRepositorySecretKeySecretName | quote }}
  clusterDomain: {{ .Values.clusterDomain | quote }}
  executorImage: {{ .Values.argo.executorImage | quote }}
  namespace: kubeflow
kind: ConfigMap
metadata:
  labels:
    kustomize.component: argo
  name: workflow-controller-parameters
  namespace: kubeflow
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    getambassador.io/config: |-
      ---
      apiVersion: ambassador/v0
      kind:  Mapping
      name: argo-ui-mapping
      prefix: /argo/
      service: argo-ui.kubeflow
  labels:
    app: argo-ui
    kustomize.component: argo
  name: argo-ui
  namespace: kubeflow
spec:
  ports:
  - port: 80
    targetPort: 8001
  selector:
    app: argo-ui
    kustomize.component: argo
  sessionAffinity: None
  type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: argo-ui
    kustomize.component: argo
  name: argo-ui
  namespace: kubeflow
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: argo-ui
      kustomize.component: argo
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: argo-ui
        kustomize.component: argo
    spec:
      containers:
      - env:
        - name: ARGO_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: IN_CLUSTER
          value: "true"
        - name: BASE_HREF
          value: /argo/
        image: argoproj/argoui:v2.3.0
        imagePullPolicy: IfNotPresent
        name: argo-ui
        readinessProbe:
          httpGet:
            path: /
            port: 8001
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: argo-ui
      serviceAccountName: argo-ui
      terminationGracePeriodSeconds: 30
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: workflow-controller
    kustomize.component: argo
  name: workflow-controller
  namespace: kubeflow
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: workflow-controller
      kustomize.component: argo
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: workflow-controller
        kustomize.component: argo
    spec:
      containers:
      - args:
        - --configmap
        - workflow-controller-configmap
        command:
        - workflow-controller
        env:
        - name: ARGO_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        image: argoproj/workflow-controller:v2.3.0
        imagePullPolicy: IfNotPresent
        name: workflow-controller
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: argo
      serviceAccountName: argo
      terminationGracePeriodSeconds: 30
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: argo-ui
  namespace: kubeflow
spec:
  gateways:
  - kubeflow-gateway
  hosts:
  - '*'
  http:
  - match:
    - uri:
        prefix: /argo/
    rewrite:
      uri: /
    route:
    - destination:
        host: argo-ui.kubeflow.svc.{{ .Values.clusterDomain }}
        port:
          number: 80
