Fix CLI not update function's secret/configmap correctly (#512)

This PR addressed some issues introduced in PR399. Also, now env builders and function pods can mount shared secret/configmap volumes correctly.
This commit is contained in:
Ta-Ching Chen
2018-02-28 05:28:05 +08:00
committed by GitHub
parent 23942fdf7d
commit 5e2f984136
7 changed files with 199 additions and 75 deletions
+32 -4
View File
@@ -55,7 +55,7 @@ func (deploy *NewDeploy) createOrGetDeployment(fn *crd.Function, env *crd.Enviro
replicas = 1
}
targetFilename := "user"
userfunc := "userfunc"
var gracePeriodSeconds int64 = 6 * 60
existingDepl, err := deploy.kubernetesClient.ExtensionsV1beta1().Deployments(deploy.namespace).Get(deployName, metav1.GetOptions{})
@@ -120,7 +120,19 @@ func (deploy *NewDeploy) createOrGetDeployment(fn *crd.Function, env *crd.Enviro
Spec: apiv1.PodSpec{
Volumes: []apiv1.Volume{
{
Name: userfunc,
Name: fission.SharedVolumeUserfunc,
VolumeSource: apiv1.VolumeSource{
EmptyDir: &apiv1.EmptyDirVolumeSource{},
},
},
{
Name: fission.SharedVolumeSecrets,
VolumeSource: apiv1.VolumeSource{
EmptyDir: &apiv1.EmptyDirVolumeSource{},
},
},
{
Name: fission.SharedVolumeConfigmaps,
VolumeSource: apiv1.VolumeSource{
EmptyDir: &apiv1.EmptyDirVolumeSource{},
},
@@ -134,9 +146,17 @@ func (deploy *NewDeploy) createOrGetDeployment(fn *crd.Function, env *crd.Enviro
TerminationMessagePath: "/dev/termination-log",
VolumeMounts: []apiv1.VolumeMount{
{
Name: userfunc,
Name: fission.SharedVolumeUserfunc,
MountPath: deploy.sharedMountPath,
},
{
Name: fission.SharedVolumeSecrets,
MountPath: deploy.sharedSecretPath,
},
{
Name: fission.SharedVolumeConfigmaps,
MountPath: deploy.sharedCfgMapPath,
},
},
Resources: env.Spec.Resources,
Lifecycle: &apiv1.Lifecycle{
@@ -157,9 +177,17 @@ func (deploy *NewDeploy) createOrGetDeployment(fn *crd.Function, env *crd.Enviro
TerminationMessagePath: "/dev/termination-log",
VolumeMounts: []apiv1.VolumeMount{
{
Name: userfunc,
Name: fission.SharedVolumeUserfunc,
MountPath: deploy.sharedMountPath,
},
{
Name: fission.SharedVolumeSecrets,
MountPath: deploy.sharedSecretPath,
},
{
Name: fission.SharedVolumeConfigmaps,
MountPath: deploy.sharedCfgMapPath,
},
},
Command: []string{"/fetcher", "-specialize-on-startup",
"-fetch-request", string(fetchPayload),
+9 -9
View File
@@ -504,19 +504,19 @@ func (gp *GenericPool) createPool() error {
Spec: apiv1.PodSpec{
Volumes: []apiv1.Volume{
{
Name: "userfunc",
Name: fission.SharedVolumeUserfunc,
VolumeSource: apiv1.VolumeSource{
EmptyDir: &apiv1.EmptyDirVolumeSource{},
},
},
{
Name: "secrets",
Name: fission.SharedVolumeSecrets,
VolumeSource: apiv1.VolumeSource{
EmptyDir: &apiv1.EmptyDirVolumeSource{},
},
},
{
Name: "config",
Name: fission.SharedVolumeConfigmaps,
VolumeSource: apiv1.VolumeSource{
EmptyDir: &apiv1.EmptyDirVolumeSource{},
},
@@ -530,15 +530,15 @@ func (gp *GenericPool) createPool() error {
TerminationMessagePath: "/dev/termination-log",
VolumeMounts: []apiv1.VolumeMount{
{
Name: "userfunc",
Name: fission.SharedVolumeUserfunc,
MountPath: gp.sharedMountPath,
},
{
Name: "secrets",
Name: fission.SharedVolumeSecrets,
MountPath: gp.sharedSecretPath,
},
{
Name: "config",
Name: fission.SharedVolumeConfigmaps,
MountPath: gp.sharedCfgMapPath,
},
},
@@ -567,15 +567,15 @@ func (gp *GenericPool) createPool() error {
TerminationMessagePath: "/dev/termination-log",
VolumeMounts: []apiv1.VolumeMount{
{
Name: "userfunc",
Name: fission.SharedVolumeUserfunc,
MountPath: gp.sharedMountPath,
},
{
Name: "secrets",
Name: fission.SharedVolumeSecrets,
MountPath: gp.sharedSecretPath,
},
{
Name: "config",
Name: fission.SharedVolumeConfigmaps,
MountPath: gp.sharedCfgMapPath,
},
},