Skip to content

refactor: Use a Credentials struct consistently #663

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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions api/v1alpha1/addon_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ type CSIProvider struct {

// The reference to any secret used by the CSI Provider.
// +kubebuilder:validation:Optional
Credentials *LocalObjectReference `json:"credentials,omitempty"`
Credentials *CSICredentials `json:"credentials,omitempty"`
}

type StorageClassConfig struct {
Expand Down Expand Up @@ -174,11 +174,23 @@ type StorageClassConfig struct {
AllowExpansion bool `json:"allowExpansion,omitempty"`
}

type CSICredentials struct {
// A reference to the Secret containing the credentials used by the CSI provider.
// +kubebuilder:validation:Required
SecretRef LocalObjectReference `json:"secretRef"`
}

// CCM tells us to enable or disable the cloud provider interface.
type CCM struct {
// A reference to the Secret for credential information for the target Prism Central instance
// +kubebuilder:validation:Optional
Credentials *LocalObjectReference `json:"credentials,omitempty"`
Credentials *CCMCredentials `json:"credentials,omitempty"`
}

type CCMCredentials struct {
// A reference to the Secret containing the credentials used by the CCM provider.
// +kubebuilder:validation:Required
SecretRef LocalObjectReference `json:"secretRef"`
}

type ServiceLoadBalancer struct {
Expand Down
42 changes: 28 additions & 14 deletions api/v1alpha1/crds/caren.nutanix.com_awsclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,21 @@ spec:
description: A reference to the Secret for credential information
for the target Prism Central instance
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
secretRef:
description: A reference to the Secret containing the
credentials used by the CCM provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
required:
- name
type: object
required:
- name
- secretRef
type: object
type: object
clusterAutoscaler:
Expand Down Expand Up @@ -123,14 +130,21 @@ spec:
description: The reference to any secret used by the
CSI Provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
secretRef:
description: A reference to the Secret containing
the credentials used by the CSI provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
required:
- name
type: object
required:
- name
- secretRef
type: object
name:
description: Name of the CSI Provider.
Expand Down
42 changes: 28 additions & 14 deletions api/v1alpha1/crds/caren.nutanix.com_dockerclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,21 @@ spec:
description: A reference to the Secret for credential information
for the target Prism Central instance
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
secretRef:
description: A reference to the Secret containing the
credentials used by the CCM provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
required:
- name
type: object
required:
- name
- secretRef
type: object
type: object
clusterAutoscaler:
Expand Down Expand Up @@ -124,14 +131,21 @@ spec:
description: The reference to any secret used by the
CSI Provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
secretRef:
description: A reference to the Secret containing
the credentials used by the CSI provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
required:
- name
type: object
required:
- name
- secretRef
type: object
name:
description: Name of the CSI Provider.
Expand Down
42 changes: 28 additions & 14 deletions api/v1alpha1/crds/caren.nutanix.com_genericclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,21 @@ spec:
description: A reference to the Secret for credential information
for the target Prism Central instance
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
secretRef:
description: A reference to the Secret containing the
credentials used by the CCM provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
required:
- name
type: object
required:
- name
- secretRef
type: object
type: object
clusterAutoscaler:
Expand Down Expand Up @@ -132,14 +139,21 @@ spec:
description: The reference to any secret used by the
CSI Provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
secretRef:
description: A reference to the Secret containing
the credentials used by the CSI provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
required:
- name
type: object
required:
- name
- secretRef
type: object
name:
description: Name of the CSI Provider.
Expand Down
63 changes: 42 additions & 21 deletions api/v1alpha1/crds/caren.nutanix.com_nutanixclusterconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,21 @@ spec:
description: A reference to the Secret for credential information
for the target Prism Central instance
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
secretRef:
description: A reference to the Secret containing the
credentials used by the CCM provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
required:
- name
type: object
required:
- name
- secretRef
type: object
type: object
clusterAutoscaler:
Expand Down Expand Up @@ -124,14 +131,21 @@ spec:
description: The reference to any secret used by the
CSI Provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
secretRef:
description: A reference to the Secret containing
the credentials used by the CSI provider.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
required:
- name
type: object
required:
- name
- secretRef
type: object
name:
description: Name of the CSI Provider.
Expand Down Expand Up @@ -571,14 +585,21 @@ spec:
description: A reference to the Secret for credential information
for the target Prism Central instance.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
secretRef:
description: A reference to the Secret containing the
Prism Central credentials.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
minLength: 1
type: string
required:
- name
type: object
required:
- name
- secretRef
type: object
insecure:
description: use insecure connection to Prism Central endpoint
Expand Down
8 changes: 7 additions & 1 deletion api/v1alpha1/nutanix_clusterconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ type NutanixPrismCentralEndpointSpec struct {

// A reference to the Secret for credential information for the target Prism Central instance.
// +kubebuilder:validation:Required
Credentials LocalObjectReference `json:"credentials"`
Credentials NutanixPrismCentralEndpointCredentials `json:"credentials"`
}

type NutanixPrismCentralEndpointCredentials struct {
// A reference to the Secret containing the Prism Central credentials.
// +kubebuilder:validation:Required
SecretRef LocalObjectReference `json:"secretRef"`
}

//nolint:gocritic // No need for named return values
Expand Down
54 changes: 52 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading