-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mengqi Yu
committed
Aug 10, 2022
1 parent
6e8b94a
commit 608c22a
Showing
27 changed files
with
2,584 additions
and
509 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2022 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package commands | ||
|
||
import ( | ||
"context" | ||
"flag" | ||
|
||
"github.com/GoogleContainerTools/kpt/internal/cmdwasmpull" | ||
"github.com/GoogleContainerTools/kpt/internal/cmdwasmpush" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewWasmCommand(ctx context.Context, version string) *cobra.Command { | ||
repo := &cobra.Command{ | ||
Use: "wasm", | ||
Short: "[Alpha] TODO", // + repodocs.RepoShort, | ||
Long: "[Alpha] TODO", // + repodocs.RepoLong, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
h, err := cmd.Flags().GetBool("help") | ||
if err != nil { | ||
return err | ||
} | ||
if h { | ||
return cmd.Help() | ||
} | ||
return cmd.Usage() | ||
}, | ||
} | ||
|
||
pf := repo.PersistentFlags() | ||
|
||
pf.AddGoFlagSet(flag.CommandLine) | ||
|
||
repo.AddCommand( | ||
cmdwasmpull.NewCommand(ctx), | ||
cmdwasmpush.NewCommand(ctx), | ||
) | ||
|
||
return repo | ||
} |
15 changes: 15 additions & 0 deletions
15
e2e/testdata/fn-render/basicpipeline-wasm/.expected/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
allowWasm: true |
44 changes: 44 additions & 0 deletions
44
e2e/testdata/fn-render/basicpipeline-wasm/.expected/diff.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
diff --git a/Kptfile b/Kptfile | ||
index 8e84241..c237afd 100644 | ||
--- a/Kptfile | ||
+++ b/Kptfile | ||
@@ -2,6 +2,9 @@ apiVersion: kpt.dev/v1 | ||
kind: Kptfile | ||
metadata: | ||
name: app | ||
+ namespace: staging | ||
+ labels: | ||
+ tier: backend | ||
pipeline: | ||
mutators: | ||
- image: gcr.io/kpt-fn/set-namespace:v0.1.3 | ||
diff --git a/resources.yaml b/resources.yaml | ||
index 7a494c9..a9dd224 100644 | ||
--- a/resources.yaml | ||
+++ b/resources.yaml | ||
@@ -15,12 +15,25 @@ apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx-deployment | ||
+ namespace: staging | ||
+ labels: | ||
+ tier: backend | ||
spec: | ||
replicas: 3 | ||
+ selector: | ||
+ matchLabels: | ||
+ tier: backend | ||
+ template: | ||
+ metadata: | ||
+ labels: | ||
+ tier: backend | ||
--- | ||
apiVersion: custom.io/v1 | ||
kind: Custom | ||
metadata: | ||
name: custom | ||
+ namespace: staging | ||
+ labels: | ||
+ tier: backend | ||
spec: | ||
image: nginx:1.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: kpt.dev/v1 | ||
kind: Kptfile | ||
metadata: | ||
name: app | ||
labels: | ||
tier: backend | ||
pipeline: | ||
mutators: | ||
- wasm: gcr.io/mengqiy-playground/set-namespace:v1.2.5 | ||
configMap: | ||
namespace: staging | ||
- wasm: gcr.io/mengqiy-playground/set-labels:v1.2.7 | ||
configMap: | ||
tier: backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: nginx-deployment | ||
spec: | ||
replicas: 3 | ||
--- | ||
apiVersion: custom.io/v1 | ||
kind: Custom | ||
metadata: | ||
name: custom | ||
spec: | ||
image: nginx:1.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.