Skip to content

Commit 91375c1

Browse files
Apply suggestions from code review
Co-authored-by: Manoj Surudwad <[email protected]>
1 parent e3a3c16 commit 91375c1

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

api/v1alpha1/addon_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ type NutanixAddons struct {
8787
COSI *NutanixCOSI `json:"cosi,omitempty"`
8888

8989
// +kubebuilder:validation:Optional
90-
K8sRegistrationAgent *NutanixK8sRegistrationAgent `json:"k8sRegistrationAgent,omitempty"`
90+
KonnectorAgent *NutanixKonnectorAgent`json:"konnectorAgent,omitempty"`
9191
}
9292

9393
type GenericAddons struct {
@@ -363,7 +363,7 @@ type RegistryAddon struct {
363363
Provider string `json:"provider"`
364364
}
365365

366-
type NutanixK8sRegistrationAgent struct {
366+
type NutanixKonnectorAgent struct {
367367
// A reference to the Secret for credential information for the target Prism Central instance
368368
// +kubebuilder:validation:Optional
369369
Credentials *NutanixK8sAgentCredentials `json:"credentials,omitempty"`
@@ -376,7 +376,7 @@ type NutanixK8sRegistrationAgent struct {
376376
}
377377

378378
type NutanixK8sAgentCredentials struct {
379-
// A reference to the Secret containing the credentials used by the CCM provider.
379+
// A reference to the Secret containing the credentials used by the Konnector agent.
380380
// +kubebuilder:validation:Required
381381
SecretRef LocalObjectReference `json:"secretRef"`
382382
}

charts/cluster-api-runtime-extensions-nutanix/addons/k8s-registration-agent/values-template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ pc:
66
insecure: {{ .PrismCentralInsecure }} #set this to true if PC does not have https enabled
77
endpoint: {{ .PrismCentralHost }} # eg: ip or fqdn
88
k8sClusterName: {{ .ClusterName }}
9-
9+
k8sDistribution: NKP
1010
createSecret: false

pkg/handlers/lifecycle/handlers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type Handlers struct {
4848
localPathCSIConfig *localpath.Config
4949
snapshotControllerConfig *snapshotcontroller.Config
5050
cosiControllerConfig *cosi.ControllerConfig
51-
k8sRegistrationAgentConfig *k8sregistrationagent.ControllerConfig
51+
k8sRegistrationAgentConfig *k8sregistrationagent.Config
5252
distributionConfig *cncfdistribution.Config
5353
}
5454

@@ -71,7 +71,7 @@ func New(
7171
localPathCSIConfig: localpath.NewConfig(globalOptions),
7272
snapshotControllerConfig: snapshotcontroller.NewConfig(globalOptions),
7373
cosiControllerConfig: cosi.NewControllerConfig(globalOptions),
74-
k8sRegistrationAgentConfig: k8sregistrationagent.NewControllerConfig(globalOptions),
74+
k8sRegistrationAgentConfig: k8sregistrationagent.NewConfig(globalOptions),
7575
distributionConfig: &cncfdistribution.Config{GlobalOptions: globalOptions},
7676
}
7777
}

pkg/handlers/lifecycle/k8sregistrationagent/handler.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import (
3737
const (
3838
defaultHelmReleaseName = "k8s-registration-agent"
3939
defaultHelmReleaseNamespace = "ntnx-system"
40-
defaultK8sAgentName = "nutanix-agent"
40+
defaultK8sAgentName = "konnector-agent"
4141
defaultCredentialsSecretName = defaultK8sAgentName
4242
)
4343

@@ -63,7 +63,7 @@ func (c *ControllerConfig) AddFlags(prefix string, flags *pflag.FlagSet) {
6363

6464
type DefaultK8sRegistrationAgent struct {
6565
client ctrlclient.Client
66-
config *ControllerConfig
66+
config *Config
6767
helmChartInfoGetter *config.HelmChartGetter
6868

6969
variableName string // points to the global config variable
@@ -246,14 +246,6 @@ func (n *DefaultK8sRegistrationAgent) apply(
246246
n.client,
247247
helmChart,
248248
).WithValueTemplater(templateValuesFunc(clusterConfigVar.Nutanix, cluster))
249-
case v1alpha1.AddonStrategyClusterResourceSet:
250-
resp.SetStatus(runtimehooksv1.ResponseStatusFailure)
251-
resp.SetMessage(
252-
fmt.Sprintf(
253-
"strategy %q not provided for K8s Registration Agent", v1alpha1.AddonStrategyClusterResourceSet,
254-
),
255-
)
256-
return
257249
case "":
258250
resp.SetStatus(runtimehooksv1.ResponseStatusFailure)
259251
resp.SetMessage("strategy not provided for K8s Registration Agent")

0 commit comments

Comments
 (0)