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: update kkcore CRDs #2410

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

dbbDylan
Copy link

What type of PR is this?

/kind feature
/kind design

What this PR does / why we need it:

Update kkcore CRDs for CAPKK

Which issue(s) this PR fixes:

Fixes #

Does this PR introduced a user-facing change?

- update: add `PipelineTemplate` CRD for CAPKK, used for create `Pipeline`.
- update: add `.Status.HostMachineMapping` for `Inventory`, used for update status between `KKMachine` and `Hosts`.

@kubesphere-prow kubesphere-prow bot added release-note kind/feature Categorizes issue or PR as related to a new feature. kind/design Categorizes issue or PR as related to design. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 18, 2024
Copy link

sonarcloud bot commented Sep 18, 2024

Comment on lines +83 to +108
// GetHostsFromGroup flatten a specific `Inventory` group with de-duplication.
func GetHostsFromGroup(inv *Inventory, groupName string, unavailableHosts, unavailableGroups map[string]struct{}) []string {
var hosts = make([]string, 0)
if v, ok := inv.Spec.Groups[groupName]; ok {
unavailableGroups[groupName] = struct{}{}
for _, cg := range v.Groups {
if _, exist := unavailableGroups[cg]; !exist {
unavailableGroups[cg] = struct{}{}
hosts = append(hosts, GetHostsFromGroup(inv, cg, unavailableHosts, unavailableGroups)...)
}
}

validHosts := make([]string, 0)
for _, hostName := range v.Hosts {
if _, ok := inv.Spec.Hosts[hostName]; ok {
if _, exist := unavailableHosts[hostName]; !exist {
unavailableHosts[hostName] = struct{}{}
validHosts = append(validHosts, hostName)
}
}
}
hosts = append(hosts, validHosts...)
}

return hosts
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

move in variable package

Copy link
Author

Choose a reason for hiding this comment

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

This logic is unique for inventory CRD, so I don't need to move it.

By the way, variable is for playbook, which will store variables when the playbook being executed. But GetHostsFromGroup used for init a valid inventory.

Copy link
Collaborator

Choose a reason for hiding this comment

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

should not set as a crd.

Copy link
Author

@dbbDylan dbbDylan Oct 10, 2024

Choose a reason for hiding this comment

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

Adjusted in PR#2425

@redscholar redscholar added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 10, 2024
@kubesphere-prow kubesphere-prow bot merged commit 44c9153 into kubesphere:feature-gitops Oct 10, 2024
5 checks passed
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: dbbDylan

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

redscholar added a commit that referenced this pull request Oct 10, 2024
@dbbDylan dbbDylan mentioned this pull request Oct 10, 2024
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/design Categorizes issue or PR as related to design. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note 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.

2 participants