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

Fix running api server locally #38

Merged
merged 1 commit into from
Apr 21, 2024

Conversation

efiacor
Copy link
Collaborator

@efiacor efiacor commented Apr 18, 2024

No description provided.

Copy link
Member

@liamfallon liamfallon left a comment

Choose a reason for hiding this comment

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

OK, the Porch server won't run locally for me now either on the latest Kubernetes. We need this.

serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(sampleopenapi.GetOpenAPIDefinitions, openapi.NewDefinitionNamer(apiserver.Scheme))
serverConfig.OpenAPIConfig.Info.Title = "Porch"
serverConfig.OpenAPIConfig.Info.Version = "0.1"
serverConfig.OpenAPIConfig.Info.Title = OpenAPITitle
Copy link
Member

Choose a reason for hiding this comment

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

Why did we have to change these lines?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See above.


serverConfig.OpenAPIV3Config = genericapiserver.DefaultOpenAPIV3Config(sampleopenapi.GetOpenAPIDefinitions, openapi.NewDefinitionNamer(apiserver.Scheme))
serverConfig.OpenAPIConfig.Info.Title = OpenAPITitle
serverConfig.OpenAPIConfig.Info.Version = OpenAPIVersion
Copy link
Member

Choose a reason for hiding this comment

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

Why dod we need to add these lines?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See above.

const (
defaultEtcdPathPrefix = "/registry/porch.kpt.dev"
OpenAPITitle = "Porch"
OpenAPIVersion = "0.1"
Copy link
Member

Choose a reason for hiding this comment

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

And here, could you explain what's going on?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just defining some constants for the openapi(v3) config.

@liamfallon
Copy link
Member

I downloaded this PR and Porch now runs locally for me.

@efiacor
Copy link
Collaborator Author

efiacor commented Apr 19, 2024

I downloaded this PR and Porch now runs locally for me.

With the upgrade k8s apiserver, the ApplyTo(config *server.RecommendedConfig) requires that the *restclient.Config be set.
https://github.com/kubernetes/apiserver/blob/master/pkg/server/options/recommended.go#L123

With how the run is standalone-debug mode was being set up, the RecommendedOptions.CoreAPI was being set to nil
https://github.com/nephio-project/porch/blob/main/pkg/cmd/server/start.go#L128

meaning that the default restclient would not be setup.
https://github.com/kubernetes/apiserver/blob/master/pkg/server/config.go#L318

So the fix was to remove the nil set above.

@liamfallon
Copy link
Member

Thanks @efiacor

@liamfallon
Copy link
Member

/approve
/lgtm

Copy link
Contributor

nephio-prow bot commented Apr 21, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: efiacor, liamfallon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@nephio-prow nephio-prow bot merged commit 48bb15a into nephio-project:main Apr 21, 2024
6 checks passed
@efiacor efiacor deleted the fix_run_server_local branch April 22, 2024 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants