PodSpec support in environment builder (#1369)
This commit is contained in:
committed by
Ta-Ching Chen
parent
3b6749dce9
commit
e1a64dd0c1
@@ -490,6 +490,9 @@ type (
|
||||
// - ImagePullPolicy
|
||||
// - ReadinessProbe
|
||||
Container *apiv1.Container `json:"container,omitempty"`
|
||||
|
||||
// PodSpec will store the spec of the pod that will be applied to the pod created for the builder
|
||||
PodSpec *apiv1.PodSpec `json:"podspec,omitempty"`
|
||||
}
|
||||
|
||||
// EnvironmentSpec contains with builder, runtime and some other related environment settings.
|
||||
|
||||
@@ -489,6 +489,17 @@ func (envw *environmentWatcher) createBuilderDeployment(env *fv1.Environment, ns
|
||||
return nil, err
|
||||
}
|
||||
|
||||
podSpec := apiv1.PodSpec{
|
||||
Containers: []apiv1.Container{*container},
|
||||
ServiceAccountName: "fission-builder",
|
||||
}
|
||||
|
||||
finalPodSpec, err := util.MergePodSpec(&podSpec, env.Spec.Builder.PodSpec)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
deployment := &appsv1.Deployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: ns,
|
||||
@@ -505,10 +516,7 @@ func (envw *environmentWatcher) createBuilderDeployment(env *fv1.Environment, ns
|
||||
Labels: sel,
|
||||
Annotations: podAnnotations,
|
||||
},
|
||||
Spec: apiv1.PodSpec{
|
||||
Containers: []apiv1.Container{*container},
|
||||
ServiceAccountName: "fission-builder",
|
||||
},
|
||||
Spec: *finalPodSpec,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ func (fr *FissionResources) Validate(flags cli.Input) error {
|
||||
environments := make(map[string]struct{})
|
||||
for _, e := range fr.Environments {
|
||||
environments[fmt.Sprintf("%s:%s", e.Metadata.Name, e.Metadata.Namespace)] = struct{}{}
|
||||
if (e.Spec.Runtime.Container != nil) && (e.Spec.Runtime.PodSpec != nil) {
|
||||
if ((e.Spec.Runtime.Container != nil) && (e.Spec.Runtime.PodSpec != nil)) || ((e.Spec.Builder.Container != nil) && (e.Spec.Builder.PodSpec != nil)) {
|
||||
log.Warn("You have provided both - container spec and pod spec and while merging the pod spec will take precedence.")
|
||||
}
|
||||
// Unlike CLI can change the environment version silently,
|
||||
|
||||
Reference in New Issue
Block a user