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

Feature: karmadactl init supports deployment through configuration files #5357

Merged
merged 1 commit into from
Oct 26, 2024

Conversation

tiansuo114
Copy link
Contributor

@tiansuo114 tiansuo114 commented Aug 12, 2024

What type of PR is this?
/kind feature

What this PR does / why we need it:
Increased karmadactl's ability to init by reading configuration files
From

user@virtual-machine:karmada/_output/bin/linux/amd64# karmadactl init --karmada-apiserver-image registry.k8s.io/kube-apiserver:v1.30.0 --karmada-kube-controller-manager-image registry.k8s.io/kube-controller-manager:v1.30.0 --etcd-image registry.k8s.io/etcd:3.5.13-0 --etcd-init-image docker.io/library/alpine:3.19.1 --karmada-aggregated-apiserver-image docker.io/karmada/karmada-aggregated-apiserver:v1.10.3 --karmada-controller-manager-image docker.io/karmada/karmada-controller-manager:v1.10.3 --karmada-scheduler-image docker.io/karmada/karmada-scheduler:v1.10.3 --karmada-webhook-image docker.io/karmada/karmada-webhook:v1.10.3 --crds /home/tiansuo/Downloads/crds.tar.gz ....

Turn into

user@virtual-machine:karmada/_output/bin/linux/amd64# karmadactl init --config config.yaml

Example of config.yaml

apiVersion: config.karmada.io/v1alpha1
kind: KarmadaInitConfig
metadata:
  name: karmada-init
spec:
  karmadaCrds: "https://github.com/karmada-io/karmada/releases/download/v1.10.3/crds.tar.gz"
  etcd:
    local:
      imageRepository: "registry.k8s.io/etcd"
      imageTag: "3.5.13-0"
      initImage:
        imageRepository: "docker.io/library/alpine"
        imageTag: "3.19.1"
  components:
    karmadaAPIServer:
      imageRepository: "registry.k8s.io/kube-apiserver"
      imageTag: "v1.30.0"
    karmadaAggregatedAPIServer:
      imageRepository: "docker.io/karmada/karmada-aggregated-apiserver"
      imageTag: "v1.10.3"
    kubeControllerManager:
      imageRepository: "registry.k8s.io/kube-controller-manager"
      imageTag: "v1.30.0"
    karmadaControllerManager:
      imageRepository: "docker.io/karmada/karmada-controller-manager"
      imageTag: "v1.10.3"
    karmadaScheduler:
      imageRepository: "docker.io/karmada/karmada-scheduler"
      imageTag: "v1.10.3"
    karmadaWebhook:
      imageRepository: "docker.io/karmada/karmada-webhook"
      imageTag: "v1.10.3"

Which issue(s) this PR fixes:
Fixes #3464
This PR is related to the documentation PR: #5277
Special notes for your reviewer:
@liangyuanpeng
Does this PR introduce a user-facing change?:


@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 12, 2024
@liangyuanpeng
Copy link
Contributor

Hi, this is a bot comment, just put the label of ok-to-test here, you can comment /retest to rerun github workflow if github workflow is failing and it's not releated with this PR.

/ok-to-test

@karmada-bot karmada-bot added ok-to-test size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 12, 2024
@liangyuanpeng
Copy link
Contributor

please link to the proposal at PR describe.

releated #5277

@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 79.72973% with 45 lines in your changes missing coverage. Please review.

Project coverage is 41.53%. Comparing base (f7d6da3) to head (9b9847e).

Files with missing lines Patch % Lines
pkg/karmadactl/cmdinit/kubernetes/deploy.go 78.61% 29 Missing and 5 partials ⚠️
pkg/karmadactl/cmdinit/config/config.go 89.28% 4 Missing and 2 partials ⚠️
pkg/karmadactl/cmdinit/config/types.go 0.00% 5 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5357      +/-   ##
==========================================
+ Coverage   41.37%   41.53%   +0.16%     
==========================================
  Files         651      653       +2     
  Lines       55265    55484     +219     
==========================================
+ Hits        22868    23048     +180     
- Misses      30917    30949      +32     
- Partials     1480     1487       +7     
Flag Coverage Δ
unittests 41.53% <79.72%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tiansuo114
Copy link
Contributor Author

tiansuo114 commented Aug 12, 2024

This PR is related to the documentation PR: #5277

@tiansuo114
Copy link
Contributor Author

please link to the proposal at PR describe.请链接到 PR 描述中的提案。

releated #5277

Ok, I've now connected all three related PRS to document pr

