Skip to content

Commit c4cab21

Browse files
minor changes
1 parent c3015b4 commit c4cab21

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

docs/content/addons/k8s-registration-agent.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
+++
2-
title = " Kubernets cluster registration addon"
2+
title = "Kubernetes cluster registration addon"
33
icon = "fa-solid fa-object-group"
44
+++
55

@@ -26,5 +26,5 @@ spec:
2626
k8sRegistrationAgent: {}
2727
```
2828
29-
[Container Object Storage Interface]: https://github.com/nutanix-core/k8s-agent
29+
[Kubernetes cluster registration agent]: https://github.com/nutanix-core/k8s-agent
3030
[Cluster API Add-on Provider for Helm]: https://github.com/kubernetes-sigs/cluster-api-addon-provider-helm

pkg/handlers/generic/lifecycle/k8sregistrationagent/handler.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func NewControllerConfig(globalOptions *options.GlobalOptions) *ControllerConfig
4444
return &ControllerConfig{
4545
GlobalOptions: globalOptions,
4646
helmAddonConfig: addons.NewHelmAddonConfig(
47-
"default-k8sRegistrationAgent--helm-values-template",
47+
"default-k8s-registrationagent-helm-values-template",
4848
defaultHelmReleaseNamespace,
4949
defaultHelmReleaseName,
5050
),
@@ -55,7 +55,7 @@ func (c *ControllerConfig) AddFlags(prefix string, flags *pflag.FlagSet) {
5555
c.helmAddonConfig.AddFlags(prefix+".helm-addon", flags)
5656
}
5757

58-
type DefaultK8sRegistrtionAgent struct {
58+
type DefaultK8sRegistrationAgent struct {
5959
client ctrlclient.Client
6060
config *ControllerConfig
6161
helmChartInfoGetter *config.HelmChartGetter
@@ -65,17 +65,17 @@ type DefaultK8sRegistrtionAgent struct {
6565
}
6666

6767
var (
68-
_ commonhandlers.Named = &DefaultK8sRegistrtionAgent{}
69-
_ lifecycle.AfterControlPlaneInitialized = &DefaultK8sRegistrtionAgent{}
70-
_ lifecycle.BeforeClusterUpgrade = &DefaultK8sRegistrtionAgent{}
68+
_ commonhandlers.Named = &DefaultK8sRegistrationAgent{}
69+
_ lifecycle.AfterControlPlaneInitialized = &DefaultK8sRegistrationAgent{}
70+
_ lifecycle.BeforeClusterUpgrade = &DefaultK8sRegistrationAgent{}
7171
)
7272

7373
func New(
7474
c ctrlclient.Client,
7575
cfg *ControllerConfig,
7676
helmChartInfoGetter *config.HelmChartGetter,
77-
) *DefaultK8sRegistrtionAgent {
78-
return &DefaultK8sRegistrtionAgent{
77+
) *DefaultK8sRegistrationAgent {
78+
return &DefaultK8sRegistrationAgent{
7979
client: c,
8080
config: cfg,
8181
helmChartInfoGetter: helmChartInfoGetter,
@@ -84,11 +84,11 @@ func New(
8484
}
8585
}
8686

87-
func (n *DefaultK8sRegistrtionAgent) Name() string {
87+
func (n *DefaultK8sRegistrationAgent) Name() string {
8888
return "K8sRegistrationAgentHandler"
8989
}
9090

91-
func (n *DefaultK8sRegistrtionAgent) AfterControlPlaneInitialized(
91+
func (n *DefaultK8sRegistrationAgent) AfterControlPlaneInitialized(
9292
ctx context.Context,
9393
req *runtimehooksv1.AfterControlPlaneInitializedRequest,
9494
resp *runtimehooksv1.AfterControlPlaneInitializedResponse,
@@ -99,7 +99,7 @@ func (n *DefaultK8sRegistrtionAgent) AfterControlPlaneInitialized(
9999
resp.Message = commonResponse.GetMessage()
100100
}
101101

102-
func (n *DefaultK8sRegistrtionAgent) BeforeClusterUpgrade(
102+
func (n *DefaultK8sRegistrationAgent) BeforeClusterUpgrade(
103103
ctx context.Context,
104104
req *runtimehooksv1.BeforeClusterUpgradeRequest,
105105
resp *runtimehooksv1.BeforeClusterUpgradeResponse,
@@ -110,7 +110,7 @@ func (n *DefaultK8sRegistrtionAgent) BeforeClusterUpgrade(
110110
resp.Message = commonResponse.GetMessage()
111111
}
112112

113-
func (n *DefaultK8sRegistrtionAgent) apply(
113+
func (n *DefaultK8sRegistrationAgent) apply(
114114
ctx context.Context,
115115
cluster *clusterv1.Cluster,
116116
resp *runtimehooksv1.CommonResponse,

pkg/handlers/generic/lifecycle/k8sregistrationagent/variables_test.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@ import (
55
"testing"
66

77
"github.com/spf13/pflag"
8+
"github.com/stretchr/testify/assert"
9+
"github.com/stretchr/testify/require"
810
corev1 "k8s.io/api/core/v1"
11+
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
912
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1013
"k8s.io/apimachinery/pkg/runtime"
1114
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
1215
runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1"
1316
"sigs.k8s.io/controller-runtime/pkg/client/fake"
1417

15-
"github.com/stretchr/testify/assert"
16-
"github.com/stretchr/testify/require"
17-
1818
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/v1alpha1"
1919
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/generic/lifecycle/config"
2020
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/pkg/handlers/options"
21-
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2221
)
2322

2423
var testScheme = runtime.NewScheme()
@@ -28,14 +27,14 @@ func init() {
2827
_ = clusterv1.AddToScheme(testScheme)
2928
}
3029

31-
func newTestHandler(t *testing.T) *DefaultK8sRegistrtionAgent {
30+
func newTestHandler(t *testing.T) *DefaultK8sRegistrationAgent {
3231
t.Helper()
3332

3433
client := fake.NewClientBuilder().WithScheme(testScheme).Build()
3534
cfg := NewControllerConfig(&options.GlobalOptions{})
3635
getter := &config.HelmChartGetter{} // not used directly in test
3736

38-
return &DefaultK8sRegistrtionAgent{
37+
return &DefaultK8sRegistrationAgent{
3938
client: client,
4039
config: cfg,
4140
helmChartInfoGetter: getter,
@@ -69,8 +68,10 @@ func TestApply_FailsWhenCredentialsMissing(t *testing.T) {
6968
Spec: clusterv1.ClusterSpec{
7069
Topology: &clusterv1.Topology{
7170
Variables: []clusterv1.ClusterVariable{{
72-
Name: v1alpha1.ClusterConfigVariableName,
73-
Value: apiextensionsv1.JSON{Raw: []byte(`{"addons":{"k8sRegistrationAgent":{"strategy":"HelmAddon"}}}`)},
71+
Name: v1alpha1.ClusterConfigVariableName,
72+
Value: apiextensionsv1.JSON{
73+
Raw: []byte(`{"addons":{"k8sRegistrationAgent":{"strategy":"HelmAddon"}}}`),
74+
},
7475
}},
7576
},
7677
},
@@ -571,7 +572,7 @@ func TestApply_SuccessfulWithFullNutanixConfig(t *testing.T) {
571572
client := fake.NewClientBuilder().WithScheme(testScheme).Build()
572573
cfg := NewControllerConfig(&options.GlobalOptions{})
573574

574-
handler := &DefaultK8sRegistrtionAgent{
575+
handler := &DefaultK8sRegistrationAgent{
575576
client: client,
576577
config: cfg,
577578
helmChartInfoGetter: &config.HelmChartGetter{},

0 commit comments

Comments
 (0)