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: Backport #5275 to release-1.6 #5559

Merged
merged 5 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
255 changes: 128 additions & 127 deletions charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml

Large diffs are not rendered by default.

230 changes: 116 additions & 114 deletions charts/vela-core/crds/core.oam.dev_applications.yaml

Large diffs are not rendered by default.

159 changes: 80 additions & 79 deletions charts/vela-core/crds/core.oam.dev_healthscopes.yaml

Large diffs are not rendered by default.

255 changes: 128 additions & 127 deletions charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml

Large diffs are not rendered by default.

230 changes: 116 additions & 114 deletions charts/vela-minimal/crds/core.oam.dev_applications.yaml

Large diffs are not rendered by default.

159 changes: 80 additions & 79 deletions charts/vela-minimal/crds/core.oam.dev_healthscopes.yaml

Large diffs are not rendered by default.

152 changes: 79 additions & 73 deletions go.mod

Large diffs are not rendered by default.

352 changes: 177 additions & 175 deletions go.sum

Large diffs are not rendered by default.

Large diffs are not rendered by default.

230 changes: 116 additions & 114 deletions legacy/charts/vela-core-legacy/crds/core.oam.dev_applications.yaml

Large diffs are not rendered by default.

159 changes: 80 additions & 79 deletions legacy/charts/vela-core-legacy/crds/core.oam.dev_healthscopes.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ var _ = Describe("test generate revision ", func() {
// add an annotation to workload Definition
wd.SetAnnotations(map[string]string{oam.AnnotationAppRollout: "true"})
appRevision2.Spec.WorkloadDefinitions[wd.Name] = wd
// change the cd meta
cd.ClusterName = "testCluster"
appRevision2.Spec.ComponentDefinitions[cd.Name] = cd

verifyEqual()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var _ = Describe("Test DefinitionRevision created by ComponentDefinition", func(
content, err := os.ReadFile("./test-data/webservice-cd.yaml")
Expect(err).Should(BeNil())
var cd v1beta1.ComponentDefinition
yaml.Unmarshal(content, &cd)
Expect(yaml.Unmarshal(content, &cd)).Should(BeNil())
cd.Name = cdName
cd.Namespace = namespace

Expand Down
6 changes: 3 additions & 3 deletions references/cli/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func NewGenKubeConfigCommand(f velacmd.Factory, streams util.IOStreams) *cobra.C
Annotations: map[string]string{
types.TagCommandType: types.TypeCD,
},
Args: cobra.ExactValidArgs(0),
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
o.Complete(f, cmd)
cmdutil.CheckErr(o.Validate())
Expand Down Expand Up @@ -271,7 +271,7 @@ func NewListPrivilegesCommand(f velacmd.Factory, streams util.IOStreams) *cobra.
Annotations: map[string]string{
types.TagCommandType: types.TypeCD,
},
Args: cobra.ExactValidArgs(0),
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
o.Complete(f, cmd)
cmdutil.CheckErr(o.Validate(f, cmd))
Expand Down Expand Up @@ -442,7 +442,7 @@ func NewGrantPrivilegesCommand(f velacmd.Factory, streams util.IOStreams) *cobra
Annotations: map[string]string{
types.TagCommandType: types.TypeCD,
},
Args: cobra.ExactValidArgs(0),
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
o.Complete(f, cmd)
cmdutil.CheckErr(o.Validate(f, cmd))
Expand Down
16 changes: 8 additions & 8 deletions references/cli/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func NewClusterListCommand(c *common.Args) *cobra.Command {
Aliases: []string{"ls"},
Short: "list managed clusters",
Long: "list worker clusters managed by KubeVela.",
Args: cobra.ExactValidArgs(0),
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
table := newUITable().AddRow("CLUSTER", "ALIAS", "TYPE", "ENDPOINT", "ACCEPTED", "LABELS")
client, err := c.GetClient()
Expand Down Expand Up @@ -145,7 +145,7 @@ func NewClusterJoinCommand(c *common.Args, ioStreams cmdutil.IOStreams) *cobra.C
Long: "join managed cluster by kubeconfig.",
Example: "# Join cluster declared in my-child-cluster.kubeconfig\n" +
"> vela cluster join my-child-cluster.kubeconfig --name example-cluster",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
// get ClusterName from flag or config
clusterName, err := cmd.Flags().GetString(FlagClusterName)
Expand Down Expand Up @@ -208,7 +208,7 @@ func NewClusterRenameCommand(c *common.Args) *cobra.Command {
Use: "rename [OLD_NAME] [NEW_NAME]",
Short: "rename managed cluster.",
Long: "rename managed cluster.",
Args: cobra.ExactValidArgs(2),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
oldClusterName := args[0]
newClusterName := args[1]
Expand All @@ -232,7 +232,7 @@ func NewClusterDetachCommand(c *common.Args) *cobra.Command {
Use: "detach [CLUSTER_NAME]",
Short: "detach managed cluster.",
Long: "detach managed cluster.",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clusterName := args[0]
configPath, _ := cmd.Flags().GetString(FlagKubeConfigPath)
Expand All @@ -259,7 +259,7 @@ func NewClusterAliasCommand(c *common.Args) *cobra.Command {
Use: "alias CLUSTER_NAME ALIAS",
Short: "alias a named cluster.",
Long: "alias a named cluster.",
Args: cobra.ExactValidArgs(2),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clusterName, aliasName := args[0], args[1]
k8sClient, err := c.GetClient()
Expand All @@ -283,7 +283,7 @@ func NewClusterProbeCommand(c *common.Args) *cobra.Command {
Use: "probe [CLUSTER_NAME]",
Short: "health probe managed cluster.",
Long: "health probe managed cluster.",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clusterName := args[0]
config, err := c.GetConfig()
Expand Down Expand Up @@ -346,7 +346,7 @@ func NewClusterAddLabelsCommand(c *common.Args) *cobra.Command {
Short: "add labels to managed cluster",
Long: "add labels to managed cluster",
Example: "vela cluster labels add my-cluster project=kubevela,owner=oam-dev",
Args: cobra.ExactValidArgs(2),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clusterName := args[0]
addLabels := map[string]string{}
Expand Down Expand Up @@ -382,7 +382,7 @@ func NewClusterDelLabelsCommand(c *common.Args) *cobra.Command {
Aliases: []string{"delete", "remove"},
Short: "delete labels for managed cluster",
Long: "delete labels for managed cluster",
Args: cobra.ExactValidArgs(2),
Args: cobra.ExactArgs(2),
Example: "vela cluster labels del my-cluster project,owner",
RunE: func(cmd *cobra.Command, args []string) error {
clusterName := args[0]
Expand Down
18 changes: 9 additions & 9 deletions references/cli/def.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func NewDefinitionInitCommand(c common.Args) *cobra.Command {
"> vela def init vswitch --type component --provider alibaba --desc xxx --git https://github.com/kubevela-contrib/terraform-modules.git --path alibaba/vswitch\n" +
"# Initiate a Terraform ComponentDefinition named redis from local file for AWS.\n" +
"> vela def init redis --type component --provider aws --desc \"Terraform configuration for AWS Redis\" --local redis.tf",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
var defStr string
definitionType, err := cmd.Flags().GetString(FlagType)
Expand Down Expand Up @@ -449,7 +449,7 @@ func NewDefinitionGetCommand(c common.Args) *cobra.Command {
"> vela def get webservice\n" +
"# Command below will get the TraitDefinition of annotations in namespace vela-system\n" +
"> vela def get annotations --type trait --namespace vela-system",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
definitionType, err := cmd.Flags().GetString(FlagType)
if err != nil {
Expand Down Expand Up @@ -562,7 +562,7 @@ func NewDefinitionListCommand(c common.Args) *cobra.Command {
"> vela def list\n" +
"# Command below will list all definitions in the vela-system namespace\n" +
"> vela def get annotations --type trait --namespace vela-system",
Args: cobra.ExactValidArgs(0),
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
definitionType, err := cmd.Flags().GetString(FlagType)
if err != nil {
Expand Down Expand Up @@ -649,7 +649,7 @@ func NewDefinitionEditCommand(c common.Args) *cobra.Command {
"> vela def edit webservice\n" +
"# Command below will edit the TraitDefinition of ingress in vela-system namespace\n" +
"> vela def edit ingress --type trait --namespace vela-system",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
definitionType, err := cmd.Flags().GetString(FlagType)
if err != nil {
Expand Down Expand Up @@ -749,7 +749,7 @@ func NewDefinitionRenderCommand(c common.Args) *cobra.Command {
"> vela def render my-webservice.cue -o my-webservice.yaml" +
"# Command below will render all cue format definitions in the ./defs/cue/ directory and save the YAML objects in ./defs/yaml/.\n" +
"> vela def render ./defs/cue/ -o ./defs/yaml/",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
output, err := cmd.Flags().GetString(FlagOutput)
if err != nil {
Expand Down Expand Up @@ -862,7 +862,7 @@ func NewDefinitionApplyCommand(c common.Args, streams util.IOStreams) *cobra.Com
"> vela def apply https://my-host-to-def/my-trait.cue --dry-run" +
"# Apply a CUE from stdin \n" +
"> vela def apply -",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
ctx := context.Background()
dryRun, err := cmd.Flags().GetBool(FlagDryRun)
Expand Down Expand Up @@ -975,7 +975,7 @@ func NewDefinitionDelCommand(c common.Args) *cobra.Command {
Long: "Delete X-Definition in kubernetes cluster.",
Example: "# Command below will delete TraitDefinition of annotations in default namespace\n" +
"> vela def del annotations -t trait -n default",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
definitionType, err := cmd.Flags().GetString(FlagType)
if err != nil {
Expand Down Expand Up @@ -1041,7 +1041,7 @@ func NewDefinitionValidateCommand(c common.Args) *cobra.Command {
"* Currently, this command only checks the cue format. This function is still working in progress and we will support more functional validation mechanism in the future.",
Example: "# Command below will validate the my-def.cue file.\n" +
"> vela def vet my-def.cue",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cueBytes, err := os.ReadFile(args[0])
if err != nil {
Expand Down Expand Up @@ -1077,7 +1077,7 @@ func NewDefinitionGenAPICommand(c common.Args) *cobra.Command {
"* Currently, this function is still working in progress and not all formats of parameter in X-definition are supported yet.",
Example: "# Command below will generate the Go struct for the my-def.cue file.\n" +
"> vela def gen-api my-def.cue",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
cueBytes, err := os.ReadFile(args[0])
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion references/cli/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func NewKubeApplyCommand(f velacmd.Factory, streams util.IOStreams) *cobra.Comma
Annotations: map[string]string{
types.TagCommandType: types.TypeCD,
},
Args: cobra.ExactValidArgs(0),
Args: cobra.ExactArgs(0),
Run: func(cmd *cobra.Command, args []string) {
o.namespace = velacmd.GetNamespace(f, cmd)
o.clusters = velacmd.GetClusters(cmd)
Expand Down
4 changes: 2 additions & 2 deletions references/cli/revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewRevisionListCommand(c common.Args) *cobra.Command {
Aliases: []string{"ls"},
Short: "list application revisions",
Long: "list Kubevela application revisions",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
namespace, err := GetFlagNamespaceOrEnv(cmd, c)
if err != nil {
Expand Down Expand Up @@ -129,7 +129,7 @@ func NewRevisionGetCommand(c common.Args) *cobra.Command {
Aliases: []string{"get"},
Short: "get specific revision of application",
Long: "get specific revision of application",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
namespace, err := GetFlagNamespaceOrEnv(cmd, c)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion references/cli/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func NewSystemInfoCommand(c common.Args) *cobra.Command {
Use: "info",
Short: "Print the system deployment detail information in all namespaces with label app.kubernetes.io/name=vela-core.",
Long: "Print the system deployment detail information in all namespaces with label app.kubernetes.io/name=vela-core.",
Args: cobra.ExactValidArgs(0),
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
// Get deploymentName from flag
deployName, err := cmd.Flags().GetString(FlagSpecify)
Expand Down
1 change: 0 additions & 1 deletion references/cli/top/model/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ var _ = Describe("test Application", func() {
Expect(err).NotTo(HaveOccurred())
Expect(application.Name).To(Equal("first-vela-app"))
Expect(application.Namespace).To(Equal("default"))
Expect(application.ClusterName).To(Equal(""))
Expect(len(application.Spec.Components)).To(Equal(1))
})
It("application resource topology", func() {
Expand Down
1 change: 0 additions & 1 deletion references/cli/top/model/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ var _ = Describe("test pod", func() {
Name: "pod",
Namespace: "ns",
CreationTimestamp: metav1.Time{Time: time.Now()},
ClusterName: "",
},
Spec: v1.PodSpec{
NodeName: "node-1",
Expand Down
2 changes: 1 addition & 1 deletion references/cli/uischema.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewUISchemaCommand(c common.Args, order string, ioStreams util.IOStreams) *
cmd.AddCommand(&cobra.Command{
Use: "apply",
Short: "apply <ui schema file/dir path>",
Args: cobra.ExactValidArgs(1),
Args: cobra.ExactArgs(1),
Long: "apply UI schema from a file or dir",
Annotations: map[string]string{
types.TagCommandType: types.TypeExtension,
Expand Down
4 changes: 2 additions & 2 deletions test/e2e-apiserver-test/oam_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var _ = Describe("Test oam application rest api", func() {
Policies: app.Spec.Policies,
Workflow: app.Spec.Workflow,
}
res := post(fmt.Sprintf("/v1/namespaces/%s/applications/%s?dryRun=All", namespace, appName), req)
suwliang3 marked this conversation as resolved.
Show resolved Hide resolved
res := post(fmt.Sprintf("/v1/namespaces/%s/applications/%s?dryRun=All", namespace, appName+"-dryrun"), req)
Expect(res).ShouldNot(BeNil())
Expect(cmp.Diff(res.StatusCode, 200)).Should(BeEmpty())
Expect(res.Body).ShouldNot(BeNil())
Expand All @@ -119,7 +119,7 @@ var _ = Describe("Test oam application rest api", func() {
Components: app.Spec.Components[1:],
}
Eventually(func(g Gomega) {
res = post(fmt.Sprintf("/v1/namespaces/%s/applications/%s?dryRun=All", namespace, appName), updateReq)
res = post(fmt.Sprintf("/v1/namespaces/%s/applications/%s?dryRun=All", namespace, appName+"-dryrun"), updateReq)
g.Expect(res).ShouldNot(BeNil())
g.Expect(cmp.Diff(res.StatusCode, 200)).Should(BeEmpty())
g.Expect(res.Body).ShouldNot(BeNil())
Expand Down