Skip to content
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

deployment: Set SPIN_HTTP_LISTEN_ADDR env var #296

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

endocrimes
Copy link
Contributor

This is currently a "practical no-op", as we default to setting the value to the Spin Default.

It does however simplify a future, bigger, change to allow non-80 listen addresses with the container to reduce the priviliges that we give to the shim (e.g runAsNonRoot).

This is currently a "practical no-op", as we default to setting the
value to the Spin Default.

It does however simplify a future, bigger, change to allow non-80 listen
addresses with the container to reduce the priviliges that we give to
the shim (e.g runAsNonRoot).
@@ -423,7 +423,7 @@ func constructDeployment(ctx context.Context, app *spinv1alpha1.SpinApp, config
Requests: app.Spec.Resources.Requests,
}

env := ConstructEnvForApp(ctx, app)
env := ConstructEnvForApp(ctx, app, spinapp.DefaultHTTPPort)
Copy link
Member

Choose a reason for hiding this comment

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

so in future we may add the ability to override the port using SpinApp CRD?

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 think we'll want to keep it "automatic", but it'll at least be able to be non-80 😅

return nil
}

func ConstructEnvForApp(ctx context.Context, app *spinv1alpha1.SpinApp, listenPort int) []corev1.EnvVar {
envs := make([]corev1.EnvVar, len(app.Spec.Variables))
Copy link
Member

Choose a reason for hiding this comment

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

do we need to make it len(app.Spec.Variabled) + 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nah - it'd be technically marginally faster, but i wanna avoid making the rebase for #273 too complicated

@endocrimes endocrimes merged commit 3fcc9f7 into main Aug 15, 2024
11 checks passed
@endocrimes endocrimes deleted the dani/pass-listen-addr branch August 15, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants