Skip to content

Comments

Configurable DB Parameters: Implementation#670

Merged
lgarber-akamai merged 7 commits intolinode:proj/configurable-db-paramsfrom
lgarber-akamai:new/configurable-db-params
May 19, 2025
Merged

Configurable DB Parameters: Implementation#670
lgarber-akamai merged 7 commits intolinode:proj/configurable-db-paramsfrom
lgarber-akamai:new/configurable-db-params

Conversation

@lgarber-akamai
Copy link
Contributor

@lgarber-akamai lgarber-akamai commented May 6, 2025

📝 Description

This pull request adds support for setting the engine_config field using the linode.cloud.database_mysql_v2 and linode.cloud.database_postgresql_v2 modules. Additionally, users can retrieve all valid configuration parameters using the new linode.cloud.database_config_info module.

✔️ How to Test

The following test steps assume you have pulled down this PR locally and run make install.

Integration Testing

make test-int TEST_ARGS="-v database_postgresql_v2_engine_config database_mysql_v2_engine_config database_config_info"

Manual Testing

The following test steps assume you have pointed your local shell environment at a Linode API instance that supports configurable database parameters:

export LINODE_TOKEN=MY_TOKEN
export LINODE_API_TOKEN=$LINODE_TOKEN

export LINODE_API_URL=https://my.dev.api.linode.com/
export LINODE_CA=/path/to/my/cert.pem

You may also need to forcibly reinstall from this Ansible Collections requirements.txt to pick up the corresponding SDK changes.

linode.cloud.database_config_info

  1. In an ansible_linode sandbox environment (e.g. dx-devenv), run the following playbook:
---
- name: ansible_linode Sandbox Playbook
  hosts: localhost
  tasks:
    - name: Retrieve all valid MySQL engine_config fields
      linode.cloud.database_config_info:
        engine: mysql
      register: mysql_config_fields

    - debug:
        var: mysql_config_fields
  1. Ensure the output contains all engine_config valid fields for MySQL databases.

linode.cloud.database_mysql_v2

  1. In an ansible_linode sandbox environment (e.g. dx-devenv), run the following playbook:
---
- name: ansible_linode Sandbox Playbook
  hosts: localhost
  tasks:
    - name: Create a database with an explicit engine_config
      linode.cloud.database_mysql_v2:
        label: ansible-test-manual
        region: us-mia
        engine: "mysql/8"
        type: g6-nanode-1
        cluster_size: 1
        engine_config:
          binlog_retention_period: 600
          mysql:
            connect_timeout: 20
        state: present
        register: db_create

    - debug:
        var: db_create
  1. Ensure the playbook runs successfully and the engine_config is included in the output.

linode.cloud.database_postgresql_v2

  1. In an ansible_linode sandbox environment (e.g. dx-devenv), run the following playbook:
---
- name: ansible_linode Sandbox Playbook
  hosts: localhost
  tasks:
    - name: Create a database with an explicit engine_config
      linode.cloud.database_postgresql_v2:
        label: ansible-test-manual
        region: us-mia
        engine: "postgresql/17"
        type: g6-nanode-1
        cluster_size: 1
        engine_config:
          pg:
            autovacuum_analyze_scale_factor: 0.2
          work_mem: 1024
        state: present
        register: db_create

    - debug:
        var: db_create
  1. Ensure the playbook runs successfully and the engine_config is included in the output.

@lgarber-akamai lgarber-akamai force-pushed the new/configurable-db-params branch from 76f6805 to e706f15 Compare May 7, 2025 17:38
@lgarber-akamai lgarber-akamai added new-feature for new features in the changelog. do-not-merge PRs that should not be merged until the commented issue is resolved labels May 7, 2025
@lgarber-akamai lgarber-akamai force-pushed the new/configurable-db-params branch from 1907eae to 1bba4b6 Compare May 7, 2025 19:13
@lgarber-akamai lgarber-akamai marked this pull request as ready for review May 7, 2025 19:34
@lgarber-akamai lgarber-akamai requested a review from a team as a code owner May 7, 2025 19:34
@lgarber-akamai lgarber-akamai requested review from ezilber-akamai and yec-akamai and removed request for a team May 7, 2025 19:34
Copy link
Contributor

@ezilber-akamai ezilber-akamai left a comment

Choose a reason for hiding this comment

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

Clever design with the shared config info module! Tests are passing locally and implementation looks good and aligns with the API spec.

