generate OpenAPI schema for Helm schematic compDef (#1250)

* get JSON schema for Helm schematic ComponentDefinition

Signed-off-by: roy wang <seiwy2010@gmail.com>

* add e2e test

update doc

add unit tests

Signed-off-by: roywang <seiwy2010@gmail.com>
This commit is contained in:
Yue Wang
2021-03-23 01:16:17 +09:00
committed by GitHub
parent dbc4593b23
commit f554523196
15 changed files with 1053 additions and 25 deletions

View File

@@ -340,6 +340,7 @@ var _ = Describe("Versioning mechanism of components", func() {
var w1 unstructured.Unstructured
Eventually(
func() error {
reconcileAppConfigNow(ctx, &appconfig)
w1.SetAPIVersion("example.com/v1")
w1.SetKind("Bar")
return k8sClient.Get(ctx, client.ObjectKey{Namespace: namespace, Name: revisionNameV1}, &w1)

View File

@@ -2,6 +2,7 @@ package controllers_test
import (
"context"
"errors"
"fmt"
"strings"
"time"
@@ -285,4 +286,18 @@ var _ = Describe("Test application containing helm module", func() {
}, 120*time.Second, 10*time.Second).Should(BeTrue())
})
It("Test store JSON schema of Helm Chart in ConfigMap", func() {
By("Get the ConfigMap")
cmName := fmt.Sprintf("schema-%s", cdName)
Eventually(func() error {
cm := &corev1.ConfigMap{}
if err := k8sClient.Get(ctx, client.ObjectKey{Name: cmName, Namespace: namespace}, cm); err != nil {
return err
}
if cm.Data["openapi-v3-json-schema"] == "" {
return errors.New("json schema is not found in the ConfigMap")
}
return nil
}, 60*time.Second, 5*time.Second).Should(Succeed())
})
})