Skip to content

Commit

Permalink
chore(*): remove flag '--experimental-meshgateway' (#4315)
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Mike Beaumont <mjboamail@gmail.com>
  • Loading branch information
lobkovilya authored May 23, 2022
1 parent 0d7cd32 commit 1f12a16
Show file tree
Hide file tree
Showing 45 changed files with 3,351 additions and 524 deletions.
6 changes: 2 additions & 4 deletions app/kumactl/cmd/completion/testdata/bash.golden
Original file line number Diff line number Diff line change
Expand Up @@ -3512,8 +3512,6 @@ _kumactl_install_control-plane()
local_nonpersistent_flags+=("--env-var=")
flags+=("--experimental-gatewayapi")
local_nonpersistent_flags+=("--experimental-gatewayapi")
flags+=("--experimental-meshgateway")
local_nonpersistent_flags+=("--experimental-meshgateway")
flags+=("--hooks-node-selector=")
two_word_flags+=("--hooks-node-selector")
local_nonpersistent_flags+=("--hooks-node-selector")
Expand Down Expand Up @@ -3627,8 +3625,8 @@ _kumactl_install_crds()
flags_with_completion=()
flags_completion=()

flags+=("--experimental-meshgateway")
local_nonpersistent_flags+=("--experimental-meshgateway")
flags+=("--experimental-gatewayapi")
local_nonpersistent_flags+=("--experimental-gatewayapi")
flags+=("--only-missing")
local_nonpersistent_flags+=("--only-missing")
flags+=("--api-timeout=")
Expand Down
13 changes: 5 additions & 8 deletions app/kumactl/cmd/install/context/install_control_plane_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ type InstallControlPlaneArgs struct {
Egress_nodeSelector map[string]string `helm:"egress.nodeSelector"`
Hooks_nodeSelector map[string]string `helm:"hooks.nodeSelector"`
WithoutKubernetesConnection bool // there is no HELM equivalent, HELM always require connection to Kubernetes
ExperimentalMeshGateway bool `helm:"experimental.meshGateway"`
ExperimentalGatewayAPI bool `helm:"experimental.gatewayAPI"`
ValueFiles []string
Values []string
Expand Down Expand Up @@ -118,17 +117,15 @@ func DefaultInstallCpContext() InstallCpContext {
if err != nil {
return nil, err
}
if !args.ExperimentalMeshGateway {
files = files.Filter(ExcludeGatewayCRDs)
if !args.ExperimentalGatewayAPI {
files = files.Filter(ExcludeGatewayAPICRDs)
}

return files, nil
},
HELMValuesPrefix: "",
}
}

func ExcludeGatewayCRDs(file data.File) bool {
return file.Name != "kuma.io_meshgateways.yaml" &&
file.Name != "kuma.io_meshgatewayroutes.yaml" &&
file.Name != "kuma.io_meshgatewayinstances.yaml"
func ExcludeGatewayAPICRDs(file data.File) bool {
return file.Name != "kuma.io_meshgatewayconfigs.yaml"
}
11 changes: 6 additions & 5 deletions app/kumactl/cmd/install/context/install_crds_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
)

type InstallCrdsArgs struct {
OnlyMissing bool
ExperimentalMeshGateway bool
OnlyMissing bool
ExperimentalGatewayAPI bool
}

type InstallCrdsContext struct {
Expand All @@ -21,7 +21,8 @@ type InstallCrdsContext struct {
func DefaultInstallCrdsContext() InstallCrdsContext {
return InstallCrdsContext{
Args: InstallCrdsArgs{
OnlyMissing: false,
OnlyMissing: false,
ExperimentalGatewayAPI: false,
},
InstallCrdTemplateFiles: func(args InstallCrdsArgs) (data.FileList, error) {
helmFiles, err := data.ReadFiles(deployments.KumaChartFS())
Expand All @@ -33,8 +34,8 @@ func DefaultInstallCrdsContext() InstallCrdsContext {
return strings.Contains(file.FullPath, "crds/")
})

if !args.ExperimentalMeshGateway {
crdFiles = crdFiles.Filter(ExcludeGatewayCRDs)
if !args.ExperimentalGatewayAPI {
crdFiles = crdFiles.Filter(ExcludeGatewayAPICRDs)
}

return crdFiles, nil
Expand Down
9 changes: 5 additions & 4 deletions app/kumactl/cmd/install/install_control_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ func newInstallControlPlaneCmd(ctx *install_context.InstallCpContext) *cobra.Com
Long: `Install Kuma Control Plane on Kubernetes in its own namespace.
This command requires that the KUBECONFIG environment is set`,
RunE: func(cmd *cobra.Command, _ []string) error {
if args.ExperimentalMeshGateway {
register.RegisterGatewayTypes()
mesh_k8s.RegisterK8SGatewayTypes()
register.RegisterGatewayTypes()
mesh_k8s.RegisterK8sGatewayTypes()

if args.ExperimentalGatewayAPI {
mesh_k8s.RegisterK8sGatewayAPITypes()
}

templateFiles, err := ctx.InstallCpTemplateFiles(&args)
Expand Down Expand Up @@ -203,7 +205,6 @@ This command requires that the KUBECONFIG environment is set`,
cmd.Flags().StringToStringVar(&args.Egress_nodeSelector, "egress-node-selector", args.Egress_nodeSelector, "node selector for Zone Egress")
cmd.Flags().StringToStringVar(&args.Hooks_nodeSelector, "hooks-node-selector", args.Hooks_nodeSelector, "node selector for Helm hooks")
cmd.Flags().BoolVar(&args.WithoutKubernetesConnection, "without-kubernetes-connection", false, "install without connection to Kubernetes cluster. This can be used for initial Kuma installation, but not for upgrades")
cmd.Flags().BoolVar(&args.ExperimentalMeshGateway, "experimental-meshgateway", false, "install experimental built-in MeshGateway support")
cmd.Flags().BoolVar(&args.ExperimentalGatewayAPI, "experimental-gatewayapi", false, "install experimental Gateway API support")
cmd.Flags().StringSliceVarP(&args.ValueFiles, "values", "f", []string{}, "specify values in a YAML file or '-' for stdin. This is similar to `helm template <chart> -f ...`")
cmd.Flags().StringArrayVar(&args.Values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2), This is similar to `helm template <chart> --set ...` to use set-file or set-string just use helm instead")
Expand Down
1 change: 0 additions & 1 deletion app/kumactl/cmd/install/install_control_plane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ var _ = Describe("kumactl install control-plane", func() {
"--zone", "zone-1",
"--use-node-port",
"--without-kubernetes-connection",
"--experimental-meshgateway",
"--experimental-gatewayapi",
},
goldenFile: "install-control-plane.overrides.golden.yaml",
Expand Down
10 changes: 6 additions & 4 deletions app/kumactl/cmd/install/install_crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ func newInstallCrdsCmd(ctx *install_context.InstallCrdsContext) *cobra.Command {
Use: "crds",
Short: "Install Kuma Custom Resource Definitions on Kubernetes",
RunE: func(cmd *cobra.Command, _ []string) error {
if args.ExperimentalMeshGateway {
register.RegisterGatewayTypes()
mesh_k8s.RegisterK8SGatewayTypes()
register.RegisterGatewayTypes()
mesh_k8s.RegisterK8sGatewayTypes()

if args.ExperimentalGatewayAPI {
mesh_k8s.RegisterK8sGatewayAPITypes()
}

wantCrdFiles, err := ctx.InstallCrdTemplateFiles(args)
Expand Down Expand Up @@ -86,7 +88,7 @@ func newInstallCrdsCmd(ctx *install_context.InstallCrdsContext) *cobra.Command {
}

cmd.Flags().BoolVar(&args.OnlyMissing, "only-missing", false, "install only resources which are not already present in a cluster")
cmd.Flags().BoolVar(&args.ExperimentalMeshGateway, "experimental-meshgateway", false, "install experimental built-in MeshGateway support")
cmd.Flags().BoolVar(&args.ExperimentalGatewayAPI, "experimental-gatewayapi", false, "install experimental Gateway API support")

return cmd
}
Expand Down
6 changes: 3 additions & 3 deletions app/kumactl/cmd/install/install_crds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ var _ = Describe("kumactl install crds", func() {
extraArgs: nil,
goldenFile: "install-crds.all.golden.yaml",
}),
Entry("should generate all Kuma's CRD resources including experimental meshgateway", testCase{
extraArgs: []string{"--experimental-meshgateway"},
goldenFile: "install-crds.experimental-meshgateway.golden.yaml",
Entry("should generate all Kuma's CRD resources and Gateway API resources", testCase{
extraArgs: []string{"--experimental-gatewayapi"},
goldenFile: "install-crds.experimental-gatewayapi.golden.yaml",
}),
)
})
Loading

0 comments on commit 1f12a16

Please sign in to comment.