forked from GoogleCloudPlatform/microservices-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kustomize variation to deploy Online Boutique apps without the `grpc-…
…health-probe` bin (GoogleCloudPlatform#1102) * without-grpc-health-probe-bin * fix docker build for cartservice * kustomize - add container-image-registry * kustomize - add container-image-tag * kustomize - add container-image-tag-suffix * fix container-images-registry * fix container-images-tag * complete native-grpc-health-check Kustomize variation * Review tokens in Kustomize files: $() instead of {{}} (issues with Kustomize otherwise) * docker build -t "${image}-native-grpc" * Bonify the custom test in Kustomize CI * Review token to avoid issue in bash with sed: @() instead of $() * Fix token issues with Kustomize * More documentation for the new Kustomize variations * fix docs * update docs * fix link in doc * Fix container-images-registry/README.md * Update container-images-registry/README.md * Update container-images-tag-suffix/README.md * Update container-images-tag-suffix/README.md * Update native-grpc-health-check/README.md * yaml|bash|output in docs * Remove {{ }} around REDIS_ADDR * fix "REDIS_ADDR" token Co-authored-by: minherz <[email protected]> Co-authored-by: Nim Jayawardena <[email protected]>
- Loading branch information
1 parent
e5947e0
commit 7e7f8bb
Showing
27 changed files
with
570 additions
and
59 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
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,28 @@ | ||
# Update the container registry of the Online Boutique apps | ||
|
||
By default, Online Boutique's services' container images are pulled from a public container registry (`gcr.io/google-samples/microservices-demo`). One best practice is to have these container images in your own private container registry. The Kustomize variation in this folder can help with using your own private container registry. | ||
|
||
## Change the default container registry via Kustomize | ||
|
||
To automate the deployment of Online Boutique integrated with your own container registry, you can leverage the following variation with [Kustomize](../..). | ||
|
||
From the `kustomize/` folder at the root level of this repository, execute this command: | ||
```bash | ||
REGISTRY=my-registry # Example: gcr.io/my-project/my-directory | ||
sed -i "s|CONTAINER_IMAGES_REGISTRY|${REGISTRY}|g" components/container-images-registry/kustomization.yaml | ||
kustomize edit add component components/container-images-registry | ||
``` | ||
_Note: this Kustomize component will update the container registry in the `image:` field in all `Deployments`._ | ||
|
||
This will update the `kustomize/kustomization.yaml` file which could be similar to: | ||
```yaml | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- base | ||
components: | ||
- components/container-images-registry | ||
``` | ||
You can (optionally) locally render these manifests by running `kubectl kustomize .`. | ||
You can deploy them by running `kubectl apply -k .`. |
39 changes: 39 additions & 0 deletions
39
kustomize/components/container-images-registry/kustomization.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,39 @@ | ||
# 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. | ||
|
||
apiVersion: kustomize.config.k8s.io/v1alpha1 | ||
kind: Component | ||
images: | ||
- name: gcr.io/google-samples/microservices-demo/adservice | ||
newName: CONTAINER_IMAGES_REGISTRY/adservice | ||
- name: gcr.io/google-samples/microservices-demo/cartservice | ||
newName: CONTAINER_IMAGES_REGISTRY/cartservice | ||
- name: gcr.io/google-samples/microservices-demo/checkoutservice | ||
newName: CONTAINER_IMAGES_REGISTRY/checkoutservice | ||
- name: gcr.io/google-samples/microservices-demo/currencyservice | ||
newName: CONTAINER_IMAGES_REGISTRY/currencyservice | ||
- name: gcr.io/google-samples/microservices-demo/emailservice | ||
newName: CONTAINER_IMAGES_REGISTRY/emailservice | ||
- name: gcr.io/google-samples/microservices-demo/frontend | ||
newName: CONTAINER_IMAGES_REGISTRY/frontend | ||
- name: gcr.io/google-samples/microservices-demo/loadgenerator | ||
newName: CONTAINER_IMAGES_REGISTRY/loadgenerator | ||
- name: gcr.io/google-samples/microservices-demo/paymentservice | ||
newName: CONTAINER_IMAGES_REGISTRY/paymentservice | ||
- name: gcr.io/google-samples/microservices-demo/productcatalogservice | ||
newName: CONTAINER_IMAGES_REGISTRY/productcatalogservice | ||
- name: gcr.io/google-samples/microservices-demo/recommendationservice | ||
newName: CONTAINER_IMAGES_REGISTRY/recommendationservice | ||
- name: gcr.io/google-samples/microservices-demo/shippingservice | ||
newName: CONTAINER_IMAGES_REGISTRY/shippingservice |
47 changes: 47 additions & 0 deletions
47
kustomize/components/container-images-tag-suffix/README.md
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,47 @@ | ||
# Add a suffix to the image tag of the Online Boutique container images | ||
|
||
You may want to add a suffix to the Online Boutique container image tag to target a specific version. | ||
The Kustomize Component inside this folder can help. | ||
|
||
## Add a suffix to the container image tag via Kustomize | ||
|
||
To automate the deployment of the Online Boutique apps with a suffix added to the container imag tag, you can leverage the following variation with [Kustomize](../..). | ||
|
||
From the `kustomize/` folder at the root level of this repository, execute this command: | ||
```bash | ||
SUFFIX=-my-suffix | ||
sed -i "s/CONTAINER_IMAGES_TAG_SUFFIX/$SUFFIX/g" components/container-images-tag-suffix/kustomization.yaml | ||
kustomize edit add component components/container-images-tag-suffix | ||
``` | ||
_Note: this Kustomize component will add a suffix to the container image tag of the `image:` field in all `Deployments`._ | ||
|
||
This will update the `kustomize/kustomization.yaml` file which could be similar to: | ||
```yaml | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- base | ||
components: | ||
- components/container-images-tag-suffix | ||
``` | ||
You can locally render these manifests by running `kubectl kustomize . | sed "s/$SUFFIX$SUFFIX/$SUFFIX/g"` as well as deploying them by running `kubectl kustomize . | sed "s/$SUFFIX$SUFFIX/$SUFFIX/g" | kubectl apply -f`. | ||
|
||
_Note: for this variation, `kubectl apply -k .` alone won't work because there is a [known issue currently in Kustomize](https://github.com/kubernetes-sigs/kustomize/issues/4814) where the `tagSuffix` is duplicated. The `sed "s/$SUFFIX$SUFFIX/$SUFFIX/g"` commands above are a temporary workaround._ | ||
|
||
## Combine with other Kustomize Components | ||
If you're combining this Kustomize Component with other variations, here are some considerations: | ||
- `components/container-images-tag-suffix` should be placed before `components/container-images-registry` | ||
- `components/container-images-tag-suffix` should be placed after `components/container-images-tag` | ||
|
||
So for example here is the order respected: | ||
```yaml | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- base | ||
components: | ||
- components/container-images-tag | ||
- components/container-images-tag-suffix | ||
- components/container-images-registry | ||
``` |
39 changes: 39 additions & 0 deletions
39
kustomize/components/container-images-tag-suffix/kustomization.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,39 @@ | ||
# 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. | ||
|
||
apiVersion: kustomize.config.k8s.io/v1alpha1 | ||
kind: Component | ||
images: | ||
- name: gcr.io/google-samples/microservices-demo/adservice | ||
tagSuffix: CONTAINER_IMAGES_TAG_SUFFIX | ||
- name: gcr.io/google-samples/microservices-demo/cartservice | ||
tagSuffix: CONTAINER_IMAGES_TAG_SUFFIX | ||
- name: gcr.io/google-samples/microservices-demo/checkoutservice | ||
tagSuffix: CONTAINER_IMAGES_TAG_SUFFIX | ||
- name: gcr.io/google-samples/microservices-demo/currencyservice | ||
tagSuffix: CONTAINER_IMAGES_TAG_SUFFIX | ||
- name: gcr.io/google-samples/microservices-demo/emailservice | ||
tagSuffix: CONTAINER_IMAGES_TAG_SUFFIX | ||
- name: gcr.io/google-samples/microservices-demo/frontend | ||
tagSuffix: CONTAINER_IMAGES_TAG_SUFFIX | ||
- name: gcr.io/google-samples/microservices-demo/loadgenerator | ||
tagSuffix: CONTAINER_IMAGES_TAG_SUFFIX | ||
- name: gcr.io/google-samples/microservices-demo/paymentservice | ||
tagSuffix: CONTAINER_IMAGES_TAG_SUFFIX | ||
- name: gcr.io/google-samples/microservices-demo/productcatalogservice | ||
tagSuffix: CONTAINER_IMAGES_TAG_SUFFIX | ||
- name: gcr.io/google-samples/microservices-demo/recommendationservice | ||
tagSuffix: CONTAINER_IMAGES_TAG_SUFFIX | ||
- name: gcr.io/google-samples/microservices-demo/shippingservice | ||
tagSuffix: CONTAINER_IMAGES_TAG_SUFFIX |
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,41 @@ | ||
# Update the container image tag of the Online Boutique apps | ||
|
||
By default, the Online Boutique apps are targeting the latest release version (see the list of versions [here](https://github.com/GoogleCloudPlatform/microservices-demo/releases)). You may need to change this image tag to target a specific version, this Kustomize variation will help you setting this up. | ||
|
||
## Change the default container image tag via Kustomize | ||
|
||
To automate the deployment of the Online Boutique apps with a specific container imag tag, you can leverage the following variation with [Kustomize](../..). | ||
|
||
From the `kustomize/` folder at the root level of this repository, execute this command: | ||
```bash | ||
TAG=v1.0.0 | ||
sed -i "s/CONTAINER_IMAGES_TAG/$TAG/g" components/container-images-tag/kustomization.yaml | ||
kustomize edit add component components/container-images-tag | ||
``` | ||
_Note: this Kustomize component will update the container image tag of the `image:` field in all `Deployments`._ | ||
|
||
This will update the `kustomize/kustomization.yaml` file which could be similar to: | ||
```yaml | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- base | ||
components: | ||
- components/container-images-tag | ||
``` | ||
You can locally render these manifests by running `kubectl kustomize .` as well as deploying them by running `kubectl apply -k .`. | ||
|
||
**Important notes:** if combining with the other variations, here are some considerations: | ||
- should be placed before `components/container-images-registry` | ||
|
||
So for example here is the order respected: | ||
```yaml | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- base | ||
components: | ||
- components/container-images-tag | ||
- components/container-images-registry | ||
``` |
39 changes: 39 additions & 0 deletions
39
kustomize/components/container-images-tag/kustomization.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,39 @@ | ||
# 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. | ||
|
||
apiVersion: kustomize.config.k8s.io/v1alpha1 | ||
kind: Component | ||
images: | ||
- name: gcr.io/google-samples/microservices-demo/adservice | ||
newTag: CONTAINER_IMAGES_TAG | ||
- name: gcr.io/google-samples/microservices-demo/cartservice | ||
newTag: CONTAINER_IMAGES_TAG | ||
- name: gcr.io/google-samples/microservices-demo/checkoutservice | ||
newTag: CONTAINER_IMAGES_TAG | ||
- name: gcr.io/google-samples/microservices-demo/currencyservice | ||
newTag: CONTAINER_IMAGES_TAG | ||
- name: gcr.io/google-samples/microservices-demo/emailservice | ||
newTag: CONTAINER_IMAGES_TAG | ||
- name: gcr.io/google-samples/microservices-demo/frontend | ||
newTag: CONTAINER_IMAGES_TAG | ||
- name: gcr.io/google-samples/microservices-demo/loadgenerator | ||
newTag: CONTAINER_IMAGES_TAG | ||
- name: gcr.io/google-samples/microservices-demo/paymentservice | ||
newTag: CONTAINER_IMAGES_TAG | ||
- name: gcr.io/google-samples/microservices-demo/productcatalogservice | ||
newTag: CONTAINER_IMAGES_TAG | ||
- name: gcr.io/google-samples/microservices-demo/recommendationservice | ||
newTag: CONTAINER_IMAGES_TAG | ||
- name: gcr.io/google-samples/microservices-demo/shippingservice | ||
newTag: CONTAINER_IMAGES_TAG |
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
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
Oops, something went wrong.