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

feat: add harvester_cloudinit_secret #76

Merged
merged 5 commits into from
Aug 15, 2023

Conversation

FrankYang0529
Copy link
Member

@FrankYang0529 FrankYang0529 commented Mar 6, 2023

Issue: harvester/harvester#2958

Test plan

Setup
Follow PR Test Env Setup

Case 1: Apply same terraform doesn't trigger change

  1. Create a file main.tf.
resource "harvester_cloudinit_secret" "ex1" {
  name             = "ex1"
  namespace        = "default"
  user_data_base64 = "I2Nsb3VkLWNvbmZpZwpwYWNrYWdlX3VwZGF0ZTogdHJ1ZQpwYWNrYWdlczoKICAtIHFlbXUtZ3Vlc3QtYWdlbnQKcnVuY21kOgogIC0gLSBzeXN0ZW1jdGwKICAgIC0gZW5hYmxlCiAgICAtIC0tbm93CiAgICAtIHFlbXUtZ3Vlc3QtYWdlbnQuc2VydmljZQpwYXNzd29yZDogdGVzdApjaHBhc3N3ZDoKICBleHBpcmU6IGZhbHNlCnNzaF9wd2F1dGg6IHRydWUK"
}

resource "harvester_cloudinit_secret" "ex2" {
    name = "ex2"
    namespace = "default"

    user_data    = <<-EOF
    #cloud-config
    password: test
    chpasswd:
      expire: false
    ssh_pwauth: true
    package_update: true
    packages:
      - qemu-guest-agent
    runcmd:
      - - systemctl
        - enable
        - '--now'
        - qemu-guest-agent
    EOF
    network_data = ""
}
  1. Run terraform apply. Terraform should add ex1 and ex2 secrets to the cluster.
  2. Run terraform apply again. Nothing change.

Case 2: Change content to empty will update the secret

  1. Follow case 1.
  2. Update the file main.tf.
resource "harvester_cloudinit_secret" "ex1" {
  name             = "ex1"
  namespace        = "default"
  user_data_base64 = ""
}

resource "harvester_cloudinit_secret" "ex2" {
    name = "ex2"
    namespace = "default"

    user_data    = ""
    network_data = ""
}
  1. Run terraform apply. The content of ex1 and ex2 secrets will be empty.
  2. Run terraform apply again. Nothing change.

@FrankYang0529 FrankYang0529 requested a review from futuretea March 6, 2023 06:10
@FrankYang0529 FrankYang0529 force-pushed the add-harvester_secret branch 2 times, most recently from 8370598 to 78e5bb8 Compare March 6, 2023 06:50
Copy link
Contributor

@futuretea futuretea left a comment

Choose a reason for hiding this comment

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

Also need to consider another test case:

  1. apply with user_data not empty
  2. change user_data to empty
  3. apply again

@FrankYang0529 FrankYang0529 force-pushed the add-harvester_secret branch 2 times, most recently from c3b9fdb to f9e73fd Compare April 27, 2023 02:18
@FrankYang0529
Copy link
Member Author

Also need to consider another test case:

  1. apply with user_data not empty
  2. change user_data to empty
  3. apply again

Added test case 2. Thanks.

@futuretea futuretea self-requested a review May 8, 2023 07:42
@futuretea futuretea force-pushed the add-harvester_secret branch from f9e73fd to 3e2e019 Compare June 6, 2023 10:32
@iosifnicolae2
Copy link

Any idea when this PR will be merged?

@futuretea futuretea marked this pull request as draft July 19, 2023 03:18
@futuretea futuretea force-pushed the add-harvester_secret branch 6 times, most recently from 9c3cfa6 to 8dcae1a Compare July 19, 2023 06:04
Signed-off-by: futuretea <[email protected]>
Signed-off-by: futuretea <[email protected]>
@futuretea futuretea requested a review from chrisho July 27, 2023 07:08
Copy link

@chrisho chrisho left a comment

Choose a reason for hiding this comment

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

LGTM, the test cases are working fine, thanks.

Copy link

@guangbochen guangbochen left a comment

Choose a reason for hiding this comment

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

LGTM, and verified that the testing case works.

@guangbochen
Copy link

@bk201 please take a look when u are back only; merge the PR to process the validation first, thanks.

@guangbochen guangbochen merged commit 4d63d2f into harvester:master Aug 15, 2023
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.

5 participants