# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- gcs-testing.yaml
- fio-config.yaml

images:
- name: fio
  newName: us-docker.pkg.dev/PROJECT_ID/research-images/fio # Replace with your desired registry
  newTag: latest

configMapGenerator:
- literals:
  - BUCKETNAME=BUCKETNAME
  - COMPLETIONS=1
  - PARALLELISM=1
  name: gcs-vars

replacements:
- source:
    kind: ConfigMap
    name: gcs-vars
    fieldPath: data.BUCKETNAME
  targets:
  - select:
      kind: Job
    fieldPaths:
    - spec.template.spec.volumes.[name=gcs-fuse-csi-ephemeral].csi.volumeAttributes.bucketName

- source:
    kind: ConfigMap
    name: gcs-vars
    fieldPath: data.COMPLETIONS
  targets:
  - select:
      kind: Job
    fieldPaths:
    - spec.completions
- source:
    kind: ConfigMap
    name: gcs-vars
    fieldPath: data.PARALLELISM
  targets:
  - select:
      kind: Job
    fieldPaths:
    - spec.parallelism
