Implement HTTP Server based on OpenAPI spec (#6835)

* Implement HTTP Server based on OpenAPI spec

Signed-off-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Armel Soro <asoro@redhat.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>

* Starter server when odo dev starts

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add --api-server and --api-server-port flags to start API Server; write the port to stat file; TODO: make this feature experimental

Signed-off-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Armel Soro <asoro@redhat.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>

Make the flag experimental

Signed-off-by: Parthvi Vala <pvala@redhat.com>

Make apiserver and apiserverport flag local

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Use container image to run openapi-generator-tool instead of a local CLI

Co-authored-by: Armel Soro <asoro@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add integration test

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Use label podman

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Regenerate the api files with openapitool v6.6.0 and changes from review

Signed-off-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Armel Soro <asoro@redhat.com>

---------

Signed-off-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Armel Soro <asoro@redhat.com>
Co-authored-by: Philippe Martin <phmartin@redhat.com>
This commit is contained in:
Parthvi Vala
2023-06-19 19:59:36 +05:30
committed by GitHub
parent 4f46fe92ed
commit 0b012f30e5
32 changed files with 1369 additions and 17 deletions

View File

@@ -151,10 +151,6 @@ cross: ## compile for multiple platforms
generate-cli-structure:
go run cmd/cli-doc/cli-doc.go structure
.PHONY: generate-cli-reference
generate-cli-reference:
go run cmd/cli-doc/cli-doc.go reference > docs/cli-reference.adoc
# run make cross before this!
.PHONY: prepare-release
prepare-release: cross ## create gzipped binaries in ./dist/release/ for uploading to GitHub release page
@@ -232,3 +228,21 @@ test-e2e:
.PHONY: test-doc-automation
test-doc-automation:
$(RUN_GINKGO) $(GINKGO_FLAGS_ONE) --junit-report="test-doc-automation.xml" tests/documentation/...
# Generate OpenAPISpec library based on ododevapispec.yaml inside pkg/apiserver-gen; this will only generate interfaces
# Actual implementation must be done inside pkg/apiserver-impl
# Apart from generating the files, this target also formats the generated files
# and removes openapi.yaml to avoid any confusion regarding ododevapispec.yaml file and which file to use.
.PHONY: generate-apiserver
generate-apiserver: ## Generate OpenAPISpec library based on ododevapispec.yaml inside pkg/apiserver-gen
podman run --rm \
-v ${PWD}:/local \
docker.io/openapitools/openapi-generator-cli:v6.6.0 \
generate \
-i /local/ododevapispec.yaml \
-g go-server \
-o /local/pkg/apiserver-gen \
--additional-properties=outputAsLibrary=true,onlyInterfaces=true,hideGenerationTimestamp=true && \
echo "Formatting generated files:" && go fmt ./pkg/apiserver-gen/... && \
echo "Removing pkg/apiserver-gen/api/openapi.yaml" && rm ./pkg/apiserver-gen/api/openapi.yaml