Skip to content

Commit e8158a6

Browse files
authored
Merge pull request #4136 from mogsie/replace-memcached-memory-limit
🌱 cleanup: Replace "-m=64" with "--memory-limit=64"
2 parents 8f9e72c + cdd7721 commit e8158a6

File tree

12 files changed

+18
-17
lines changed

12 files changed

+18
-17
lines changed

docs/book/src/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ specifications, as demonstrated in the following example:
261261
ContainerPort: 11211,
262262
Name: "memcached",
263263
}},
264-
Command: []string{"memcached", "-m=64", "-o", "modern", "-v"},
264+
Command: []string{"memcached", "--memory-limit=64", "-o", "modern", "-v"},
265265
}},
266266
},
267267
},

docs/book/src/getting-started/testdata/project/internal/controller/memcached_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func (r *MemcachedReconciler) deploymentForMemcached(
255255
ContainerPort: 11211,
256256
Name: "memcached",
257257
}},
258-
Command: []string{"memcached", "-m=64", "-o", "modern", "-v"},
258+
Command: []string{"memcached", "--memory-limit=64", "-o", "modern", "-v"},
259259
}},
260260
},
261261
},

docs/book/src/plugins/creating-plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Note that users are also able to use plugins to customize their scaffolds and ad
112112
See that Kubebuilder provides the [`deploy-image`][deploy-image] plugin that allows the user to create the controller & CRs which will deploy and manage an image on the cluster:
113113

114114
```sh
115-
kubebuilder create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:1.6.15-alpine --image-container-command="memcached,-m=64,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha"
115+
kubebuilder create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:1.6.15-alpine --image-container-command="memcached,--memory-limit=64,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha"
116116
```
117117

118118
This plugin will perform a custom scaffold following the [Operator Pattern][operator-pattern].

docs/book/src/plugins/deploy-image-plugin-v1-alpha.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ After you create a new project with `kubebuilder init` you can create APIs using
3131
Then, by using this plugin you can [create APIs](https://book.kubebuilder.io/cronjob-tutorial/gvks.html) informing the image (Operand) that you would like to deploy on the cluster. Note that you can optionally specify the command that could be used to initialize this container via the flag `--image-container-command` and the port with `--image-container-port` flag. You can also specify the `RunAsUser` value for the Security Context of the container via the flag `--run-as-user`., i.e:
3232

3333
```sh
34-
kubebuilder create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:1.6.15-alpine --image-container-command="memcached,-m=64,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha"
34+
kubebuilder create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:1.6.15-alpine --image-container-command="memcached,--memory-limit=64,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha"
3535
```
3636

3737
<aside class="warning">

docs/book/src/reference/project-config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ plugins:
2323
group: example.com
2424
kind: Memcached
2525
options:
26-
containerCommand: memcached,-m=64,-o,modern,-v
26+
containerCommand: memcached,--memory-limit=64,-o,modern,-v
2727
containerPort: "11211"
2828
image: memcached:1.4.36-alpine
2929
runAsUser: "1001"
@@ -90,7 +90,7 @@ plugins:
9090
group: example.com
9191
kind: Memcached
9292
options:
93-
containerCommand: memcached,-m=64,-o,modern,-v
93+
containerCommand: memcached,--memory-limit=64,-o,modern,-v
9494
containerPort: "11211"
9595
image: memcached:memcached:1.6.26-alpine3.19
9696
runAsUser: "1001"

hack/docs/internal/getting-started/generate_getting_started.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ func (r *MemcachedReconciler) deploymentForMemcached(
481481
ContainerPort: 11211,
482482
Name: "memcached",
483483
}},
484-
Command: []string{"memcached", "-m=64", "-o", "modern", "-v"},
484+
Command: []string{"memcached", "--memory-limit=64", "-o", "modern", "-v"},
485485
}},
486486
},
487487
},

