-
Notifications
You must be signed in to change notification settings - Fork 21
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
Implemented the unmanaged cluster CRD for adopting existing k8s clusters #623
Conversation
kind: ClusterRole | ||
metadata: | ||
labels: | ||
hmc.mirantis.com/aggregate-to-global-admin: "true" |
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 think rbac considerations should be similar to managedclusters, unless it was decided otherwise
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.
IMO The design of using unmanaged cluster as an infrastructure provider looks needlessly complicated for our purposes.
Status handling logic should be reconsidered.
kubebuilder comments must be cleared out.
d20e204
to
c689cd1
Compare
06ec211
to
56bd578
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.
Minor comments from my side. @kylewuolle could you please address unresolved comments from Andrey, rebase the PR, and resolve all the conflicts?
// +kubebuilder:default:=false | ||
Ready bool `json:"ready"` | ||
|
||
// Conditions contains details for the current state of the ManagedCluster. |
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.
// Conditions contains details for the current state of the ManagedCluster. | |
// Conditions contains details for the current state of the UnmanagedCluster. |
// Flag indicating whether the machine is in the ready state or not | ||
// +kubebuilder:default:=false | ||
Ready bool `json:"ready,omitempty"` | ||
// Conditions contains details for the current state of the ManagedCluster |
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.
// Conditions contains details for the current state of the ManagedCluster | |
// Conditions contains details for the current state of the UnmanagedCluster |
Name: unmanagedCluster.Name, | ||
Namespace: unmanagedCluster.Namespace, | ||
Labels: map[string]string{ | ||
"helm.toolkit.fluxcd.io/name": unmanagedCluster.Name, |
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.
Can be replaced with hmc.FluxHelmChartNameKey
Namespace: unmanagedCluster.Namespace, | ||
Labels: map[string]string{ | ||
"helm.toolkit.fluxcd.io/name": unmanagedCluster.Name, | ||
"helm.toolkit.fluxcd.io/namespace": unmanagedCluster.Namespace, |
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.
"helm.toolkit.fluxcd.io/namespace": unmanagedCluster.Namespace, | |
hmc.FluxHelmChartNamespaceKey: unmanagedCluster.Namespace, |
return nil, nil | ||
} | ||
|
||
kubecfgSeccret := &corev1.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.
kubecfgSeccret := &corev1.Secret{} | |
kubecfgSecret := &corev1.Secret{} |
"with key %s", kubecfgSeccret.Name, secret.KubeconfigDataName)) | ||
} | ||
|
||
if cluserNameLabel, ok := kubecfgSeccret.Labels[v1beta1.ClusterNameLabel]; !ok || cluserNameLabel != unmanagedCluster.Name { |
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.
if cluserNameLabel, ok := kubecfgSeccret.Labels[v1beta1.ClusterNameLabel]; !ok || cluserNameLabel != unmanagedCluster.Name { | |
if clusterNameLabel, ok := kubecfgSeccret.Labels[v1beta1.ClusterNameLabel]; !ok || cluserNameLabel != unmanagedCluster.Name { |
Spec: v1beta1.ClusterSpec{ | ||
ControlPlaneEndpoint: controlPlaneEndPoint, | ||
InfrastructureRef: &corev1.ObjectReference{ | ||
Kind: "UnmanagedCluster", |
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.
Kind: "UnmanagedCluster", | |
Kind: hmc.UnmanagedClusterKind, |
OwnerReferences: []metav1.OwnerReference{ | ||
{ | ||
APIVersion: hmc.GroupVersion.Identifier(), | ||
Kind: "UnmanagedMachine", |
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.
Kind: "UnmanagedMachine", | |
Kind: hmc.UnmanagedMachineKind, |
Resolves #542
This PR implements adopting existing k8s clusters into 2a.