Skip to content

Commit

Permalink
Drop config-logging volume
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor committed Aug 29, 2021
1 parent 2aafa87 commit 7346475
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 141 deletions.
56 changes: 0 additions & 56 deletions pkg/reconciler/eventlistener/eventlistener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ func makeDeployment(ops ...func(d *appsv1.Deployment)) *appsv1.Deployment {
"idletimeout", strconv.FormatInt(resources.DefaultIdleTimeout, 10),
"timeouthandler", strconv.FormatInt(resources.DefaultTimeOutHandler, 10),
},
VolumeMounts: []corev1.VolumeMount{{
Name: "config-logging",
MountPath: "/etc/config-logging",
}},
Env: []corev1.EnvVar{{
Name: "SYSTEM_NAMESPACE",
ValueFrom: &corev1.EnvVarSource{
Expand All @@ -251,16 +247,6 @@ func makeDeployment(ops ...func(d *appsv1.Deployment)) *appsv1.Deployment {
Value: "9000",
}},
}},
Volumes: []corev1.Volume{{
Name: "config-logging",
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: resources.EventListenerConfigMapName,
},
},
},
}},
SecurityContext: &corev1.PodSecurityContext{
RunAsNonRoot: ptr.Bool(true),
RunAsUser: ptr.Int64(65532),
Expand Down Expand Up @@ -323,9 +309,6 @@ var withTLSConfig = func(d *appsv1.Deployment) {
"-tls-key", "/etc/triggers/tls/tls.key",
},
VolumeMounts: []corev1.VolumeMount{{
Name: "config-logging",
MountPath: "/etc/config-logging",
}, {
Name: "https-connection",
MountPath: "/etc/triggers/tls",
ReadOnly: true,
Expand Down Expand Up @@ -369,15 +352,6 @@ var withTLSConfig = func(d *appsv1.Deployment) {
}},
}}
d.Spec.Template.Spec.Volumes = []corev1.Volume{{
Name: "config-logging",
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: resources.EventListenerConfigMapName,
},
},
},
}, {
Name: "https-connection",
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
Expand Down Expand Up @@ -425,11 +399,6 @@ func makeWithPod(ops ...func(d *duckv1.WithPod)) *duckv1.WithPod {
"--timeouthandler=" + strconv.FormatInt(resources.DefaultTimeOutHandler, 10),
"--is-multi-ns=" + strconv.FormatBool(false),
},
VolumeMounts: []corev1.VolumeMount{{
Name: "config-logging",
MountPath: "/etc/config-logging",
ReadOnly: true,
}},
Env: []corev1.EnvVar{{
Name: "SYSTEM_NAMESPACE",
Value: "test-pipelines",
Expand All @@ -453,16 +422,6 @@ func makeWithPod(ops ...func(d *duckv1.WithPod)) *duckv1.WithPod {
SuccessThreshold: 1,
},
}},
Volumes: []corev1.Volume{{
Name: "config-logging",
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: resources.EventListenerConfigMapName,
},
},
},
}},
},
},
},
Expand Down Expand Up @@ -1576,26 +1535,11 @@ func TestReconcile_InvalidForCustomResource(t *testing.T) {
data.Spec.Template.Spec.Containers[0].Ports = []corev1.ContainerPort{{
Protocol: corev1.ProtocolUDP,
}}
data.Spec.Template.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{{
Name: "config-logging-dummy",
MountPath: "/etc/config-logging-dummy",
ReadOnly: true,
}}
data.Spec.Template.Spec.Containers[0].Resources = corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceMemory: resource.Quantity{Format: resource.BinarySI},
},
}
data.Spec.Template.Spec.Volumes = []corev1.Volume{{
Name: "config-logging1",
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: resources.EventListenerConfigMapName,
},
},
},
}}
data.Spec.Template.Spec.ServiceAccountName = "test"
data.Spec.Template.Spec.Tolerations = []corev1.Toleration{{
Key: "key1",
Expand Down
17 changes: 0 additions & 17 deletions pkg/reconciler/eventlistener/resources/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ func MakeCustomObject(el *v1beta1.EventListener, c Config) (*unstructured.Unstru
c.Resources = original.Spec.Template.Spec.Containers[0].Resources
}

// TODO(mattmoor): Knative's sharedmain no longer looks for this, so confirm this is still needed.
c.VolumeMounts = []corev1.VolumeMount{{
Name: "config-logging",
MountPath: "/etc/config-logging",
ReadOnly: true,
}}

c.Env = append(c.Env, corev1.EnvVar{
Name: "SYSTEM_NAMESPACE",
// Cannot use FieldRef here because Knative Serving mask that field under feature gate
Expand Down Expand Up @@ -106,16 +99,6 @@ func MakeCustomObject(el *v1beta1.EventListener, c Config) (*unstructured.Unstru
NodeSelector: customObjectData.Spec.Template.Spec.NodeSelector,
ServiceAccountName: customObjectData.Spec.Template.Spec.ServiceAccountName,
Containers: []corev1.Container{container},
Volumes: []corev1.Volume{{
Name: "config-logging",
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: EventListenerConfigMapName,
},
},
},
}},
}
marshaledData, err := json.Marshal(original)
if err != nil {
Expand Down
45 changes: 0 additions & 45 deletions pkg/reconciler/eventlistener/resources/custom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,6 @@ func TestCustomObject(t *testing.T) {
},
},
"resources": map[string]interface{}{},
"volumeMounts": []interface{}{
map[string]interface{}{
"mountPath": "/etc/config-logging",
"name": "config-logging",
"readOnly": true,
},
},
"readinessProbe": map[string]interface{}{
"httpGet": map[string]interface{}{
"path": "/live",
Expand All @@ -145,14 +138,6 @@ func TestCustomObject(t *testing.T) {
},
},
},
"volumes": []interface{}{
map[string]interface{}{
"configMap": map[string]interface{}{
"name": EventListenerConfigMapName,
},
"name": "config-logging",
},
},
},
},
},
Expand Down Expand Up @@ -211,13 +196,6 @@ func TestCustomObject(t *testing.T) {
},
},
"resources": map[string]interface{}{},
"volumeMounts": []interface{}{
map[string]interface{}{
"mountPath": "/etc/config-logging",
"name": "config-logging",
"readOnly": true,
},
},
"readinessProbe": map[string]interface{}{
"httpGet": map[string]interface{}{
"path": "/live",
Expand All @@ -228,14 +206,6 @@ func TestCustomObject(t *testing.T) {
},
},
},
"volumes": []interface{}{
map[string]interface{}{
"configMap": map[string]interface{}{
"name": EventListenerConfigMapName,
},
"name": "config-logging",
},
},
},
},
},
Expand Down Expand Up @@ -293,13 +263,6 @@ func TestCustomObject(t *testing.T) {
"cpu": "101m",
},
},
"volumeMounts": []interface{}{
map[string]interface{}{
"mountPath": "/etc/config-logging",
"name": "config-logging",
"readOnly": true,
},
},
"readinessProbe": map[string]interface{}{
"httpGet": map[string]interface{}{
"path": "/live",
Expand All @@ -310,14 +273,6 @@ func TestCustomObject(t *testing.T) {
},
},
},
"volumes": []interface{}{
map[string]interface{}{
"configMap": map[string]interface{}{
"name": EventListenerConfigMapName,
},
"name": "config-logging",
},
},
},
},
},
Expand Down
18 changes: 1 addition & 17 deletions pkg/reconciler/eventlistener/resources/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ const (
)

