Skip to content
Merged
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
12 changes: 1 addition & 11 deletions pkg/apis/ela/v1alpha1/revision_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ type AppSpec struct {
Image string `json:"image,omitempty"`
}

type ContainerSpec struct {
Image string `json:"image,omitempty"`
}

// RevisionSpec defines the desired state of Revision
type RevisionSpec struct {
// TODO: Generation does not work correctly with CRD. They are scrubbed
Expand All @@ -76,13 +72,7 @@ type RevisionSpec struct {
FunctionSpec *FunctionSpec `json:"functionSpec,omitempty"`
AppSpec *AppSpec `json:"appSpec,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can remove these too. Is anything keying off of the options these contain right now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do this in a follow-up CL.


// TODO(mattmoor): Change to corev1.Container
ContainerSpec *ContainerSpec `json:"containerSpec,omitempty"`

// List of environment variables that will be passed to the app container.
// TODO: Add merge strategy for this similar to the EnvVar list on the
// Container type.
Env []corev1.EnvVar `json:"env,omitempty"`
ContainerSpec *corev1.Container `json:"containerSpec,omitempty"`
}

// RevisionConditionType represents an Revision condition value
Expand Down
27 changes: 2 additions & 25 deletions pkg/apis/ela/v1alpha1/zz_generated.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,6 @@ func (in *ConfigurationStatus) DeepCopy() *ConfigurationStatus {
return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerSpec) DeepCopyInto(out *ContainerSpec) {
*out = *in
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerSpec.
func (in *ContainerSpec) DeepCopy() *ContainerSpec {
if in == nil {
return nil
}
out := new(ContainerSpec)
in.DeepCopyInto(out)
return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FunctionSpec) DeepCopyInto(out *FunctionSpec) {
*out = *in
Expand Down Expand Up @@ -285,15 +269,8 @@ func (in *RevisionSpec) DeepCopyInto(out *RevisionSpec) {
if *in == nil {
*out = nil
} else {
*out = new(ContainerSpec)
**out = **in
}
}
if in.Env != nil {
in, out := &in.Env, &out.Env
*out = make([]v1.EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
*out = new(v1.Container)
(*in).DeepCopyInto(*out)
}
}
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/revision/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func getTestRevision() *v1alpha1.Revision {
},
Spec: v1alpha1.RevisionSpec{
Service: "test-service",
ContainerSpec: &v1alpha1.ContainerSpec{
ContainerSpec: &corev1.Container{
Image: "test-image",
},
},
Expand Down
33 changes: 15 additions & 18 deletions pkg/controller/revision/ela_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,22 @@ func MakeElaPodSpec(u *v1alpha1.Revision) *corev1.PodSpec {
serviceID := u.Spec.Service
nginxConfigMapName := name + "-" + serviceID + "-proxy-configmap"

elaContainer := corev1.Container{
Name: elaContainerName,
Image: u.Spec.ContainerSpec.Image,
Resources: corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceName("cpu"): resource.MustParse("25m"),
},
elaContainer := u.Spec.ContainerSpec.DeepCopy()
elaContainer.Name = elaContainerName
elaContainer.Resources = corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceName("cpu"): resource.MustParse("25m"),
},
Ports: []corev1.ContainerPort{{
Name: elaPortName,
ContainerPort: int32(elaPort),
}},
VolumeMounts: []corev1.VolumeMount{
{
MountPath: elaContainerLogVolumeMountPath,
Name: elaContainerLogVolumeName,
},
}
elaContainer.Ports = []corev1.ContainerPort{{
Name: elaPortName,
ContainerPort: int32(elaPort),
}}
elaContainer.VolumeMounts = []corev1.VolumeMount{
{
MountPath: elaContainerLogVolumeMountPath,
Name: elaContainerLogVolumeName,
},
Env: u.Spec.Env,
}

elaContainerLogVolume := corev1.Volume{
Expand Down Expand Up @@ -139,7 +136,7 @@ func MakeElaPodSpec(u *v1alpha1.Revision) *corev1.PodSpec {

return &corev1.PodSpec{
Volumes: []corev1.Volume{elaContainerLogVolume, nginxConfigVolume, nginxLogVolume},
Containers: []corev1.Container{elaContainer, nginxContainer, fluentdContainer},
Containers: []corev1.Container{*elaContainer, nginxContainer, fluentdContainer},
}
}

Expand Down
8 changes: 3 additions & 5 deletions pkg/webhook/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,12 @@ func createConfiguration(generation int64) v1alpha1.Configuration {
Generation: generation,
Template: v1alpha1.Revision{
Spec: v1alpha1.RevisionSpec{
ContainerSpec: &v1alpha1.ContainerSpec{
ContainerSpec: &corev1.Container{
Image: imageName,
},
Env: []corev1.EnvVar{
corev1.EnvVar{
Env: []corev1.EnvVar{{
Name: envVarName,
Value: envVarValue,
},
}},
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions sample/helloworld/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ spec:
template:
spec:
serviceType: container
env:
- name: TARGET
value: shiniestnewestversion
containerSpec:
image: sample:latest
env:
- name: TARGET
value: shiniestnewestversion
6 changes: 3 additions & 3 deletions sample/helloworld/updated_configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ spec:
template:
spec:
serviceType: container
env:
- name: TARGET
value: updatedversion
containerSpec:
image: sample:latest
env:
- name: TARGET
value: updatedversion
6 changes: 3 additions & 3 deletions sample/steren-function/configuration.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ spec:
serviceType: container
containerSpec:
image: *image
env:
- name: FUNCTION_TRIGGER_TYPE
value: HTTP_TRIGGER
env:
- name: FUNCTION_TRIGGER_TYPE
value: HTTP_TRIGGER
6 changes: 3 additions & 3 deletions sample/thumbnailer/thumbnailer-prebuilt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ spec:
template:
spec:
serviceType: container
env:
- name: TARGET
value: thumb_v1
containerSpec:
image: docker.io/mchmarny/rester-tester:latest
env:
- name: TARGET
value: thumb_v1
6 changes: 3 additions & 3 deletions sample/thumbnailer/thumbnailer.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ spec:
template:
spec:
serviceType: container
env:
- name: TARGET
value: thumb_v1
containerSpec:
image: *image
env:
- name: TARGET
value: thumb_v1