@@ -18,7 +18,6 @@ package shard
1818
1919import (
2020 "fmt"
21- "strings"
2221
2322 "k8c.io/reconciler/pkg/reconciling"
2423
@@ -78,23 +77,8 @@ func DeploymentReconciler(shard *operatorv1alpha1.Shard, rootShard *operatorv1al
7877 MountPath : getCAMountPath (operatorv1alpha1 .RootCA ),
7978 }}
8079
81- image , _ := resources .GetImageSettings (shard .Spec .Image )
8280 args := getArgs (shard , rootShard )
8381
84- if shard .Spec .Etcd .TLSConfig != nil {
85- secretMounts = append (secretMounts , utils.SecretMount {
86- VolumeName : "etcd-client-cert" ,
87- SecretName : rootShard .Spec .Etcd .TLSConfig .SecretRef .Name ,
88- MountPath : "/etc/etcd/tls" ,
89- })
90-
91- args = append (args ,
92- "--etcd-certfile=/etc/etcd/tls/tls.crt" ,
93- "--etcd-keyfile=/etc/etcd/tls/tls.key" ,
94- "--etcd-cafile=/etc/etcd/tls/ca.crt" ,
95- )
96- }
97-
9882 for _ , cert := range []operatorv1alpha1.Certificate {
9983 // requires server CA and the shard client cert to be mounted
10084 operatorv1alpha1 .ClientCertificate ,
@@ -143,7 +127,6 @@ func DeploymentReconciler(shard *operatorv1alpha1.Shard, rootShard *operatorv1al
143127
144128 dep .Spec .Template .Spec .Containers = []corev1.Container {{
145129 Name : ServerContainerName ,
146- Image : image ,
147130 Command : []string {"/kcp" , "start" },
148131 Args : args ,
149132 VolumeMounts : volumeMounts ,
@@ -155,19 +138,9 @@ func DeploymentReconciler(shard *operatorv1alpha1.Shard, rootShard *operatorv1al
155138 }}
156139 dep .Spec .Template .Spec .Volumes = volumes
157140
158- // explicitly set the replicas if it is configured in the RootShard
159- // object or if the existing Deployment object doesn't have replicas
160- // configured. This will allow a HPA to interact with the replica
161- // count.
162- if shard .Spec .Replicas != nil {
163- dep .Spec .Replicas = shard .Spec .Replicas
164- } else if dep .Spec .Replicas == nil {
165- dep .Spec .Replicas = ptr.To [int32 ](2 )
166- }
167-
168- dep , err := utils .ApplyAuditConfiguration (dep , shard .Spec .Audit )
141+ dep , err := utils .ApplyCommonShardConfig (dep , & shard .Spec .CommonShardSpec )
169142 if err != nil {
170- return nil , fmt .Errorf ("failed to apply audit configuration: %w" , err )
143+ return nil , fmt .Errorf ("failed to shard configuration: %w" , err )
171144 }
172145
173146 return dep , nil
@@ -195,9 +168,6 @@ func getArgs(shard *operatorv1alpha1.Shard, rootShard *operatorv1alpha1.RootShar
195168 fmt .Sprintf ("--shard-client-key-file=%s/tls.crt" , getCertificateMountPath (operatorv1alpha1 .ClientCertificate )),
196169 fmt .Sprintf ("--shard-client-cert-file=%s/tls.key" , getCertificateMountPath (operatorv1alpha1 .ClientCertificate )),
197170
198- // Etcd client configuration.
199- fmt .Sprintf ("--etcd-servers=%s" , strings .Join (shard .Spec .Etcd .Endpoints , "," )),
200-
201171 // General shard configuration.
202172 fmt .Sprintf ("--shard-name=%s" , shard .Name ),
203173 fmt .Sprintf ("--external-hostname=%s" , resources .GetShardBaseHost (shard )),
0 commit comments