-
Notifications
You must be signed in to change notification settings - Fork 340
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
HOSTEDCP-1960: Add KubeAPIExteralName api #5458
base: main
Are you sure you want to change the base?
Conversation
@jparrill: This pull request references HOSTEDCP-1960 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.19.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jparrill 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 |
90afcc8
to
c866941
Compare
@jparrill: This pull request references HOSTEDCP-1960 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.19.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
@jparrill: This pull request references HOSTEDCP-1960 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.19.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
5152979
to
0ecdf6a
Compare
Can we elaborate on this? Which topologies is this use case targeting: privateAndPublic, private, public? |
0ecdf6a
to
d6e3182
Compare
@jparrill: This pull request references HOSTEDCP-1960 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.19.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
d6e3182
to
dfb1320
Compare
f68c435
to
1fd6696
Compare
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.
Some nits in the API. In general, please use consistent case for "kubeconfig" wherever it appears in the API.
// +optional | ||
CustomKubeConfig *KubeconfigSecretRef `json:"customkubeconfig,omitempty"` | ||
|
||
// kubeApiCustomName specifies the external name for the Kube API Server service. |
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.
s/kubeApiCustomName/kubeAPICustomName
@@ -115,6 +115,10 @@ type HostedControlPlaneSpec struct { | |||
// +optional | |||
KubeConfig *KubeconfigSecretRef `json:"kubeconfig,omitempty"` | |||
|
|||
// KubeAPICustomKubeconfig is a group that encompasses an additional KAS server address and the customKubeconfig generated for the kube-apiserver. |
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.
fix
@@ -300,6 +324,12 @@ type HostedControlPlaneStatus struct { | |||
// for this control plane. | |||
KubeConfig *KubeconfigSecretRef `json:"kubeConfig,omitempty"` | |||
|
|||
// CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret. |
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.
fix
@@ -432,6 +432,15 @@ type HostedClusterSpec struct { | |||
// +required | |||
Platform PlatformSpec `json:"platform"` | |||
|
|||
// kubeApiCustomName specifies the external name for the Kube API Server service. |
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.
s/kubeApiCustomName/kubeAPICustomName/
@@ -1423,6 +1432,13 @@ type HostedClusterStatus struct { | |||
// +optional | |||
KubeConfig *corev1.LocalObjectReference `json:"kubeconfig,omitempty"` | |||
|
|||
// CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret. |
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.
fix
This new API changes the value of the Kubeconfig External URL to points to your desired one Signed-off-by: Juan Manuel Parrilla Madrid <[email protected]>
1fd6696
to
22b1bdb
Compare
@jparrill: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
func adaptCustomAdminKubeconfigSecret(cpContext component.WorkloadContext, secret *corev1.Secret) error { | ||
hcp := cpContext.HCP | ||
|
||
if hcp.Spec.KubeConfig != nil { |
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.
I assume you want hcp.Spec.KubeAPICustomKubeconfig != nil
here, right?
@@ -90,6 +90,29 @@ func adaptDeployment(cpContext component.WorkloadContext, deployment *appsv1.Dep | |||
return nil | |||
} | |||
|
|||
func adaptCustomAdminKubeconfigSecret(cpContext component.WorkloadContext, secret *corev1.Secret) error { |
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.
please move this function to kubeconfig.go
file
|
||
// EnableIfCustomKubeconfig is a helper predicate for the common use case of enabling a resource when a KubeAPICustomKubeconfig is specified. | ||
func EnableIfCustomKubeconfig() option { | ||
return WithPredicate(func(cpContext WorkloadContext) bool { |
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.
I don't think any other component will use this predicate other than kas.
let's move it to the kas package where its used.
See this as an example https://github.com/muraee/hypershift/blob/karpenter-userdata/control-plane-operator/controllers/hostedcontrolplane/v2/cno/component.go#L47
This new API autogenerate a new kubeconfig based on a desired url and managed by HCP.
What this PR does / why we need it:
The current implementation of HCP to define the KAS address is using the ServicePublishingType, where you can define a hostname and that, will customize the API and API-INT interfaces where all the kubeconfigs (excepts the ones pointing to local) are pointing to. This makes the customization rigid and customers are asking for more flexibility.
This PR adds a new API which creates a new Kubeconfig (certificate based) pointing to the desired address. With this new API you can:
customKubeconfig
Which issue(s) this PR fixes:
Checklist