Integration tests should use 'kubectl explain --output plaintext-openapiv2'

- OpenAPIV3 discovery of aggregate APIs seems to need a little more work in K8s 1.28
This commit is contained in:
Joshua Casey 2023-08-24 13:08:15 -05:00
parent 1b504b6fbd
commit ca05969f8d
3 changed files with 5 additions and 1 deletions

View File

@ -228,8 +228,10 @@ func getAggregatedAPIServerConfig(
// `kubectl explain` to work for the Concierge's aggregated API resources. // `kubectl explain` to work for the Concierge's aggregated API resources.
serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig( serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(
conciergeopenapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(scheme)) conciergeopenapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(scheme))
// serverConfig.OpenAPIConfig.Info.InfoProps.Title = "Pinniped Concierge"
serverConfig.OpenAPIV3Config = genericapiserver.DefaultOpenAPIV3Config( serverConfig.OpenAPIV3Config = genericapiserver.DefaultOpenAPIV3Config(
conciergeopenapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(scheme)) conciergeopenapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(scheme))
// serverConfig.OpenAPIV3Config.Info.InfoProps.Title = "Pinniped Concierge"
// Note that among other things, this ApplyTo() function copies // Note that among other things, this ApplyTo() function copies
// `recommendedOptions.SecureServing.ServerCert.GeneratedCert` into // `recommendedOptions.SecureServing.ServerCert.GeneratedCert` into
// `serverConfig.SecureServing.Cert` thus making `dynamicCertProvider` // `serverConfig.SecureServing.Cert` thus making `dynamicCertProvider`

View File

@ -613,8 +613,10 @@ func getAggregatedAPIServerConfig(
// `kubectl explain` to work for the Supervisor's aggregated API resources. // `kubectl explain` to work for the Supervisor's aggregated API resources.
serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig( serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(
supervisoropenapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(scheme)) supervisoropenapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(scheme))
// serverConfig.OpenAPIConfig.Info.InfoProps.Title = "Pinniped Supervisor"
serverConfig.OpenAPIV3Config = genericapiserver.DefaultOpenAPIV3Config( serverConfig.OpenAPIV3Config = genericapiserver.DefaultOpenAPIV3Config(
supervisoropenapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(scheme)) supervisoropenapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(scheme))
// serverConfig.OpenAPIV3Config.Info.InfoProps.Title = "Pinniped Supervisor"
// Note that among other things, this ApplyTo() function copies // Note that among other things, this ApplyTo() function copies
// `recommendedOptions.SecureServing.ServerCert.GeneratedCert` into // `recommendedOptions.SecureServing.ServerCert.GeneratedCert` into
// `serverConfig.SecureServing.Cert` thus making `dynamicCertProvider` // `serverConfig.SecureServing.Cert` thus making `dynamicCertProvider`

View File

@ -701,7 +701,7 @@ func runKubectlVersion(t *testing.T) {
func runKubectlExplain(t *testing.T, resourceName string, apiVersion string) string { func runKubectlExplain(t *testing.T, resourceName string, apiVersion string) string {
t.Helper() t.Helper()
var stdOut, stdErr bytes.Buffer var stdOut, stdErr bytes.Buffer
cmd := exec.Command("kubectl", "explain", resourceName, "--api-version", apiVersion) cmd := exec.Command("kubectl", "explain", resourceName, "--api-version", apiVersion, "--output", "plaintext-openapiv2")
t.Log("Running:", cmd.String()) t.Log("Running:", cmd.String())
cmd.Stdout = &stdOut cmd.Stdout = &stdOut
cmd.Stderr = &stdErr cmd.Stderr = &stdErr