karpor icon indicating copy to clipboard operation
karpor copied to clipboard

Integration: Cluster Registration Terraform Provider for GitOps Integration

Open elliotxx opened this issue 1 year ago • 18 comments

What would you like to be added?

Develop a Terraform provider for cluster registration to enable seamless GitOps integration. This provider will facilitate automated cluster creation, deletion, and management through Infrastructure as Code (IaC) and GitOps workflows.

Requirements Source: #783

Why is this needed?

Currently, there is no efficient way to manage cluster registration and lifecycle operations through GitOps and Terraform. This feature will provide several benefits:

  1. Enhanced Automation: Enable fully automated cluster management using Terraform.
  2. GitOps Compatibility: Align with GitOps practices for declarative infrastructure management.
  3. Scalability: Support bulk cluster operations and consistent management across environments.
  4. Ease of Use: Provide a simple and reliable way to integrate cluster registration into existing IaC pipelines.

This feature will streamline cluster management processes and improve operational efficiency.

elliotxx avatar Feb 10 '25 08:02 elliotxx

I have an interest in this one. I'd like to know if this one will be considered to do, as it is labeled as awaiting-more-evidence.

jinjiaKarl avatar Feb 11 '25 18:02 jinjiaKarl

@jinjiaKarl I think it's necessary and valuable, but the current iteration is already fully scheduled, so I've moved it to the next milestone (v0.8.0). But if you are interested in it, I'm glad to entrust it to you!

elliotxx avatar Feb 12 '25 02:02 elliotxx

Yeah thanks, I could start this slowly since it is moved to the next milestone. I only have experience using some IaC tools, such as Terraform, CDK, etc.. Could you please give me some tips or instructions on this one? And where is the code put?

jinjiaKarl avatar Feb 12 '25 06:02 jinjiaKarl

@jinjiaKarl There's no rush to develop this feature, you can follow your pace. And it's a quite interesting feature. I have initialized the terraform-provider-karpor repository, which only contains example code, perhaps you can start with the official guide. You can refactor everything except for the .github directory, and the development mode is the same as Karpor, enjoy!

elliotxx avatar Feb 12 '25 13:02 elliotxx

Thanks for the quick action, awesome!

jinjiaKarl avatar Feb 12 '25 17:02 jinjiaKarl

Hi, it looks like publishing the provider requires permission to set repository secrets used by GitHub Actions and I don't have permission to publish the repo in KusionStack.

jinjiaKarl avatar Feb 21 '25 09:02 jinjiaKarl

@jinjiaKarl I have added permissions to you at https://github.com/KusionStack/terraform-provider-karpor repository. Please see if you have received it.

elliotxx avatar Feb 21 '25 10:02 elliotxx

I joined the repository, but I still don't have permission to set repository secrets. I also tried publishing the provider, but only my fork appears—but KusionStack/terraform-provider-karpor is not showing up.

jinjiaKarl avatar Feb 21 '25 11:02 jinjiaKarl

@jinjiaKarl Strange, let me see what's going on. permissions are supposed to be sufficient. By the way, as karpor provider maintainer, you can already submit pr directly in the upstream repo without submit from the fork warehouse.

elliotxx avatar Feb 21 '25 14:02 elliotxx

This is my setting page for erraform-provider-karpor Image

jinjiaKarl avatar Feb 21 '25 15:02 jinjiaKarl

Received, let me see how to deal with it

elliotxx avatar Feb 22 '25 12:02 elliotxx

Hi, it seems only admin-role can change the Action secrets. https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository

jinjiaKarl avatar Feb 24 '25 14:02 jinjiaKarl

@jinjiaKarl Hi, I have configured GPG_PRIVATE_KEY and PASSPHRASE in the secret of the repository according to the guide, and added the necessary configuration files for publish. PTAL #3

elliotxx avatar Feb 25 '25 03:02 elliotxx

@jinjiaKarl I will push a tag in the provider repository to trigger the release pipeline for verification

elliotxx avatar Feb 25 '25 09:02 elliotxx

I found a configuration error, please review it 👉 https://github.com/KusionStack/terraform-provider-karpor/pull/4

elliotxx avatar Feb 25 '25 09:02 elliotxx

Nice, thanks for the verification. Did you publish it to https://registry.terraform.io?

jinjiaKarl avatar Feb 25 '25 11:02 jinjiaKarl

@jinjiaKarl Yeah, I have debugged the release process and now just push a tag that matches the semantic version (e.g. v0.1.0) in the repository to trigger an automatic release CI process. The first version (v0.1.0-alpha.2) of the provider has now been uploaded to https://registry.terraform.io . Due to the inability to upload repeatedly, the official version (v0.1.0) can only be released after merging the next PR.

Image

elliotxx avatar Feb 25 '25 12:02 elliotxx

cool, I will continue to complete the import functionality.

jinjiaKarl avatar Feb 25 '25 13:02 jinjiaKarl