Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions pkg/microservice/aslan/core/common/service/kube/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,18 @@ func InitializeExternalCluster(clusterID string) error {
},
},
}
if cluster.DindCfg == nil || cluster.DindCfg.Storage == nil || cluster.DindCfg.Storage.Type != string(commonmodels.DindStorageDynamic) {
dindSts.Spec.Template.Spec.Containers[0].VolumeMounts = append(dindSts.Spec.Template.Spec.Containers[0].VolumeMounts, corev1.VolumeMount{
Name: types.DindMountName,
MountPath: types.DindMountPath,
})
dindSts.Spec.Template.Spec.Volumes = append(dindSts.Spec.Template.Spec.Volumes, corev1.Volume{
Name: types.DindMountName,
VolumeSource: corev1.VolumeSource{
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
})
}

_, err = clientset.AppsV1().StatefulSets("koderover-agent").Create(context.TODO(), dindSts, metav1.CreateOptions{})
if err != nil {
Expand Down Expand Up @@ -1120,6 +1132,10 @@ spec:
path: server-cert.pem
- key: server-key.pem
path: server-key.pem
{{ if not .DindEnablePV }}
- name: zadig-docker
emptyDir: {}
{{ end }}
containers:
- name: dind
image: {{.DindImage}}
Expand Down Expand Up @@ -1149,10 +1165,8 @@ spec:
- name: dind-tls-certs
mountPath: /etc/zadig/dind/tls
readOnly: true
{{ if .DindEnablePV }}
- name: zadig-docker
mountPath: /var/lib/docker
{{ end }}
{{ if .DindEnablePV }}
volumeClaimTemplates:
- metadata:
Expand Down Expand Up @@ -1304,6 +1318,10 @@ spec:
path: server-cert.pem
- key: server-key.pem
path: server-key.pem
{{ if not .DindEnablePV }}
- name: zadig-docker
emptyDir: {}
{{ end }}
containers:
- name: dind
image: {{.DindImage}}
Expand Down Expand Up @@ -1333,10 +1351,8 @@ spec:
- name: dind-tls-certs
mountPath: /etc/zadig/dind/tls
readOnly: true
{{ if .DindEnablePV }}
- name: zadig-docker
mountPath: /var/lib/docker
{{ end }}
{{ if .DindEnablePV }}
volumeClaimTemplates:
- metadata:
Expand Down
18 changes: 17 additions & 1 deletion pkg/microservice/aslan/core/multicluster/service/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -1298,10 +1298,26 @@ func applyDindUpgrade(kclient client.Client, ctx context.Context, dindSts, origi

volumeMounts = append(volumeMounts, volumeMount)
}
container.VolumeMounts = volumeMounts
container.VolumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: types.DindMountName,
MountPath: types.DindMountPath,
})
dindSts.Spec.Template.Spec.Containers[i] = container
}

volumes := []corev1.Volume{}
for _, volume := range dindSts.Spec.Template.Spec.Volumes {
if volume.Name != types.DindMountName {
volumes = append(volumes, volume)
}
}
dindSts.Spec.Template.Spec.Volumes = append(volumes, corev1.Volume{
Name: types.DindMountName,
VolumeSource: corev1.VolumeSource{
EmptyDir: &corev1.EmptyDirVolumeSource{},
},
})

volumeClaimTemplates := []corev1.PersistentVolumeClaim{}
for _, volumeClaimTemplate := range dindSts.Spec.VolumeClaimTemplates {
if volumeClaimTemplate.Name == types.DindMountName {
Expand Down
Loading