var (
configLoggingVolume = corev1.Volume{
Name: "config-logging",
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: EventListenerConfigMapName,
},
},
},
}
strongerSecurityPolicy = corev1.PodSecurityContext{
RunAsNonRoot: ptr.Bool(true),
RunAsUser: ptr.Int64(65532),
Expand All @@ -66,7 +56,7 @@ func MakeDeployment(el *v1beta1.EventListener, c Config) (*appsv1.Deployment, er
replicas = ptr.Int32(1)
podlabels = kmeta.UnionMaps(el.Labels, GenerateLabels(el.Name, c.StaticResourceLabels))
serviceAccountName = el.Spec.ServiceAccountName
vol = []corev1.Volume{configLoggingVolume}
vol []corev1.Volume
tolerations []corev1.Toleration
nodeSelector, annotations map[string]string
)
Expand Down Expand Up @@ -153,12 +143,6 @@ func addDeploymentBits(el *v1beta1.EventListener, c Config) (ContainerOption, er
Protocol: corev1.ProtocolTCP,
})

// TODO(mattmoor): Knative's sharedmain no longer looks for this, so confirm this is still needed.
container.VolumeMounts = []corev1.VolumeMount{{
Name: "config-logging",
MountPath: "/etc/config-logging",
}}

container.Env = append(container.Env, corev1.EnvVar{
Name: "SYSTEM_NAMESPACE",
ValueFrom: &corev1.EnvVarSource{
Expand Down
7 changes: 1 addition & 6 deletions pkg/reconciler/eventlistener/resources/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func TestDeployment(t *testing.T) {
mustAddDeployBits(t, makeEL(), config),
addCertsForSecureConnection(config)),
},
Volumes: []corev1.Volume{configLoggingVolume},
SecurityContext: &strongerSecurityPolicy,
},
},
Expand Down Expand Up @@ -113,7 +112,6 @@ func TestDeployment(t *testing.T) {
mustAddDeployBits(t, makeEL(), config),
addCertsForSecureConnection(config)),
},
Volumes: []corev1.Volume{configLoggingVolume},
SecurityContext: &strongerSecurityPolicy,
},
},
Expand Down Expand Up @@ -158,7 +156,6 @@ func TestDeployment(t *testing.T) {
mustAddDeployBits(t, makeEL(), config),
addCertsForSecureConnection(config)),
},
Volumes: []corev1.Volume{configLoggingVolume},
SecurityContext: &strongerSecurityPolicy,
Tolerations: []corev1.Toleration{{
Key: "foo",
Expand Down Expand Up @@ -206,7 +203,6 @@ func TestDeployment(t *testing.T) {
mustAddDeployBits(t, makeEL(), config),
addCertsForSecureConnection(config)),
},
Volumes: []corev1.Volume{configLoggingVolume},
SecurityContext: &strongerSecurityPolicy,
NodeSelector: map[string]string{
"foo": "bar",
Expand Down Expand Up @@ -251,7 +247,6 @@ func TestDeployment(t *testing.T) {
mustAddDeployBits(t, makeEL(), config),
addCertsForSecureConnection(config)),
},
Volumes: []corev1.Volume{configLoggingVolume},
SecurityContext: &strongerSecurityPolicy,
},
},
Expand Down Expand Up @@ -283,7 +278,7 @@ func TestDeployment(t *testing.T) {
mustAddDeployBits(t, makeEL(withTLSEnvFrom("Bill")), config),
addCertsForSecureConnection(config)),
},
Volumes: []corev1.Volume{configLoggingVolume, {
Volumes: []corev1.Volume{{
Name: "https-connection",
VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
Expand Down

0 comments on commit 7346475

Please sign in to comment.