-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(background): support custom background processes in ide
- Loading branch information
Showing
12 changed files
with
299 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package configure | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
) | ||
|
||
func (cfg *PodConfigInjector) InjectBackgroundConfigFiles(pod *corev1.Pod, configMap corev1.ConfigMap) *corev1.Pod { | ||
|
||
cfg.placeBackgroundConfigFiles(pod, configMap) | ||
|
||
return pod | ||
} | ||
|
||
func (cfg *PodConfigInjector) placeBackgroundConfigFiles(pod *corev1.Pod, configMap corev1.ConfigMap) { | ||
|
||
var mode int32 = 511 | ||
|
||
volume := corev1.Volume{ | ||
Name: "background-config", | ||
VolumeSource: corev1.VolumeSource{ | ||
ConfigMap: &corev1.ConfigMapVolumeSource{ | ||
LocalObjectReference: corev1.LocalObjectReference{ | ||
Name: configMap.Name, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
for key := range configMap.Data { | ||
volume.VolumeSource.ConfigMap.Items = append(volume.VolumeSource.ConfigMap.Items, corev1.KeyToPath{ | ||
Key: key, | ||
Path: key, | ||
Mode: &mode, | ||
}) | ||
} | ||
|
||
pod.Spec.Volumes = append(pod.Spec.Volumes, volume) | ||
|
||
volumeMount := corev1.VolumeMount{ | ||
Name: "background-config", | ||
MountPath: "/etc/robolaunch/services/custom/", | ||
} | ||
|
||
for k, container := range pod.Spec.Containers { | ||
container.VolumeMounts = append(container.VolumeMounts, volumeMount) | ||
pod.Spec.Containers[k] = container | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.