This is an automated email from the ASF dual-hosted git repository.
zhaojinchao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shardingsphere-on-cloud.git
The following commit(s) were added to refs/heads/main by this push:
new d37f463 fix(operator): fix mysqlDriver config and conditions nil
error (#179)
d37f463 is described below
commit d37f4631d8169d4f45440fb7be14ff98cc2389e0
Author: liyao <[email protected]>
AuthorDate: Wed Jan 11 13:27:16 2023 +0800
fix(operator): fix mysqlDriver config and conditions nil error (#179)
* fix: fix nil mysqlDriver
Signed-off-by: mlycore <[email protected]>
* fix: fix mysqlDriver config and conditions nil error
Signed-off-by: mlycore <[email protected]>
Signed-off-by: mlycore <[email protected]>
---
shardingsphere-operator/pkg/reconcile/deployment.go | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/shardingsphere-operator/pkg/reconcile/deployment.go
b/shardingsphere-operator/pkg/reconcile/deployment.go
index 7274142..29a2ea0 100644
--- a/shardingsphere-operator/pkg/reconcile/deployment.go
+++ b/shardingsphere-operator/pkg/reconcile/deployment.go
@@ -261,10 +261,12 @@ func updatePodTemplateSpec(proxy
*v1alpha1.ShardingSphereProxy, act *v1.Deployme
}
}
- initContainer := updateInitContainer(proxy, act)
- for i, _ := range exp.Spec.InitContainers {
- if exp.Spec.InitContainers[i].Name == "download-mysql-connect" {
- exp.Spec.InitContainers[i] = *initContainer
+ if proxy.Spec.MySQLDriver != nil {
+ initContainer := updateInitContainer(proxy, act)
+ for i, _ := range exp.Spec.InitContainers {
+ if exp.Spec.InitContainers[i].Name ==
"download-mysql-connect" {
+ exp.Spec.InitContainers[i] = *initContainer
+ }
}
}
@@ -420,13 +422,13 @@ func updateNotReadyConditions(conditions
[]v1alpha1.Condition, cond v1alpha1.Con
cur := newConditions(conditions, cond)
for idx, _ := range cur {
- if conditions[idx].Type == v1alpha1.ConditionReady {
- conditions[idx].LastUpdateTime = metav1.Now()
- conditions[idx].Status = metav1.ConditionFalse
+ if cur[idx].Type == v1alpha1.ConditionReady {
+ cur[idx].LastUpdateTime = metav1.Now()
+ cur[idx].Status = metav1.ConditionFalse
}
}
- return conditions
+ return cur
}
func clusterCondition(podlist corev1.PodList) v1alpha1.Condition {