...

Text file src/edge-infra.dev/cmd/tools/ci-billing/README.md

Documentation: edge-infra.dev/cmd/tools/ci-billing

     1# CI Billing Tool
     2
     3This tool implements some helpful operations required to do finops management of the CI sandbox clusters.
     4While it can be built as a separate binary, it is likely that most users will just call it with bazel, for example:
     5
     6```
     7just run cmd/tools/ci-billing -- refs
     8```
     9
    10Note: Before running these commands, you may have to do a GCP application login:
    11
    12```
    13gcloud auth application-default login
    14```
    15
    16## Commands
    17
    18### Refs
    19This parses the project folders in the edge-infra repository, and pulls out the billing references we include there in a CSV format for easy processing.
    20
    21An optional `--no-headings` flag prevents the column headings being included in the CSV file.
    22
    23```
    24just run cmd/tools/ci-billing -- refs --no-headings
    25```
    26
    27The command defaults to finding the config files in `config/clusters/ret-edge-pltf-infra/platform-infra/projects/preprod/dsds-ien-playpits`. If for some reason that is not the case, the location can be manually specified using the `--project-dir` flag:
    28
    29```
    30just run cmd/tools/ci-billing -- refs --project-dir /home/myuser/projects
    31```
    32
    33### Owners
    34This command pulls the iam roles associated with all the CI projects listed in the projects directory, and prints all the users assigned with owners, to help with identifying the correct point of contact for a project.
    35
    36As with the `refs` command above, the location of the project directory can be specified using the `--project-dir` flag if not in its default location.
    37
    38The command can also be limited to an individual project using the `--project` flag:
    39
    40```
    41just run cmd/tools/ci-billing -- owners --project ret-edge-dsds-matrix
    42```
    43
    44### Labels
    45This command consumes a CSV file of project and schedule information, and applies the labels consumed by GSRE to start and stop the VMS.
    46
    47The format of the CVS file is as follows:
    48
    49```
    50<project>,<timezone string>,<weekday schedule label>,<weekend schedule label>
    51```
    52
    53e.g:
    54
    55```
    56ret-edge-dsds-ci-team-02,utc,12-23,01-02
    57```
    58
    59The location of the CSV file must be specified with the `csv-location` flag:
    60
    61```
    62just run cmd/tools/ci-billing -- labels --csv-location /home/myuser/temp/schedules.csv
    63```
    64
    65Optionally, a single project to run against can be specified with the `--project` flag:
    66
    67```
    68just run cmd/tools/ci-billing -- labels --csv-location /home/myuser/temp/schedules.csv --project ret-edge-dsds-ci-team-02
    69```

View as plain text