Skip to content

Commit

Permalink
Replace deprecated commonLabels with labels in examples directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
ah8ad3 committed Apr 15, 2024
1 parent 82ee768 commit 40ccfd0
Show file tree
Hide file tree
Showing 15 changed files with 111 additions and 63 deletions.
6 changes: 4 additions & 2 deletions examples/alphaTestExamples/helloapp.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ Now, create `kustomization.yaml` add all your resources.
<!-- @createKustomizationYaml @testE2EAgainstLatestRelease-->
```
cat <<EOF >$BASE/kustomization.yaml
commonLabels:
app: hello
labels:
- includeSelectors: true
pairs:
app: hello

resources:
- deployment.yaml
Expand Down
12 changes: 8 additions & 4 deletions examples/breakfast.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ likes her coffee hot:
mkdir -p $DEMO_HOME/breakfast/overlays/alice
cat <<EOF >$DEMO_HOME/breakfast/overlays/alice/kustomization.yaml
commonLabels:
who: alice
labels:
- includeSelectors: true
pairs:
who: alice
resources:
- ../../base
patches:
Expand All @@ -92,8 +94,10 @@ And likewise a [variant] for Bob, who wants _five_ pancakes, with strawberries:
mkdir -p $DEMO_HOME/breakfast/overlays/bob
cat <<EOF >$DEMO_HOME/breakfast/overlays/bob/kustomization.yaml
commonLabels:
who: bob
labels:
- includeSelectors: true
pairs:
who: bob
resources:
- ../../base
patches:
Expand Down
14 changes: 9 additions & 5 deletions examples/configGeneration.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ curl -s -o "$BASE/#1.yaml" "https://raw.githubusercontent.com\
/{deployment,service}.yaml"

cat <<'EOF' >$BASE/kustomization.yaml
commonLabels:
app: hello
labels:
- includeSelectors: true
pairs:
app: hello
resources:
- deployment.yaml
- service.yaml
Expand All @@ -65,9 +67,11 @@ mkdir -p $OVERLAYS/staging
cat <<'EOF' >$OVERLAYS/staging/kustomization.yaml
namePrefix: staging-
nameSuffix: -v1
commonLabels:
variant: staging
org: acmeCorporation
labels:
- includeSelectors: true
pairs:
variant: staging
org: acmeCorporation
commonAnnotations:
note: Hello, I am staging!
resources:
Expand Down
8 changes: 5 additions & 3 deletions examples/configureBuiltinPlugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Define a place to work:
DEMO_HOME=$(mktemp -d)
```

### Using the `commonLabels` and `commonAnnotations` fields
### Using the `labels` and `commonAnnotations` fields

In this simple example, we'll use just two resources: a deployment and a service.

Expand Down Expand Up @@ -100,8 +100,10 @@ to be read and transformed:
```
cat <<'EOF' >$DEMO_HOME/kustomization.yaml
namePrefix: hello-
commonLabels:
app: hello
labels:
- includeSelectors: true
pairs:
app: hello
commonAnnotations:
area: "51"
greeting: Take me to your leader
Expand Down
16 changes: 10 additions & 6 deletions examples/helloWorld/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ defining a new name prefix, and some different labels.
```
cat <<'EOF' >$OVERLAYS/staging/kustomization.yaml
namePrefix: staging-
commonLabels:
variant: staging
org: acmeCorporation
labels:
- includeSelectors: true
pairs:
variant: staging
org: acmeCorporation
commonAnnotations:
note: Hello, I am staging!
resources:
Expand Down Expand Up @@ -184,9 +186,11 @@ with a different name prefix and labels.
```
cat <<EOF >$OVERLAYS/production/kustomization.yaml
namePrefix: production-
commonLabels:
variant: production
org: acmeCorporation
labels:
- includeSelectors: true
pairs:
variant: production
org: acmeCorporation
commonAnnotations:
note: Hello, I am production!
resources:
Expand Down
6 changes: 4 additions & 2 deletions examples/helloWorld/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ metadata:

# Example configuration for the webserver
# at https://github.com/monopole/hello
commonLabels:
app: hello
labels:
- includeSelectors: true
pairs:
app: hello

resources:
- deployment.yaml
Expand Down
6 changes: 4 additions & 2 deletions examples/springboot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ add a label, but one can always edit
<!-- @customizeLabels @testAgainstLatestRelease -->
```
cat <<EOF >>$DEMO_HOME/kustomization.yaml
commonLabels:
env: prod
labels:
- includeSelectors: true
pairs:
env: prod
EOF
```
Expand Down
18 changes: 11 additions & 7 deletions examples/transformerconfigs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ The labels transformer adds labels to the `metadata/labels` field for all resour
Example:

```yaml
commonLabels:
- path: metadata/labels
create: true
labels:
- includeSelectors: true
pairs:
path: metadata/labels
create: true
- path: spec/selector
create: true
Expand All @@ -97,10 +99,12 @@ commonLabels:
Example kustomization.yaml:

