Skip to content

Commit

Permalink
bugfix for #65: do not add resource maxima when quota is < 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ajslone committed Aug 2, 2020
1 parent af9dd99 commit 1b5e274
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions caliban/platform/gke/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,19 @@ def resource_limits_from_quotas(

for q in quotas:
metric = q['metric']
limit = q['limit']
limit = int(q['limit'])

# the api can return a limit of 0, but specifying a limit of zero
# causes an error when configuring the cluster, so we skip any
# resources with no quota
if limit < 1:
continue

if metric == 'CPUS':
limits.append({'resourceType': 'cpu', 'maximum': str(limit)})
limits.append({
'resourceType': 'memory',
'maximum': str(int(limit) * k.MAX_GB_PER_CPU)
'maximum': str(limit * k.MAX_GB_PER_CPU)
})
continue

Expand Down

0 comments on commit 1b5e274

Please sign in to comment.