Skip to content

Commit d797fca

Browse files
committed
Add deprecation information
Signed-off-by: Philippe Martin <[email protected]>
1 parent 497d2a0 commit d797fca

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

pkg/devfile/generator/generators.go

+18-4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ func GetObjectMeta(name, namespace string, labels, annotations map[string]string
7575
}
7676

7777
// GetContainers iterates through all container components, filters out init containers and returns corresponding containers
78+
//
79+
// Deprecated in favor of GetPodTemplateSpec
7880
func GetContainers(devfileObj parser.DevfileObj, options common.DevfileOptions) ([]corev1.Container, error) {
7981
allContainers, err := getAllContainers(devfileObj, options)
8082
if err != nil {
@@ -121,6 +123,8 @@ func GetContainers(devfileObj parser.DevfileObj, options common.DevfileOptions)
121123
}
122124

123125
// GetInitContainers gets the init container for every preStart devfile event
126+
//
127+
// Deprecated in favor of GetPodTemplateSpec
124128
func GetInitContainers(devfileObj parser.DevfileObj) ([]corev1.Container, error) {
125129
containers, err := getAllContainers(devfileObj, common.DevfileOptions{})
126130
if err != nil {
@@ -171,10 +175,14 @@ func GetInitContainers(devfileObj parser.DevfileObj) ([]corev1.Container, error)
171175

172176
// DeploymentParams is a struct that contains the required data to create a deployment object
173177
type DeploymentParams struct {
174-
TypeMeta metav1.TypeMeta
175-
ObjectMeta metav1.ObjectMeta
176-
InitContainers []corev1.Container
177-
Containers []corev1.Container
178+
TypeMeta metav1.TypeMeta
179+
ObjectMeta metav1.ObjectMeta
180+
// Deprecated. InitContainers, Containers and Volumes are deprecated and are replaced by PodTemplateSpec.
181+
// A PodTemplateSpec value can be obtained calling GetPodTemplateSpec function, instead of calling GetContainers and GetInitContainers
182+
InitContainers []corev1.Container
183+
// Deprecated, see InitContainers
184+
Containers []corev1.Container
185+
// Deprecated, see InitContainers
178186
Volumes []corev1.Volume
179187
PodTemplateSpec *corev1.PodTemplateSpec
180188
PodSelectorLabels map[string]string
@@ -233,6 +241,12 @@ type PodTemplateParams struct {
233241
PodSecurityAdmissionPolicy psaapi.Policy
234242
}
235243

244+
// GetPodTemplateSpec returns a pod template
245+
// The function:
246+
// - iterates through all container components, filters out init containers and gets corresponding containers
247+
// - gets the init container for every preStart devfile event
248+
// - patches the pod template and containers to satisfy PodSecurityAdmissionPolicy
249+
// - patches the pod template and containers to apply pod and container overrides
236250
func GetPodTemplateSpec(devfileObj parser.DevfileObj, podTemplateParams PodTemplateParams) (*corev1.PodTemplateSpec, error) {
237251
containers, err := GetContainers(devfileObj, common.DevfileOptions{})
238252
if err != nil {

0 commit comments

Comments
 (0)