Skip to content

Commit

Permalink
chore: remove new cluster conn-credential API (#6098)
Browse files Browse the repository at this point in the history
(cherry picked from commit 794b49a)
  • Loading branch information
leon-inf committed Dec 18, 2023
1 parent 12633b1 commit 8bda420
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 351 deletions.
17 changes: 6 additions & 11 deletions apis/apps/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ type ClusterSpec struct {
// +optional
Services []Service `json:"services,omitempty"`

// connectionCredentials defines the credentials used to access a cluster.
// affinity is a group of affinity scheduling rules.
// +optional
Affinity *Affinity `json:"affinity,omitempty"`

// tolerations are attached to tolerate any taint that matches the triple `key,value,effect` using the matching operator `operator`.
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
ConnectionCredentials []ConnectionCredential `json:"connectionCredentials,omitempty"`
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

// tenancy describes how pods are distributed across node.
// SharedNode means multiple pods may share the same node.
Expand All @@ -87,15 +91,6 @@ type ClusterSpec struct {
// +optional
AvailabilityPolicy AvailabilityPolicyType `json:"availabilityPolicy,omitempty"`

// affinity is a group of affinity scheduling rules.
// +optional
Affinity *Affinity `json:"affinity,omitempty"`

// tolerations are attached to tolerate any taint that matches the triple `key,value,effect` using the matching operator `operator`.
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

// replicas specifies the replicas of the first componentSpec, if the replicas of the first componentSpec is specified, this value will be ignored.
// +optional
Replicas *int32 `json:"replicas,omitempty"`
Expand Down
31 changes: 0 additions & 31 deletions apis/apps/v1alpha1/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,37 +622,6 @@ type Service struct {
RoleSelector string `json:"roleSelector,omitempty"`
}

type ConnectionCredential struct {
// The name of the ConnectionCredential.
// Cannot be updated.
// +required
Name string `json:"name"`

// ServiceName specifies the name of service to use for accessing.
// Cannot be updated.
// +optional
ServiceName string `json:"serviceName,omitempty"`

// PortName specifies the name of the port to access the service.
// If the service has multiple ports, a specific port must be specified to use here.
// Otherwise, the unique port of the service will be used.
// Cannot be updated.
// +optional
PortName string `json:"portName,omitempty"`

// ComponentName specifies the name of component where the account defined.
// For cluster-level connection credential, this field is required.
// Cannot be updated.
// +optional
ComponentName string `json:"componentName,omitempty"`

// AccountName specifies the name of account used to access the service.
// If specified, the account must be defined in @SystemAccounts.
// Cannot be updated.
// +optional
AccountName string `json:"accountName,omitempty"`
}

// List of all the built-in variables provided by KubeBlocks.
// These variables are automatically available when building environment variables for Pods and Actions, as well as
// rendering templates for config and script. Users can directly use these variables without explicit declaration.
Expand Down
20 changes: 0 additions & 20 deletions apis/apps/v1alpha1/zz_generated.deepcopy.go

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

34 changes: 0 additions & 34 deletions config/crd/bases/apps.kubeblocks.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -898,40 +898,6 @@ spec:
x-kubernetes-validations:
- message: duplicated component
rule: self.all(x, size(self.filter(c, c.name == x.name)) == 1)
connectionCredentials:
description: connectionCredentials defines the credentials used to
access a cluster.
items:
properties:
accountName:
description: AccountName specifies the name of account used
to access the service. If specified, the account must be defined
in @SystemAccounts. Cannot be updated.
type: string
componentName:
description: ComponentName specifies the name of component where
the account defined. For cluster-level connection credential,
this field is required. Cannot be updated.
type: string
name:
description: The name of the ConnectionCredential. Cannot be
updated.
type: string
portName:
description: PortName specifies the name of the port to access
the service. If the service has multiple ports, a specific
port must be specified to use here. Otherwise, the unique
port of the service will be used. Cannot be updated.
type: string
serviceName:
description: ServiceName specifies the name of service to use
for accessing. Cannot be updated.
type: string
required:
- name
type: object
type: array
x-kubernetes-preserve-unknown-fields: true
monitor:
description: monitor specifies the configuration of monitor
properties:
Expand Down
2 changes: 1 addition & 1 deletion controllers/apps/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
// update cluster components' status
&clusterComponentStatusTransformer{},
// create default cluster connection credential secret object
&clusterCredentialTransformer{},
&clusterConnCredentialTransformer{},
// build backuppolicy and backupschedule from backupPolicyTemplate
&clusterBackupPolicyTransformer{},
// add our finalizer to all objects
Expand Down
7 changes: 0 additions & 7 deletions controllers/apps/cluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,6 @@ var _ = Describe("Cluster Controller", func() {
})).Should(Succeed())
}

testClusterCredential := func(compName, compDefName string, createObj func(string, string, func(*testapps.MockClusterFactory))) {
}

testClusterAffinityNToleration := func(compName, compDefName string, createObj func(string, string, func(*testapps.MockClusterFactory))) {
const (
clusterTopologyKey = "testClusterTopologyKey"
Expand Down Expand Up @@ -752,10 +749,6 @@ var _ = Describe("Cluster Controller", func() {
testClusterService(consensusCompName, compDefName, createObj)
})

It("with cluster credential set", func() {
testClusterCredential(consensusCompName, compDefName, createObj)
})

It("with cluster affinity and toleration set", func() {
testClusterAffinityNToleration(consensusCompName, compDefName, createObj)
})
Expand Down
Loading

0 comments on commit 8bda420

Please sign in to comment.