pkg/plugins/golang/deploy-image/v1alpha1/api.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ func (p *createAPISubcommand) UpdateMetadata(cliMeta plugin.CLIMetadata, subcmdM
7676
7777
Note that in the following example we are also adding the optional options to let you inform the command which should be used to create the container and initialize itvia the flag --image-container-command as the Port that should be used
7878
79-
- By informing the command (--image-container-command="memcached,-m=64,-o,modern,-v") your deployment will be scaffold with, i.e.:
79+
- By informing the command (--image-container-command="memcached,--memory-limit=64,-o,modern,-v") your deployment will be scaffold with, i.e.:
8080
81-
Command: []string{"memcached","-m=64","-o","modern","-v"},
81+
Command: []string{"memcached","--memory-limit=64","-o","modern","-v"},
8282
8383
- By informing the Port (--image-container-port) will deployment will be scaffold with, i.e:
8484
@@ -89,7 +89,7 @@ func (p *createAPISubcommand) UpdateMetadata(cliMeta plugin.CLIMetadata, subcmdM
8989
9090
Therefore, the default values informed will be used to scaffold specs for the API.
9191
92-
%[1]s create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:1.6.15-alpine --image-container-command="memcached -m=64 modern -v" --image-container-port="11211" --plugins="deploy-image/v1-alpha" --make=false --namespaced=false
92+
%[1]s create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:1.6.15-alpine --image-container-command="memcached --memory-limit=64 modern -v" --image-container-port="11211" --plugins="deploy-image/v1-alpha" --make=false --namespaced=false
9393
9494
# Generate the manifests
9595
make manifests
@@ -108,7 +108,8 @@ func (p *createAPISubcommand) BindFlags(fs *pflag.FlagSet) {
108108

109109
fs.StringVar(&p.imageContainerCommand, "image-container-command", "", "[Optional] if informed, "+
110110
"will be used to scaffold the container command that should be used to init a container to run the image in "+
111-
"the controller and its spec in the API (CRD/CR). (i.e. --image-container-command=\"memcached,-m=64,modern,-o,-v\")")
111+
"the controller and its spec in the API (CRD/CR). (i.e. "+
112+
"--image-container-command=\"memcached,--memory-limit=64,modern,-o,-v\")")
112113
fs.StringVar(&p.imageContainerPort, "image-container-port", "", "[Optional] if informed, "+
113114
"will be used to scaffold the container port that should be used by container image in "+
114115
"the controller and its spec in the API (CRD/CR). (i.e --image-container-port=\"11211\") ")

test/e2e/alphagenerate/generate_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func ReGenerateProject(kbc *utils.TestContext) {
140140
"--version", "v1",
141141
"--kind", "Memcached",
142142
"--image=memcached:1.6.15-alpine",
143-
"--image-container-command=memcached,-m=64,modern,-v",
143+
"--image-container-command=memcached,--memory-limit=64,modern,-v",
144144
"--image-container-port=11211",
145145
"--run-as-user=1001",
146146
"--plugins=\"deploy-image/v1-alpha\"",
@@ -241,7 +241,7 @@ func ReGenerateProject(kbc *utils.TestContext) {
241241
Expect(fileContainsExpr).To(BeTrue())
242242
var deployImagePluginFields = `kind: Memcached
243243
options:
244-
containerCommand: memcached,-m=64,modern,-v
244+
containerCommand: memcached,--memory-limit=64,modern,-v
245245
containerPort: "11211"
246246
image: memcached:1.6.15-alpine
247247
runAsUser: "1001"`

test/e2e/deployimage/generate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func creatingAPIWithOptions(kbc *utils.TestContext) {
6363
"--plugins", "deploy-image/v1-alpha",
6464
"--image", "memcached:1.6.26-alpine3.19",
6565
"--image-container-port", "11211",
66-
"--image-container-command", "memcached,-m=64,-o,modern,-v",
66+
"--image-container-command", "memcached,--memory-limit=64,-o,modern,-v",
6767
"--run-as-user", "1001",
6868
"--make=false",
6969
"--manifests=false",

test/testdata/generate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function scaffold_test_project {
8787
fi
8888
elif [[ $project =~ deploy-image ]]; then
8989
header_text 'Creating Memcached API with deploy-image plugin ...'
90-
$kb create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:memcached:1.6.26-alpine3.19 --image-container-command="memcached,-m=64,-o,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha" --make=false
90+
$kb create api --group example.com --version v1alpha1 --kind Memcached --image=memcached:memcached:1.6.26-alpine3.19 --image-container-command="memcached,--memory-limit=64,-o,modern,-v" --image-container-port="11211" --run-as-user="1001" --plugins="deploy-image/v1-alpha" --make=false
9191
$kb create api --group example.com --version v1alpha1 --kind Busybox --image=busybox:1.36.1 --plugins="deploy-image/v1-alpha" --make=false
9292
header_text 'Creating Memcached webhook ...'
9393
$kb create webhook --group example.com --version v1alpha1 --kind Memcached --programmatic-validation

0 commit comments

Comments
 (0)