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
[customcluster] fix configContent is nil bug #361
Conversation
Signed-off-by: Xieql <xieqianglong@huawei.com>
✅ Deploy Preview for kurator-dev canceled.
|
if cc.Spec.ControlPlaneConfig != nil { | ||
configContent.ControlPlaneCertSANs = strings.Join(cc.Spec.ControlPlaneConfig.CertSANs, ",") | ||
configContent.ControlPlaneAddress = cc.Spec.ControlPlaneConfig.Address | ||
configContent.LoadBalancerDomainName = cc.Spec.ControlPlaneConfig.LoadBalancerDomainName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just one questiom: do we allow these fields to be empty?
ControlPlaneConfig.CertSANs
ControlPlaneConfig.Address
ControlPlaneConfig.LoadBalancerDomainName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, these fields could be left empty under certain circumstances. Here is the interpretation of each field being empty:
ControlPlaneConfig.CertSANs: If this field is empty, it indicates that the user has not specified any additional Subject Alternative Names for the Kubernetes API Server certificate. This is suitable for simple deployments where the API server is accessed from a single and unchanging address, typically the address of the first master node.
ControlPlaneConfig.Address: If this field is empty, Kubespray will default to using the IP address of the first master node listed in the configuration as the Control Plane (API Server) address. This is often the case for straightforward, non-HA deployments where there's no need for a load balancer to distribute traffic among multiple master nodes.
ControlPlaneConfig.LoadBalancerDomainName: If this field is empty, it means that the user has not specified a domain name for a load balancer. This is fine for deployments where a load balancer is not used, or where access to the API Server is only required via IP address.
In summary, if you are deploying in a simple environment, such as for testing or development purposes where a single master node without a load balancer or HA mode is sufficient, you can leave the ControlPlaneConfig fields empty. The system will apply default settings that allow for quick and easy setup of a on-premise Kubernetes cluster. However, for more complex or production environments, it's recommended to carefully consider and appropriately set these fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu 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 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
If the
ControlPlaneConfig
parameter is not set, a null pointer exception will occur. Therefore, it is necessary to check its existence in the code.Other variables were also checked in a similar manner. However, since they are mandatory and guaranteed to be non-nil during the admission phase, no changes were required.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: