Skip to content

Commit 344881f

Browse files
author
smiletan
committed
add kerberos envs
1 parent 2925398 commit 344881f

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

pkg/common/utils/resource/pod.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,23 +562,37 @@ func buildKerberosEnv(info *v1.KerberosInfo, config map[string]interface{}, comp
562562
return nil
563563
}
564564

565+
return buildKerberosEnvUseSecretMountPath(info.KeytabPath, config, string(componentType))
566+
}
567+
568+
func BuildKerberosEnvForDDC(info *dv1.KerberosInfo, config map[string]interface{}, componentType dv1.DisaggregatedComponentType)[]corev1.EnvVar {
569+
if info == nil {
570+
return nil
571+
}
572+
573+
return buildKerberosEnvUseSecretMountPath(info.KeytabPath, config, string(componentType))
574+
}
575+
576+
func buildKerberosEnvUseSecretMountPath(keytabPath string, config map[string]interface{}, componentType string) []corev1.EnvVar {
565577
var krb5ConfPath string
566578
switch componentType {
567-
case v1.Component_FE:
579+
case string(v1.Component_FE), string(dv1.DisaggregatedFE):
568580
krb5ConfPath = kerberos.GetKrb5ConfFromJavaOpts(config)
569-
case v1.Component_BE, v1.Component_CN:
581+
case string(v1.Component_BE), string(v1.Component_CN), string(dv1.DisaggregatedBE):
570582
// be config krb5.conf file must set 'kerberos_krb5_conf_path' in be.conf
571583
// https://doris.apache.org/docs/3.0/lakehouse/datalake-analytics/hive?_highlight=kerberos_krb5_conf_path#connect-to-kerberos-enabled-hive
572584
if value, exists := config["kerberos_krb5_conf_path"]; exists {
573585
krb5ConfPath = value.(string)
574586
} else {
575587
krb5ConfPath = kerberos.KRB5_DEFAULT_CONFIG
576588
}
589+
default:
590+
klog.Errorf("BuildKerberosEnvUseSecretMountPath, componentType %s not supported.", componentType)
577591
}
578592

579593
keytabFinalUsedPath := keytab_default_mount_path
580-
if info.KeytabPath != "" {
581-
keytabFinalUsedPath = info.KeytabPath
594+
if keytabPath != "" {
595+
keytabFinalUsedPath = keytabPath
582596
}
583597

584598
return []corev1.EnvVar{

pkg/controller/sub_controller/disaggregated_cluster/computegroups/statefulset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (dcgs *DisaggregatedComputeGroupsController) NewPodTemplateSpec(ddc *dv1.Do
116116
}
117117

118118
//add last supplementary spec. if add new config in ddc spec and the config need add in pod, use the follow function to add.
119-
dcgs.DisaggregatedSubDefaultController.AddClusterSpecForPodTemplate(dv1.DisaggregatedBE, &ddc.Spec, &pts)
119+
dcgs.DisaggregatedSubDefaultController.AddClusterSpecForPodTemplate(dv1.DisaggregatedBE, cvs, &ddc.Spec, &pts)
120120
cgUniqueId := selector[dv1.DorisDisaggregatedComputeGroupUniqueId]
121121
pts.Spec.Affinity = dcgs.ConstructDefaultAffinity(dv1.DorisDisaggregatedComputeGroupUniqueId, cgUniqueId, pts.Spec.Affinity)
122122

pkg/controller/sub_controller/disaggregated_cluster/disaggregated_fe/statefulset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (dfc *DisaggregatedFEController) NewStatefulset(ddc *v1.DorisDisaggregatedC
6161
_, _, vcts := dfc.BuildVolumesVolumeMountsAndPVCs(confMap, v1.DisaggregatedFE, &spec.CommonSpec)
6262
pts := dfc.NewPodTemplateSpec(ddc, confMap)
6363
//add last supplementary spec. if add new config in ddc spec and the config need add in pod, use the follow function to add.
64-
dfc.DisaggregatedSubDefaultController.AddClusterSpecForPodTemplate(v1.DisaggregatedFE, &ddc.Spec, &pts)
64+
dfc.DisaggregatedSubDefaultController.AddClusterSpecForPodTemplate(v1.DisaggregatedFE,confMap, &ddc.Spec, &pts)
6565
st := dfc.NewDefaultStatefulset(ddc)
6666
//metadata
6767
func() {

pkg/controller/sub_controller/disaggregated_subcontroller.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,7 @@ func (d *DisaggregatedSubDefaultController) GetManagementAdminUserAndPWD(ctx con
295295
}
296296

297297
// add cluster specification on container spec. this is useful to add common spec on different type pods, example: kerberos volume for fe and be.
298-
func(d *DisaggregatedSubDefaultController) AddClusterSpecForPodTemplate(componentType v1.DisaggregatedComponentType, spec *v1.DorisDisaggregatedClusterSpec, pts *corev1.PodTemplateSpec){
299-
//TODO: realize the kerberos volumeMounts added.
298+
func(d *DisaggregatedSubDefaultController) AddClusterSpecForPodTemplate(componentType v1.DisaggregatedComponentType, configMap map[string]interface{}, spec *v1.DorisDisaggregatedClusterSpec, pts *corev1.PodTemplateSpec){
300299
var c *corev1.Container
301300
switch componentType {
302301
case v1.DisaggregatedFE:
@@ -319,6 +318,12 @@ func(d *DisaggregatedSubDefaultController) AddClusterSpecForPodTemplate(componen
319318
return
320319
}
321320

321+
//add pod envs
322+
envs := resource.BuildKerberosEnvForDDC(spec.KerberosInfo, configMap, componentType)
323+
if len(envs) != 0 {
324+
c.Env = append(c.Env, envs...)
325+
}
326+
322327
//add kerberos volumeMounts and volumes
323328
volumes, volumeMounts := resource.GetDv1KerberosVolumeAndVolumeMount(spec.KerberosInfo)
324329
if len(volumeMounts) != 0 {

0 commit comments

Comments
 (0)