Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table kubernetes_limit_range. Closes #27 #30

Merged
merged 5 commits into from
Aug 30, 2021
Merged

Conversation

bigdatasourav
Copy link
Contributor

@bigdatasourav bigdatasourav commented Aug 30, 2021

Integration test logs

Logs

SETUP: tests/kubernetes_limit_range []

PRETEST: tests/kubernetes_limit_range
Running terraform

Error: No configuration files

Apply requires configuration to be present. Applying without a configuration
would mark everything for destruction, which is normally not what is desired.
If you would like to destroy everything, run 'terraform destroy' instead.

TEST: tests/kubernetes_limit_range
Running terraform

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # null_resource.create_limit will be created
  + resource "null_resource" "create_limit" {
      + id = (known after apply)
    }

  # null_resource.delay will be created
  + resource "null_resource" "delay" {
      + id = (known after apply)
    }

Plan: 2 to add, 0 to change, 0 to destroy.
null_resource.create_limit: Creating...
null_resource.delay: Creating...
null_resource.delay: Provisioning with 'local-exec'...
null_resource.create_limit: Provisioning with 'local-exec'...
null_resource.delay (local-exec): Executing: ["/bin/sh" "-c" "sleep 45"]
null_resource.create_limit (local-exec): Executing: ["/bin/sh" "-c" "kubectl apply -f /private/var/folders/d8/gsp6f_cn3359xnt_gs3cts_80000gn/T/tests/kubernetes_limit_range/terraform/test/limit_range.yaml --namespace=default"]
null_resource.delay: Still creating... [10s elapsed]
null_resource.create_limit: Still creating... [10s elapsed]
null_resource.create_limit (local-exec): limitrange/cpu-limit-range configured
null_resource.create_limit: Creation complete after 10s [id=5810779417238913315]
null_resource.delay: Still creating... [20s elapsed]
null_resource.delay: Still creating... [30s elapsed]
null_resource.delay: Still creating... [40s elapsed]
null_resource.delay: Creation complete after 45s [id=6627809562021291962]

Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

Running SQL query: test-get-query.sql

[
  {
    "name": "cpu-limit-range",
    "namespace": "default"
  }
]
✔ PASSED

Running SQL query: test-list-query.sql

[
  {
    "name": "cpu-limit-range",
    "namespace": "default"
  }
]
✔ PASSED

Running SQL query: test-not-found-query.sql

null
✔ PASSED

POSTTEST: tests/kubernetes_limit_range
Running terraform

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # null_resource.delete_limit will be created
  + resource "null_resource" "delete_limit" {
      + id = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.
null_resource.delete_limit: Creating...
null_resource.delete_limit: Provisioning with 'local-exec'...
null_resource.delete_limit (local-exec): Executing: ["/bin/sh" "-c" "kubectl delete -f /private/var/folders/d8/gsp6f_cn3359xnt_gs3cts_80000gn/T/tests/kubernetes_limit_range/terraform/posttest/limit_range.yaml"]
null_resource.delete_limit (local-exec): limitrange "cpu-limit-range" deleted
null_resource.delete_limit: Creation complete after 3s [id=7695457712353120805]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

TEARDOWN: tests/kubernetes_limit_range



SUMMARY:

1/1 passed.

Example query results

Results
> select
  name,
  namespace,
  limits ->> 'type' as type,
  limits ->> 'default' as default,
  limits ->> 'defaultRequest' as default_request
from
  kubernetes_limit_range,
  jsonb_array_elements(spec_limits) as limits;
+-----------------+-----------+-----------+--------------+-----------------+
| name            | namespace | type      | default      | default_request |
+-----------------+-----------+-----------+--------------+-----------------+
| cpu-limit-range | default   | Container | {"cpu": "1"} | {"cpu": "500m"} |
+-----------------+-----------+-----------+--------------+-----------------+
> select
  name,
  namespace,
  resource_version,
  creation_timestamp,
  jsonb_pretty(spec_limits) as spec_limits
from
  kubernetes_limit_range
order by
  namespace;
+-----------------+-----------+------------------+---------------------+------------------------------+
| name            | namespace | resource_version | creation_timestamp  | spec_limits                  |
+-----------------+-----------+------------------+---------------------+------------------------------+
| cpu-limit-range | default   | 1304838          | 2021-08-30 10:16:24 | [                            |
|                 |           |                  |                     |     {                        |
|                 |           |                  |                     |         "type": "Container", |
|                 |           |                  |                     |         "default": {         |
|                 |           |                  |                     |             "cpu": "1"       |
|                 |           |                  |                     |         },                   |
|                 |           |                  |                     |         "defaultRequest": {  |
|                 |           |                  |                     |             "cpu": "500m"    |
|                 |           |                  |                     |         }                    |
|                 |           |                  |                     |     }                        |
|                 |           |                  |                     | ]                            |
+-----------------+-----------+------------------+---------------------+------------------------------+

@bigdatasourav bigdatasourav self-assigned this Aug 30, 2021
@bigdatasourav bigdatasourav linked an issue Aug 30, 2021 that may be closed by this pull request
bigdatasourav added 2 commits August 30, 2021 17:09
Copy link
Contributor

@rajlearner17 rajlearner17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bigdatasourav bigdatasourav merged commit b2839e9 into main Aug 30, 2021
@bigdatasourav bigdatasourav deleted the issue-27 branch August 30, 2021 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add table kubernetes_limit_range
3 participants