@karmada-bot karmada-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 21, 2024
@tiansuo114
Copy link
Contributor Author

Can we start the review of this pr first, or do we still need to wait for the merge of #5277 before we can conduct the review of this pr
@liangyuanpeng

@liangyuanpeng
Copy link
Contributor

I think we need to merge proposal first

@karmada-bot karmada-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 11, 2024
@tiansuo114
Copy link
Contributor Author

The code in this branch has been modified to use the configuration file format from the existing proposal for deployment, and it has been verified that the deployment works correctly. Additionally, the proposal has already been merged into the master branch. Can we start the review now?
@liangyuanpeng

Furthermore, I have some questions in another PR, and we might need to discuss them further.

Copy link
Contributor

@liangyuanpeng liangyuanpeng left a comment

Choose a reason for hiding this comment

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

sorry for my later and add some comment

pkg/karmadactl/cmdinit/kubernetes/deploy.go Show resolved Hide resolved
.github/workflows/cli.yaml Outdated Show resolved Hide resolved
hack/cli-testing-init-with-config.sh Outdated Show resolved Hide resolved
hack/cli-testing-init-with-config.sh Outdated Show resolved Hide resolved
pkg/karmadactl/cmdinit/config/config.go Outdated Show resolved Hide resolved
pkg/karmadactl/cmdinit/kubernetes/deploy.go Outdated Show resolved Hide resolved
Copy link
Contributor

@liangyuanpeng liangyuanpeng left a comment

Choose a reason for hiding this comment

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

This PR first reads the configuration file and then convert to CommandInitOption, which is compatible with the legacy code unless you refactor the legacy code logic. Do you agree?

cc @zhzhuang-zju @RainbowMango

pkg/karmadactl/cmdinit/config/types.go Outdated Show resolved Hide resolved
pkg/karmadactl/cmdinit/cmdinit.go Show resolved Hide resolved
pkg/karmadactl/cmdinit/config/types.go Outdated Show resolved Hide resolved
pkg/karmadactl/cmdinit/config/config.go Outdated Show resolved Hide resolved
@RainbowMango
Copy link
Member

This PR first reads the configuration file and then convert to CommandInitOption, which is compatible with the legacy code unless you refactor the legacy code logic. Do you agree?

Yeah, I agree.

Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

Generally looks good to me after a quick go-through. Just some nits about naming convention.
@liangyuanpeng do you have any further comments?
@tiansuo114 Have you tested it? Can you share the test report here?

@tiansuo114
Copy link
Contributor Author

Generally looks good to me after a quick go-through. Just some nits about naming convention. @liangyuanpeng do you have any further comments? @tiansuo114 Have you tested it? Can you share the test report here?

I conducted some tests using kind cluster in a virtual machine on my local machine. I also attempted to add a test task in the CLI section of Karmada's GitHub CI workflow to verify whether the karmadactl init --init-config command runs correctly. (The detailed testing process can first be observed in this link)Following the guidance of my mentor, I plan to submit a separate PR to merge the test process into the main branch after the current PR is merged.

@RainbowMango
Copy link
Member

OK.
/approve
Leave LGTM to @liangyuanpeng for final decision.

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 22, 2024
@RainbowMango RainbowMango added this to the v1.12 milestone Oct 22, 2024
@RainbowMango RainbowMango removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 22, 2024
@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 23, 2024
@tiansuo114
Copy link
Contributor Author

/retest

Signed-off-by: tiansuo114 <1729765480@qq.com>

fix lint

Signed-off-by: tiansuo114 <1729765480@qq.com>
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Hi @liangyuanpeng Let's move this forward and handle further comments by separated PRs.

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Oct 26, 2024
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot merged commit 9754a28 into karmada-io:master Oct 26, 2024
15 checks passed
@liangyuanpeng
Copy link
Contributor

Hi, this is a bot comment, just put the label of ok-to-test here, you can comment /retest to rerun github workflow if github workflow is failing and it's not releated with this PR.

/ok-to-test

// KarmadaInitConfig defines the configuration for initializing Karmada
type KarmadaInitConfig struct {
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is not need, let's delete it.

Copy link
Member

Choose a reason for hiding this comment

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

Do you mean the metav1.ObjectMeta? It makes sense to me.
Please add a task to the tracking issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Updated, How about including it in #5306 (comment) (for Summer OSPP 2024)?, or alone PR for it

Copy link
Member

Choose a reason for hiding this comment

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

Both are OK to me. I just want somewhere track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. ok-to-test size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config file for karmadactl
6 participants