-
Notifications
You must be signed in to change notification settings - Fork 4.7k
update policy for pods/exec #3716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -335,7 +335,9 @@ oc process -n docker -f examples/sample-app/application-template-dockerbuild.jso | |
oc process -n custom -f examples/sample-app/application-template-custombuild.json > "${CUSTOM_CONFIG_FILE}" | ||
|
||
echo "[INFO] Back to 'test' context with 'e2e-user' user" | ||
oc login -u e2e-user | ||
oc project test | ||
oc whoami | ||
|
||
echo "[INFO] Applying STI application config" | ||
oc create -f "${STI_CONFIG_FILE}" | ||
|
@@ -346,6 +348,20 @@ echo "[INFO] Starting build from ${STI_CONFIG_FILE} and streaming its logs..." | |
wait_for_build "test" | ||
wait_for_app "test" | ||
|
||
# Remote command execution | ||
echo "[INFO] Validating exec" | ||
frontend_pod=$(oc get pod -l deploymentconfig=frontend -t '{{(index .items 0).metadata.name}}') | ||
# when running as a restricted pod the registry will run with a pre-allocated | ||
# user in the neighborhood of 1000000+. Look for a substring of the pre-allocated uid range | ||
oc exec -p ${frontend_pod} id | grep 10 | ||
|
||
# Port forwarding | ||
echo "[INFO] Validating port-forward" | ||
oc port-forward -p ${frontend_pod} 10080:8080 &> "${LOG_DIR}/port-forward.log" & | ||
wait_for_url_timed "http://localhost:10080" "[INFO] Frontend says: " $((10*TIME_SEC)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was there something wrong with the healthz check? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The /healthz check is for a registry, not a ruby frontend. Registry is in default where e2e-user doesn't have rights. e2e-user checks the ruby front-end. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, makes sense |
||
|
||
|
||
|
||
#echo "[INFO] Applying Docker application config" | ||
#oc create -n docker -f "${DOCKER_CONFIG_FILE}" | ||
#echo "[INFO] Invoking generic web hook to trigger new docker build using curl" | ||
|
@@ -370,18 +386,6 @@ wait_for_command '[[ "$(oc get endpoints router --output-version=v1beta3 -t "{{ | |
echo "[INFO] Validating routed app response..." | ||
validate_response "-s -k --resolve www.example.com:443:${CONTAINER_ACCESSIBLE_API_HOST} https://www.example.com" "Hello from OpenShift" 0.2 50 | ||
|
||
# Remote command execution | ||
echo "[INFO] Validating exec" | ||
registry_pod=$(oc get pod -l deploymentconfig=docker-registry -t '{{(index .items 0).metadata.name}}') | ||
# when running as a restricted pod the registry will run with a pre-allocated | ||
# user in the neighborhood of 1000000+. Look for a substring of the pre-allocated uid range | ||
oc exec -p ${registry_pod} id | grep 10 | ||
|
||
# Port forwarding | ||
echo "[INFO] Validating port-forward" | ||
oc port-forward -p ${registry_pod} 5001:5000 &> "${LOG_DIR}/port-forward.log" & | ||
wait_for_url_timed "http://localhost:5001/healthz" "[INFO] Docker registry says: " $((10*TIME_SEC)) | ||
|
||
# Image pruning | ||
echo "[INFO] Validating image pruning" | ||
docker pull busybox | ||
|
@@ -401,6 +405,7 @@ docker tag -f gcr.io/google_containers/pause ${DOCKER_REGISTRY}/cache/prune | |
docker push ${DOCKER_REGISTRY}/cache/prune | ||
|
||
# record the storage before pruning | ||
registry_pod=$(oc get pod -l deploymentconfig=docker-registry -t '{{(index .items 0).metadata.name}}') | ||
oc exec -p ${registry_pod} du /registry > ${LOG_DIR}/prune-images.before.txt | ||
|
||
# set up pruner user | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,11 +72,11 @@ func GetBootstrapClusterRoles() []authorizationapi.ClusterRole { | |
Rules: []authorizationapi.PolicyRule{ | ||
{ | ||
Verbs: util.NewStringSet("get", "list", "watch", "create", "update", "delete"), | ||
Resources: util.NewStringSet(authorizationapi.OpenshiftExposedGroupName, authorizationapi.PermissionGrantingGroupName, authorizationapi.KubeExposedGroupName, "projects", "secrets", "pods/proxy", authorizationapi.DockerBuildResource, authorizationapi.SourceBuildResource, authorizationapi.CustomBuildResource), | ||
Resources: util.NewStringSet(authorizationapi.OpenshiftExposedGroupName, authorizationapi.PermissionGrantingGroupName, authorizationapi.KubeExposedGroupName, "projects", "secrets", "pods/proxy", "pods/exec", "pods/portforward", authorizationapi.DockerBuildResource, authorizationapi.SourceBuildResource, authorizationapi.CustomBuildResource), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why allow all verbs on exec and portforward? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It keeps the ruleset smaller and doesn't negatively affect intent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, ok |
||
}, | ||
{ | ||
Verbs: util.NewStringSet("get", "list", "watch"), | ||
Resources: util.NewStringSet(authorizationapi.PolicyOwnerGroupName, authorizationapi.KubeAllGroupName, authorizationapi.OpenshiftStatusGroupName, authorizationapi.KubeStatusGroupName, "pods/exec", "pods/portforward"), | ||
Resources: util.NewStringSet(authorizationapi.PolicyOwnerGroupName, authorizationapi.KubeAllGroupName, authorizationapi.OpenshiftStatusGroupName, authorizationapi.KubeStatusGroupName), | ||
}, | ||
{ | ||
Verbs: util.NewStringSet("get", "update"), | ||
|
@@ -92,11 +92,11 @@ func GetBootstrapClusterRoles() []authorizationapi.ClusterRole { | |
Rules: []authorizationapi.PolicyRule{ | ||
{ | ||
Verbs: util.NewStringSet("get", "list", "watch", "create", "update", "delete"), | ||
Resources: util.NewStringSet(authorizationapi.OpenshiftExposedGroupName, authorizationapi.KubeExposedGroupName, "secrets", "pods/proxy", authorizationapi.DockerBuildResource, authorizationapi.SourceBuildResource, authorizationapi.CustomBuildResource), | ||
Resources: util.NewStringSet(authorizationapi.OpenshiftExposedGroupName, authorizationapi.KubeExposedGroupName, "secrets", "pods/proxy", "pods/exec", "pods/portforward", authorizationapi.DockerBuildResource, authorizationapi.SourceBuildResource, authorizationapi.CustomBuildResource), | ||
}, | ||
{ | ||
Verbs: util.NewStringSet("get", "list", "watch"), | ||
Resources: util.NewStringSet(authorizationapi.KubeAllGroupName, authorizationapi.OpenshiftStatusGroupName, authorizationapi.KubeStatusGroupName, "projects", "pods/exec", "pods/portforward"), | ||
Resources: util.NewStringSet(authorizationapi.KubeAllGroupName, authorizationapi.OpenshiftStatusGroupName, authorizationapi.KubeStatusGroupName, "projects"), | ||
}, | ||
{ | ||
Verbs: util.NewStringSet("get", "update"), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you want to check output of this, or is it just for the test log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the log.