```yaml
commonLabels:
someName: someValue
owner: alice
app: bingo
labels:
- includeSelectors: true
pairs:
someName: someValue
owner: alice
app: bingo
```

## Annotations transformer
Expand Down
16 changes: 10 additions & 6 deletions examples/transformerconfigs/crd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ Add the following file to configure the transformers for the above fields
mkdir $DEMO_HOME/kustomizeconfig
cat > $DEMO_HOME/kustomizeconfig/mykind.yaml << EOF
commonLabels:
- path: spec/selectors
create: true
kind: MyKind
labels:
- includeSelectors: true
pairs:
path: spec/selectors
create: true
kind: MyKind
nameReference:
- kind: Bee
Expand Down Expand Up @@ -96,8 +98,10 @@ resources:
namePrefix: test-
commonLabels:
foo: bar
labels:
- includeSelectors: true
pairs:
foo: bar
vars:
- name: BEE_ACTION
Expand Down
6 changes: 4 additions & 2 deletions examples/transformerconfigs/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ resources:

namePrefix: test-

commonLabels:
foo: bar
labels:
- includeSelectors: true
pairs:
foo: bar

vars:
- name: BEE_ACTION
Expand Down
12 changes: 8 additions & 4 deletions examples/zh/breakfast.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ EOF
mkdir -p $DEMO_HOME/breakfast/overlays/alice
cat <<EOF >$DEMO_HOME/breakfast/overlays/alice/kustomization.yaml
commonLabels:
who: alice
labels:
- includeSelectors: true
pairs:
who: alice
resources:
- ../../base
patches:
Expand All @@ -86,8 +88,10 @@ EOF
mkdir -p $DEMO_HOME/breakfast/overlays/bob
cat <<EOF >$DEMO_HOME/breakfast/overlays/bob/kustomization.yaml
commonLabels:
who: bob
labels:
- includeSelectors: true
pairs:
who: bob
resources:
- ../../base
patches:
Expand Down
14 changes: 9 additions & 5 deletions examples/zh/configGeneration.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ curl -s -o "$BASE/#1.yaml" "https://raw.githubusercontent.com\
/{deployment,service}.yaml"

cat <<'EOF' >$BASE/kustomization.yaml
commonLabels:
app: hello
labels:
- includeSelectors: true
pairs:
app: hello
resources:
- deployment.yaml
- service.yaml
Expand All @@ -70,9 +72,11 @@ mkdir -p $OVERLAYS/staging
cat <<'EOF' >$OVERLAYS/staging/kustomization.yaml
namePrefix: staging-
nameSuffix: -v1
commonLabels:
variant: staging
org: acmeCorporation
labels:
- includeSelectors: true
pairs:
variant: staging
org: acmeCorporation
commonAnnotations:
note: Hello, I am staging!
resources:
Expand Down
16 changes: 10 additions & 6 deletions examples/zh/helloWorld.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ mkdir -p $OVERLAYS/production
```
cat <<'EOF' >$OVERLAYS/staging/kustomization.yaml
namePrefix: staging-
commonLabels:
variant: staging
org: acmeCorporation
labels:
- includeSelectors: true
pairs:
variant: staging
org: acmeCorporation
commonAnnotations:
note: Hello, I am staging!
resources:
Expand Down Expand Up @@ -170,9 +172,11 @@ EOF
```
cat <<EOF >$OVERLAYS/production/kustomization.yaml
namePrefix: production-
commonLabels:
variant: production
org: acmeCorporation
labels:
- includeSelectors: true
pairs:
variant: production
org: acmeCorporation
commonAnnotations:
note: Hello, I am production!
resources:
Expand Down
6 changes: 4 additions & 2 deletions examples/zh/springboot.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,10 @@ kustomize build $DEMO_HOME | grep prod-
<!-- @customizeLabels @testAgainstLatestRelease -->
```
cat <<EOF >>$DEMO_HOME/kustomization.yaml
commonLabels:
env: prod
labels:
- includeSelectors: true
pairs:
env: prod
EOF
```
Expand Down
18 changes: 11 additions & 7 deletions examples/zh/transformerconfigs.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ labels transformer 将 labels 添加到所有资源的 `metadata/labels` 字段
示例:

```yaml
commonLabels:
- path: metadata/labels
create: true
labels:
- includeSelectors: true
pairs:
path: metadata/labels
create: true
- path: spec/selector
create: true
Expand All @@ -90,10 +92,12 @@ commonLabels:
kustomization.yaml 示例:

```yaml
commonLabels:
someName: someValue
owner: alice
app: bingo
labels:
- includeSelectors: true
pairs:
someName: someValue
owner: alice
app: bingo
```

## Annotations transformer
Expand Down

0 comments on commit 40ccfd0

Please sign in to comment.