Skip to content

Commit

Permalink
chore: fix failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iziang committed Jul 24, 2023
1 parent 3afe592 commit ff41c28
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion apis/apps/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type ClusterSpec struct {
// +optional
AvailabilityPolicy AvailabilityPolicyType `json:"availabilityPolicy,omitempty"`

// Services expose endpoints that can be accessed by clients.
// Services expose cluster endpoints that can be accessed by clients.
// +optional
Services []ClusterComponentService `json:"services,omitempty"`

Expand Down
3 changes: 1 addition & 2 deletions apis/apps/v1alpha1/clusterdefinition_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ type ClusterDefinitionSpec struct {
// - `$(UUID_HEX)` - generate a random UUID v4 HEX representation.
// - `$(HEADLESS_SVC_FQDN)` - headless service FQDN placeholder, value pattern - $(CLUSTER_NAME)-$(FRONTEND_COMP_NAME)-headless.$(NAMESPACE).svc,
// where FRONTEND_COMP_NAME is the frontend component that provide `ClusterDefinition.spec.componentDefs[].service` attribute;
// - `$(SVC_FQDN)` - service FQDN placeholder, value pattern - $(CLUSTER_NAME)-$(FRONTEND_COMP_NAME).$(NAMESPACE).svc,
// where FRONTEND_COMP_NAME is the frontend component that provide `ClusterDefinition.spec.componentDefs[].service` attribute;
// - `$(SVC_FQDN)` - service FQDN placeholder, value pattern - $(CLUSTER_NAME).$(NAMESPACE).svc,
// - `$(SVC_PORT_{PORT-NAME})` - a ServicePort's port value with specified port name, i.e, a servicePort JSON struct:
// `{"name": "mysql", "targetPort": "mysqlContainerPort", "port": 3306}`, and "$(SVC_PORT_mysql)" in the
// connection credential value is 3306.
Expand Down
12 changes: 5 additions & 7 deletions config/crd/bases/apps.kubeblocks.io_clusterdefinitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9286,13 +9286,11 @@ spec:
headless service FQDN placeholder, value pattern - $(CLUSTER_NAME)-$(FRONTEND_COMP_NAME)-headless.$(NAMESPACE).svc,
where FRONTEND_COMP_NAME is the frontend component that provide
`ClusterDefinition.spec.componentDefs[].service` attribute; - `$(SVC_FQDN)`
- service FQDN placeholder, value pattern - $(CLUSTER_NAME)-$(FRONTEND_COMP_NAME).$(NAMESPACE).svc,
where FRONTEND_COMP_NAME is the frontend component that provide
`ClusterDefinition.spec.componentDefs[].service` attribute; - `$(SVC_PORT_{PORT-NAME})`
- a ServicePort's port value with specified port name, i.e, a servicePort
JSON struct: `{\"name\": \"mysql\", \"targetPort\": \"mysqlContainerPort\",
\"port\": 3306}`, and \"$(SVC_PORT_mysql)\" in the connection credential
value is 3306."
- service FQDN placeholder, value pattern - $(CLUSTER_NAME).$(NAMESPACE).svc,
- `$(SVC_PORT_{PORT-NAME})` - a ServicePort's port value with specified
port name, i.e, a servicePort JSON struct: `{\"name\": \"mysql\",
\"targetPort\": \"mysqlContainerPort\", \"port\": 3306}`, and \"$(SVC_PORT_mysql)\"
in the connection credential value is 3306."
type: object
service:
description: service defines the cluster service spec.
Expand Down
3 changes: 2 additions & 1 deletion config/crd/bases/apps.kubeblocks.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@ spec:
x-kubernetes-int-or-string: true
type: object
services:
description: Services expose endpoints that can be accessed by clients.
description: Services expose cluster endpoints that can be accessed
by clients.
items:
properties:
annotations:
Expand Down
12 changes: 5 additions & 7 deletions deploy/helm/crds/apps.kubeblocks.io_clusterdefinitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9286,13 +9286,11 @@ spec:
headless service FQDN placeholder, value pattern - $(CLUSTER_NAME)-$(FRONTEND_COMP_NAME)-headless.$(NAMESPACE).svc,
where FRONTEND_COMP_NAME is the frontend component that provide
`ClusterDefinition.spec.componentDefs[].service` attribute; - `$(SVC_FQDN)`
- service FQDN placeholder, value pattern - $(CLUSTER_NAME)-$(FRONTEND_COMP_NAME).$(NAMESPACE).svc,
where FRONTEND_COMP_NAME is the frontend component that provide
`ClusterDefinition.spec.componentDefs[].service` attribute; - `$(SVC_PORT_{PORT-NAME})`
- a ServicePort's port value with specified port name, i.e, a servicePort
JSON struct: `{\"name\": \"mysql\", \"targetPort\": \"mysqlContainerPort\",
\"port\": 3306}`, and \"$(SVC_PORT_mysql)\" in the connection credential
value is 3306."
- service FQDN placeholder, value pattern - $(CLUSTER_NAME).$(NAMESPACE).svc,
- `$(SVC_PORT_{PORT-NAME})` - a ServicePort's port value with specified
port name, i.e, a servicePort JSON struct: `{\"name\": \"mysql\",
\"targetPort\": \"mysqlContainerPort\", \"port\": 3306}`, and \"$(SVC_PORT_mysql)\"
in the connection credential value is 3306."
type: object
service:
description: service defines the cluster service spec.
Expand Down
3 changes: 2 additions & 1 deletion deploy/helm/crds/apps.kubeblocks.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@ spec:
x-kubernetes-int-or-string: true
type: object
services:
description: Services expose endpoints that can be accessed by clients.
description: Services expose cluster endpoints that can be accessed
by clients.
items:
properties:
annotations:
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func BuildConnCredential(clusterDefinition *appsv1alpha1.ClusterDefinition, clus
"$(UUID_HEX)": uuidHex,
"$(SVC_FQDN)": fmt.Sprintf("%s.%s.svc", cluster.Name, cluster.Namespace),
"$(KB_CLUSTER_COMP_NAME)": cluster.Name + "-" + component.Name,
"$(HEADLESS_SVC_FQDN)": fmt.Sprintf("%s-headless.%s.svc", cluster.Name, cluster.Namespace),
"$(HEADLESS_SVC_FQDN)": fmt.Sprintf("%s-%s-headless.%s.svc", cluster.Name, component.Name, cluster.Namespace),
}
if len(component.ClusterServices) > 0 {
for _, p := range component.ClusterServices[0].Spec.Ports {
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ var _ = Describe("builder", func() {
}
Expect(credential.StringData["RANDOM_PASSWD"]).Should(HaveLen(8))
svcFQDN := fmt.Sprintf("%s.%s.svc", cluster.Name, cluster.Namespace)
headlessSvcFQDN := fmt.Sprintf("%s-headless.%s.svc", cluster.Name, cluster.Namespace)
headlessSvcFQDN := fmt.Sprintf("%s-%s-headless.%s.svc", cluster.Name, synthesizedComponent.Name, cluster.Namespace)
var mysqlPort corev1.ServicePort
var paxosPort corev1.ServicePort
for _, s := range synthesizedComponent.Services[0].Spec.Ports {
Expand Down

0 comments on commit ff41c28

Please sign in to comment.