Skip to content

Commit

Permalink
Modify the entrypoint of pulpcore containers
Browse files Browse the repository at this point in the history
closes: pulp#1101
  • Loading branch information
git-hyagi committed Oct 13, 2023
1 parent 7890fac commit 647589a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 84 deletions.
1 change: 1 addition & 0 deletions CHANGES/1101.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Modified the entrypoint of pulpcore containers.
47 changes: 6 additions & 41 deletions controllers/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -865,22 +865,8 @@ func (d *CommonDeployment) setContainers(pulp repomanagerpulpprojectorgv1beta2.P
Name: "api",
Image: d.image,
ImagePullPolicy: corev1.PullPolicy(pulp.Spec.ImagePullPolicy),
Command: []string{"/bin/sh"},
Args: []string{
"-c",
`if which pulpcore-api
then
PULP_API_ENTRYPOINT=("pulpcore-api")
else
PULP_API_ENTRYPOINT=("gunicorn" "pulpcore.app.wsgi:application" "--bind" "[::]:24817" "--name" "pulp-api" "--access-logformat" "pulp [%({correlation-id}o)s]: %(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\"")
fi
exec "${PULP_API_ENTRYPOINT[@]}" \
--timeout "${PULP_GUNICORN_TIMEOUT}" \
--workers "${PULP_API_WORKERS}" \
--access-logfile -`,
},
Env: d.envVars,
Command: []string{"/usr/bin/pulp-api"},
Env: d.envVars,
Ports: []corev1.ContainerPort{{
ContainerPort: 24817,
Protocol: "TCP",
Expand All @@ -897,24 +883,9 @@ exec "${PULP_API_ENTRYPOINT[@]}" \
Name: "content",
Image: d.image,
ImagePullPolicy: corev1.PullPolicy(pulp.Spec.ImagePullPolicy),
Command: []string{"/bin/sh"},
Args: []string{
"-c",
`if which pulpcore-content
then
PULP_CONTENT_ENTRYPOINT=("pulpcore-content")
else
PULP_CONTENT_ENTRYPOINT=("gunicorn" "pulpcore.content:server" "--worker-class" "aiohttp.GunicornWebWorker" "--name" "pulp-content" "--bind" "[::]:24816")
fi
exec "${PULP_CONTENT_ENTRYPOINT[@]}" \
--timeout "${PULP_GUNICORN_TIMEOUT}" \
--workers "${PULP_CONTENT_WORKERS}" \
--access-logfile -
`,
},
Resources: d.resourceRequirements,
Env: d.envVars,
Command: []string{"/usr/bin/pulp-content"},
Resources: d.resourceRequirements,
Env: d.envVars,
Ports: []corev1.ContainerPort{{
ContainerPort: 24816,
Protocol: "TCP",
Expand All @@ -929,13 +900,7 @@ exec "${PULP_CONTENT_ENTRYPOINT[@]}" \
Name: "worker",
Image: d.image,
ImagePullPolicy: corev1.PullPolicy(pulp.Spec.ImagePullPolicy),
Command: []string{"/bin/sh"},
Args: []string{
"-c",
`export PULP_SETTINGS=/etc/pulp/settings.py
export PATH=/usr/local/bin:/usr/bin/
exec pulpcore-worker`,
},
Command: []string{"/usr/bin/pulp-worker"},
Env: d.envVars,
LivenessProbe: d.livenessProbe,
ReadinessProbe: d.readinessProbe,
Expand Down
49 changes: 7 additions & 42 deletions controllers/repo_manager/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,22 +604,8 @@ var _ = Describe("Pulp controller", Ordered, func() {
apiContainers := []corev1.Container{{
Name: "api",
Image: "quay.io/pulp/pulp-minimal:latest",
Command: []string{"/bin/sh"},
Args: []string{
"-c",
`if which pulpcore-api
then
PULP_API_ENTRYPOINT=("pulpcore-api")
else
PULP_API_ENTRYPOINT=("gunicorn" "pulpcore.app.wsgi:application" "--bind" "[::]:24817" "--name" "pulp-api" "--access-logformat" "pulp [%({correlation-id}o)s]: %(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\"")
fi
exec "${PULP_API_ENTRYPOINT[@]}" \
--timeout "${PULP_GUNICORN_TIMEOUT}" \
--workers "${PULP_API_WORKERS}" \
--access-logfile -`,
},
Env: envVarsApi,
Command: []string{"/usr/bin/pulp-api"},
Env: envVarsApi,
Ports: []corev1.ContainerPort{{
ContainerPort: 24817,
Protocol: "TCP",
Expand Down Expand Up @@ -717,24 +703,9 @@ exec "${PULP_API_ENTRYPOINT[@]}" \
Name: "content",
Image: "quay.io/pulp/pulp-minimal:latest",
ImagePullPolicy: corev1.PullPolicy("IfNotPresent"),
Command: []string{"/bin/sh"},
Args: []string{
"-c",
`if which pulpcore-content
then
PULP_CONTENT_ENTRYPOINT=("pulpcore-content")
else
PULP_CONTENT_ENTRYPOINT=("gunicorn" "pulpcore.content:server" "--worker-class" "aiohttp.GunicornWebWorker" "--name" "pulp-content" "--bind" "[::]:24816")
fi
exec "${PULP_CONTENT_ENTRYPOINT[@]}" \
--timeout "${PULP_GUNICORN_TIMEOUT}" \
--workers "${PULP_CONTENT_WORKERS}" \
--access-logfile -
`,
},
Resources: corev1.ResourceRequirements{},
Env: envVarsContent,
Command: []string{"/usr/bin/pulp-content"},
Resources: corev1.ResourceRequirements{},
Env: envVarsContent,
Ports: []corev1.ContainerPort{{
ContainerPort: 24816,
Protocol: "TCP",
Expand Down Expand Up @@ -805,14 +776,8 @@ exec "${PULP_CONTENT_ENTRYPOINT[@]}" \
Name: "worker",
Image: "quay.io/pulp/pulp-minimal:latest",
ImagePullPolicy: corev1.PullPolicy("IfNotPresent"),
Command: []string{"/bin/sh"},
Args: []string{
"-c",
`export PULP_SETTINGS=/etc/pulp/settings.py
export PATH=/usr/local/bin:/usr/bin/
exec pulpcore-worker`,
},
Env: envVarsWorker,
Command: []string{"/usr/bin/pulp-worker"},
Env: envVarsWorker,
// LivenessProbe: livenessProbe,
// ReadinessProbe: readinessProbe,
VolumeMounts: volumeMountsWorker,
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func main() {
os.Exit(1)
}

setupLog.Info("pulp-operator version: 1.0.6-beta.2")
setupLog.Info("pulp-operator version: 1.0.7-beta.2")
setupLog.Info("starting manager")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
setupLog.Error(err, "problem running manager")
Expand Down

0 comments on commit 647589a

Please sign in to comment.