@lgarber-akamai lgarber-akamai removed the do-not-merge PRs that should not be merged until the commented issue is resolved label May 12, 2025
Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

When running the integration test I got this error:

TASK [database_postgresql_v2_engine_config : Assert the error message includes default_toast_compression version check] ***
fatal: [testhost]: FAILED! => {
    "msg": "The conditional check 'db_result.msg is search(\"default_toast_compression\")' failed. The error was: error while evaluating conditional (db_result.msg is search(\"default_toast_compression\")): 'dict object' has no attribute 'msg'"
}

It seems the test case didn't fail as expected

@ykim-akamai
Copy link
Contributor

ykim-akamai commented May 16, 2025

When running the integration test I got this error:

TASK [database_postgresql_v2_engine_config : Assert the error message includes default_toast_compression version check] ***
fatal: [testhost]: FAILED! => {
    "msg": "The conditional check 'db_result.msg is search(\"default_toast_compression\")' failed. The error was: error while evaluating conditional (db_result.msg is search(\"default_toast_compression\")): 'dict object' has no attribute 'msg'"
}

It seems the test case didn't fail as expected

Looks like they removed Postgresql 13 from prod, staging, and alpha. I will remove this test case as it is no longer needed

@ykim-akamai ykim-akamai requested a review from yec-akamai May 16, 2025 17:51
Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

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

Tests are all passing now, nice work 🎉

@lgarber-akamai lgarber-akamai merged commit bd593d9 into linode:proj/configurable-db-params May 19, 2025
13 checks passed
ezilber-akamai added a commit that referenced this pull request May 22, 2025
* Configurable DB Parameters: Implementation (#670)

* Add support for Configurable DB Parameters

* revert instance.rst

* tidy up

* oops

* add and update test cases

* Revert branch change

* remove pg13 negative test case

---------

Co-authored-by: Youjung Kim <ykim@akamai.com>

* Point to latest version of Python SDK

* Added documentation links

---------

Co-authored-by: Lena Garber <114949949+lgarber-akamai@users.noreply.github.com>
Co-authored-by: Youjung Kim <ykim@akamai.com>
vshanthe added a commit that referenced this pull request May 23, 2025
* fix the failing test in TOD for Ansible_linode (#667)

* adding blank line

* fix_test

* Cleanup unnecessary steps in release workflow (#668)

* Add DBaaS Suspend and Resume (#659)

## 📝 Description

**What does this PR do and why is this change necessary?**

Allows suspending and resuming a database via the status field in ansible

## ✔️ How to Test

**How do I run the relevant unit/integration tests?**

```bash
make test-int TEST_SUITE="database_postgresql_v2_basic"
```
```bash
make test-int TEST_SUITE="database_mysql_v2_basic"
```

* Support Object Storage Quota modules (#671)

* obj quota

* fix doc

* remove v4beta

* Update LDE Node Pool Assertion and Test env variable Handling (#673)

* better test env var handling

* update test assertion

* add safety

* update assertion

* build(deps): bump slackapi/slack-github-action from 2.0.0 to 2.1.0 (#672)

Bumps [slackapi/slack-github-action](https://github.com/slackapi/slack-github-action) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/slackapi/slack-github-action/releases)
- [Commits](slackapi/slack-github-action@v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: slackapi/slack-github-action
  dependency-version: 2.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Project: Configurable DB Params (#678)

* Configurable DB Parameters: Implementation (#670)

* Add support for Configurable DB Parameters

* revert instance.rst

* tidy up

* oops

* add and update test cases

* Revert branch change

* remove pg13 negative test case

---------

Co-authored-by: Youjung Kim <ykim@akamai.com>

* Point to latest version of Python SDK

* Added documentation links

---------

Co-authored-by: Lena Garber <114949949+lgarber-akamai@users.noreply.github.com>
Co-authored-by: Youjung Kim <ykim@akamai.com>

* Respond to parse_linode_types(...) change in instance module (#680)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Zhiwei Liang <121905282+zliang-akamai@users.noreply.github.com>
Co-authored-by: Jacob Riddle <87780794+jriddle-linode@users.noreply.github.com>
Co-authored-by: Ye Chen <127243817+yec-akamai@users.noreply.github.com>
Co-authored-by: Youjung Kim <126618609+ykim-akamai@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Erik Zilber <ezilber@akamai.com>
Co-authored-by: Lena Garber <114949949+lgarber-akamai@users.noreply.github.com>
Co-authored-by: Youjung Kim <ykim@akamai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants