Skip to content

Commit

Permalink
Fix hardcoded images in test
Browse files Browse the repository at this point in the history
  • Loading branch information
roivaz committed Jan 26, 2022
1 parent 1f1a075 commit 87b2ba2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/webhooks/podv1mutator/handle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"testing"

operatorv1alpha1 "github.com/3scale-ops/marin3r/apis/operator.marin3r/v1alpha1"
"github.com/3scale-ops/marin3r/pkg/envoy/container/defaults"
admissionv1 "k8s.io/api/admission/v1"
authenticationv1 "k8s.io/api/authentication/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -88,7 +89,7 @@ func TestPodMutator_Handle(t *testing.T) {
},
},
},
want: []byte(`[{"op":"add","path":"/spec/containers/1","value":{"args":["-c","/etc/envoy/bootstrap/config.json","--service-node","test","--service-cluster","test"],"command":["envoy"],"image":"envoyproxy/envoy:v1.20.1","imagePullPolicy":"IfNotPresent","livenessProbe":{"failureThreshold":10,"httpGet":{"path":"/ready","port":9901,"scheme":"HTTP"},"initialDelaySeconds":30,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1},"name":"envoy-sidecar","ports":[{"containerPort":9901,"name":"admin","protocol":"TCP"}],"readinessProbe":{"failureThreshold":1,"httpGet":{"path":"/ready","port":9901,"scheme":"HTTP"},"initialDelaySeconds":15,"periodSeconds":5,"successThreshold":1,"timeoutSeconds":1},"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","volumeMounts":[{"mountPath":"/etc/envoy/tls/client","name":"envoy-sidecar-tls","readOnly":true},{"mountPath":"/etc/envoy/bootstrap","name":"envoy-sidecar-bootstrap","readOnly":true}]}},{"op":"add","path":"/spec/initContainers","value":[{"args":["init-manager","--admin-access-log-path","/dev/null","--admin-bind-address","0.0.0.0:9901","--api-version","v3","--client-certificate-path","/etc/envoy/tls/client","--config-file","/etc/envoy/bootstrap/config.json","--resources-path","/etc/envoy/bootstrap","--rtds-resource-name","runtime","--xdss-host","marin3r-instance.default.svc","--xdss-port","18000","--envoy-image","envoyproxy/envoy:v1.20.1"],"env":[{"name":"POD_NAME","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"metadata.name"}}},{"name":"POD_NAMESPACE","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"metadata.namespace"}}},{"name":"HOST_NAME","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"spec.nodeName"}}}],"image":"quay.io/3scale/marin3r:v0.9.2-alpha.1","imagePullPolicy":"IfNotPresent","name":"envoy-init-mgr","resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","volumeMounts":[{"mountPath":"/etc/envoy/bootstrap","name":"envoy-sidecar-bootstrap"}]}]},{"op":"add","path":"/spec/volumes","value":[{"name":"envoy-sidecar-tls","secret":{"defaultMode":420,"secretName":"envoy-sidecar-client-cert"}},{"emptyDir":{},"name":"envoy-sidecar-bootstrap"}]}]`),
want: []byte(`[{"op":"add","path":"/spec/containers/1","value":{"args":["-c","/etc/envoy/bootstrap/config.json","--service-node","test","--service-cluster","test"],"command":["envoy"],"image":"` + defaults.Image + `","imagePullPolicy":"IfNotPresent","livenessProbe":{"failureThreshold":10,"httpGet":{"path":"/ready","port":9901,"scheme":"HTTP"},"initialDelaySeconds":30,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1},"name":"envoy-sidecar","ports":[{"containerPort":9901,"name":"admin","protocol":"TCP"}],"readinessProbe":{"failureThreshold":1,"httpGet":{"path":"/ready","port":9901,"scheme":"HTTP"},"initialDelaySeconds":15,"periodSeconds":5,"successThreshold":1,"timeoutSeconds":1},"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","volumeMounts":[{"mountPath":"/etc/envoy/tls/client","name":"envoy-sidecar-tls","readOnly":true},{"mountPath":"/etc/envoy/bootstrap","name":"envoy-sidecar-bootstrap","readOnly":true}]}},{"op":"add","path":"/spec/initContainers","value":[{"args":["init-manager","--admin-access-log-path","/dev/null","--admin-bind-address","0.0.0.0:9901","--api-version","v3","--client-certificate-path","/etc/envoy/tls/client","--config-file","/etc/envoy/bootstrap/config.json","--resources-path","/etc/envoy/bootstrap","--rtds-resource-name","runtime","--xdss-host","marin3r-instance.default.svc","--xdss-port","18000","--envoy-image","` + defaults.Image + `"],"env":[{"name":"POD_NAME","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"metadata.name"}}},{"name":"POD_NAMESPACE","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"metadata.namespace"}}},{"name":"HOST_NAME","valueFrom":{"fieldRef":{"apiVersion":"v1","fieldPath":"spec.nodeName"}}}],"image":"` + defaults.InitMgrImage() + `","imagePullPolicy":"IfNotPresent","name":"envoy-init-mgr","resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","volumeMounts":[{"mountPath":"/etc/envoy/bootstrap","name":"envoy-sidecar-bootstrap"}]}]},{"op":"add","path":"/spec/volumes","value":[{"name":"envoy-sidecar-tls","secret":{"defaultMode":420,"secretName":"envoy-sidecar-client-cert"}},{"emptyDir":{},"name":"envoy-sidecar-bootstrap"}]}]`),
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 87b2ba2

Please sign in to comment.