Skip to content

Commit c52ab4e

Browse files
authored
Merge pull request #84 from daos-stack/develop
DAOSGCP-176 Merge develop to main
2 parents d98c5ac + 903e78c commit c52ab4e

77 files changed

Lines changed: 2986 additions & 3623 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@ terraform.tfvars
1818
# Ignore all /tmp directories
1919
**/tmp
2020

21-
# Ignore terraform/examples/io500 active configuration symlink
21+
# io500 example generated files
2222
terraform/examples/io500/config/active_config.sh
23-
terraform/examples/io500/login
23+
terraform/examples/io500/bin/login*
24+
terraform/examples/io500/client_files/hosts*
25+
terraform/examples/io500/.tmp
26+
terraform/examples/io500/results
2427

2528
# Ignore other files
2629
id_rsa*
27-
hosts*
2830
*.flag
2931
keys.txt
30-
results/
31-
module.json
32+
**module.json
3233

3334
# addlicense binary for pre-commit
3435
tools/autodoc/addlicense

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2022 Intel Corporation
1+
# Copyright 2023 Intel Corporation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

docs/deploy_daos_cluster_example.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ terraform apply tfplan
103103

104104
### List the instances
105105

106-
Terraform will create 2 [Managed Instance Groups (MIGs)](https://cloud.google.com/compute/docs/instance-groups) that will create the DAOS server and client instances.
107-
108-
It may take some time for the instances to become available.
109-
110106
Verify that the daos-client and daos-server instances are running.
111107

112108
```bash
@@ -115,25 +111,6 @@ gcloud compute instances list \
115111
--format="value(name,INTERNAL_IP)"
116112
```
117113

118-
Verify that the [MIGs](https://cloud.google.com/compute/docs/instance-groups) are stable.
119-
120-
```bash
121-
PROJECT_ID=$(gcloud config list --format 'value(core.project)')
122-
ZONE=$(gcloud config list --format 'value(compute.zone)')
123-
124-
echo "Checking daos-client MIG"
125-
gcloud compute instance-groups managed wait-until 'daos-client' \
126-
--stable \
127-
--project="${PROJECT_ID}" \
128-
--zone="${ZONE}"
129-
130-
echo "Checking daos-server MIG"
131-
gcloud compute instance-groups managed wait-until 'daos-server' \
132-
--stable \
133-
--project="${PROJECT_ID}" \
134-
--zone="${ZONE}"
135-
```
136-
137114
## Perform DAOS administration tasks
138115

139116
After your DAOS cluster has been deployed you can log into the first DAOS server instance to perform administrative tasks.

docs/pre-deployment_guide.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,8 @@ popd
353353
Build the DAOS Server and Client images
354354

355355
```bash
356-
pushd images
357-
./build_images.sh --type all
358-
popd
356+
cd images
357+
./build.sh
359358
```
360359

361360
## Congratulations!
@@ -364,4 +363,4 @@ You have completed the **Pre-Deployment** steps!
364363

365364
You are now ready to deploy DAOS on GCP.
366365

367-
Refer to the [Deployment section of the main README](https://github.com/markaolson/google-cloud-daos/tree/DAOSGCP-119#deployment) for information on how to deploy DAOS on GCP.
366+
Refer to the [Deployment section of the main README](https://github.com/daos-stack/google-cloud-daos#deployment) for information on how to deploy DAOS on GCP.

images/README.md

Lines changed: 187 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,209 @@
11
# Images
22

3-
This directory contains Cloud Build configuration files, Packer templates and scripts used for building DAOS images with [Cloud Build](https://cloud.google.com/build).
3+
This directory contains files necessary for building DAOS images using [Cloud Build](https://cloud.google.com/build) and [Packer](https://developer.hashicorp.com/packer/downloads).
44

55
## Pre-Deployment steps required
66

77
If you have not done so yet, please complete the steps in [Pre-Deployment Guide](../docs/pre-deployment_guide.md).
88

9+
The pre-deployment steps will have you run the `images/build.sh` script once in order to build a DAOS server image and a DAOS client image with the configured default settings.
10+
11+
That should be all you need to run the Terraform examples in the `terraform/examples` directory or to run the [DAOS examples in the Google HPC Toolkit](https://github.com/GoogleCloudPlatform/hpc-toolkit/tree/main/community/examples/intel).
12+
13+
The information in this document is provided in case you need to build custom images with non-default settings.
14+
915
## Building DAOS images
1016

11-
The [Pre-Deployment Guide](../docs/pre-deployment_guide.md) includes instructions for building DAOS images.
17+
To rebuild the images with the default settings run:
18+
19+
```bash
20+
cd images
21+
./build.sh
22+
```
23+
24+
## The Packer HCL template file
25+
26+
A single Packer HCL template file `daos.pkr.hcl` is used to build either a DAOS server or DAOS client image.
27+
28+
The `daos.pkr.hcl` file does not build both server and client images in a single `packer build` run. This is by design since there are use cases in which only one type of image is needed. If both types of images are needed, then `packer build` must be run twice with different variable values.
29+
30+
### Source Block
31+
32+
Within the `daos.pkr.hcl` template there is a single `source` block. Most of the settings for the block are set by variable values.
33+
34+
### Build Block
35+
36+
The `build` block consists of provisioners that do the following:
37+
38+
1. Install Ansible
39+
2. Run the `ansible_playbooks/tune.yml` playbook
40+
3. Run the `ansible_playbooks/daos.yml` playbook
41+
42+
These provisioners are the same for building both DAOS server and DAOS client images.
43+
44+
The `daos_install_type` variable in the `daos.pkr.hcl` template is passed in the `--extra-vars` parameter when running the `daos.yml` ansible playbook.
45+
46+
If `daos_install_type=server`, then the `daos.yml` playbook will install the DAOS server packages.
47+
48+
If `daos_install_type=client`, then the `daos.yml` playbook will install the DAOS client packages.
49+
50+
## `build.sh` environment variables
51+
52+
The `images/build.sh` script uses the following environment variables.
53+
54+
| Environment Variable | Description |
55+
| ---------------------------- | ---------------------------------------------------------- |
56+
| GCP_PROJECT | Google Cloud Project ID |
57+
| GCP_ZONE | Zone where images will be deployed |
58+
| GCP_BUILD_WORKER_POOL | Google Cloud Build Worker Pool |
59+
| GCP_USE_IAP | Use Identity Aware Proxy |
60+
| GCP_ENABLE_OSLOGIN | Enable os-login |
61+
| GCP_USE_CLOUDBUILD | Run packer in a Cloud Build job |
62+
| GCP_CONFIGURE_PROJECT | Configure default service acct for Cloud Build |
63+
| DAOS_VERSION | Version of DAOS to install |
64+
| DAOS_REPO_BASE_URL | Base URL of DAOS Repository |
65+
| DAOS_PACKAGES_REPO_FILE | See "Controlling the version of DAOS to be installed" |
66+
| DAOS_MACHINE_TYPE | The machine type to use for the image |
67+
| DAOS_SOURCE_IMAGE_FAMILY | Source image family that Packer will use as the base image |
68+
| DAOS_SOURCE_IMAGE_PROJECT_ID | Source project id that contains the source image |
69+
| DAOS_SERVER_IMAGE_FAMILY | Name of the image family for the DAOS Server image |
70+
| DAOS_CLIENT_IMAGE_FAMILY | Name of the image family for the DAOS Client image |
71+
| DAOS_BUILD_SERVER_IMAGE | Whether or not build the DAOS Server image |
72+
| DAOS_BUILD_CLIENT_IMAGE | Whether or not build the DAOS Client image |
73+
| DAOS_PACKER_TEMPLATE | Name of the Packer template |
74+
75+
To view the default values for these variables see the defaults set in the `build.sh` script.
76+
77+
Running `build.sh --help` will display the values of these variables so that you can inspect them before running `build.sh`
78+
79+
### Controlling the version of DAOS to be installed
80+
81+
Official DAOS packages are hosted at https://packages.daos.io/
82+
83+
Unfortunately, the paths to the `.repo` files for each repository do not follow a standard convention that can be dynamically created based on something like the `/etc/os-release` file.
84+
85+
To specify the path to a repo file the following 3 environment variables are used:
86+
87+
- `DAOS_REPO_BASE_URL`
88+
- `DAOS_VERSION`
89+
- `DAOS_PACKAGES_REPO_FILE`
90+
91+
These files are used to build the url to the `daos_packages.repo` file.
92+
93+
```
94+
"${DAOS_REPO_BASE_URL}/v${DAOS_VERSION}/${DAOS_PACKAGES_REPO_FILE}
95+
```
96+
97+
The values of these variables should not start or end with a `/`
98+
99+
**Examples:**
12100

13-
You can re-build your images with the following commands.
101+
To install DAOS v2.2.0 on CentOS 7
14102

15-
Build both DAOS server and client images
103+
```bash
104+
DAOS_REPO_BASE_URL=https://packages.daos.io
105+
DAOS_VERSION="2.2.0"
106+
DAOS_PACKAGES_REPO_FILE="CentOS7/packages/x86_64/daos_packages.repo"
107+
```
108+
109+
To install DAOS v2.2.0 on Rocky 8
110+
111+
```bash
112+
DAOS_REPO_BASE_URL=https://packages.daos.io
113+
DAOS_VERSION="2.2.0"
114+
DAOS_PACKAGES_REPO_FILE="EL8/packages/x86_64/daos_packages.repo"
115+
```
116+
117+
## Building only the DAOS Server or the DAOS Client image
118+
119+
If you do not want to build one of the images, you must set the appropriate environment variable.
120+
121+
For example,
122+
123+
To build only the DAOS Server image
16124

17125
```bash
18-
cd images/
19-
./build_images.sh --type all
126+
cd images
127+
export DAOS_BUILD_CLIENT_IMAGE="false" # Do not run the job to build the DAOS client image
128+
./build.sh
20129
```
21130

22-
Build a DAOS server image
131+
To build only the DAOS Client image
23132

24133
```bash
25-
cd images/
26-
./build_images.sh --type server
134+
cd images
135+
export DAOS_BUILD_SERVER_IMAGE="false" # Do not run the job to build the DAOS server image
136+
./build.sh
27137
```
28138

29-
Build a DAOS client image
139+
## Custom image builds
140+
141+
To create images that do not use the default settings, export one or more of the environment variables listed above before running `build.sh`
142+
143+
### Change the name of the image family
30144

31145
```bash
32-
cd images/
33-
./build_images.sh --type client
146+
cd images
147+
export DAOS_SERVER_IMAGE_FAMILY="my-daos-server"
148+
export DAOS_CLIENT_IMAGE_FAMILY="my-daos-client"
149+
./build.sh
34150
```
151+
152+
### Use a different source image
153+
154+
For the source image, use the `rocky-linux-8-optimized-gcp` community image instead of the `hpc-rocky-linux-8` image.
155+
156+
```bash
157+
cd images
158+
export DAOS_SOURCE_IMAGE_FAMILY="rocky-linux-8-optimized-gcp"
159+
export DAOS_SOURCE_IMAGE_PROJECT_ID="rocky-linux-cloud"
160+
./build.sh
161+
```
162+
163+
### Other Scenarios
164+
165+
Say you want to make the following customizations to the images:
166+
167+
1. Change the image family names of the DAOS Server and DAOS Client images
168+
2. Use `hpc-rocky-linux-8` as the source image for the DAOS client image (the default).
169+
3. Use `rocky-linux-8-optimized-gcp` as the source image for the DAOS server image.
170+
171+
In this scenario it will be necessary to run the `build.sh` script two times with
172+
different environment variables.
173+
174+
**Build Client Image**
175+
176+
```bash
177+
cd images
178+
export DAOS_BUILD_CLIENT_IMAGE="true" # Build client image
179+
export DAOS_CLIENT_IMAGE_FAMILY="daos-client" # Change image family name for client image
180+
181+
export DAOS_BUILD_SERVER_IMAGE="false" # Do not build server image
182+
./build.sh
183+
```
184+
185+
**Build Server Image**
186+
187+
```bash
188+
cd images
189+
export DAOS_BUILD_CLIENT_IMAGE="false" # Do not build client image
190+
export DAOS_BUILD_SERVER_IMAGE="true" # Build server image
191+
export DAOS_SERVER_IMAGE_FAMILY="daos-server" # Change image family name for server image
192+
export DAOS_SOURCE_IMAGE_FAMILY="rocky-linux-8-optimized-gcp" # Change source image family
193+
export DAOS_SOURCE_IMAGE_PROJECT_ID="rocky-linux-cloud" # Change source image project
194+
./build.sh
195+
```
196+
197+
## Running packer locally (Do not use Cloud Build)
198+
199+
Set `GCP_USE_CLOUDBUILD="false"` to run `packer` locally instead of running it in a Cloud Build job.
200+
201+
```bash
202+
cd images
203+
export GCP_USE_CLOUDBUILD="false" # Do not run packer in Cloud Build
204+
./build.sh
205+
```
206+
207+
When running `build.sh` this way, all project configuration steps are skipped.
208+
209+
When `GCP_USE_CLOUDBUILD="true"` the `build.sh` will check your GCP project to ensure the default service account has the proper permissions needed for the Cloud Build job to run packer and create the images in your project. Setting `GCP_USE_CLOUDBUILD="true"` will skip the project configuration steps. In this case, it's up to you to make sure the proper permissions are configured for you to run packer locally to build the images.

images/ansible_playbooks/daos.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
# Copyright 2023 Intel Corporation
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# daos.yml
17+
18+
- name: Install DAOS
19+
hosts: 127.0.0.1
20+
connection: local
21+
become: true
22+
23+
vars:
24+
daos_install_type: "all"
25+
daos_version: "2.2.0"
26+
daos_repo_base_url: "https://packages.daos.io"
27+
daos_packages_repo_file: "EL8/packages/x86_64/daos_packages.repo"
28+
daos_packages:
29+
all: ["daos-admin", "daos-client", "daos-server", "daos-devel"]
30+
client: ["daos-admin", "daos-client", "daos-devel"]
31+
server: ["daos-admin", "daos-server", "daos-devel"]
32+
33+
packages:
34+
- clustershell
35+
- curl
36+
- git
37+
- jq
38+
- patch
39+
- pdsh
40+
- rsync
41+
- wget
42+
43+
tasks:
44+
- name: Check daos_install_type variable contains value
45+
ansible.builtin.assert:
46+
that:
47+
- daos_install_type in ["server", "client"]
48+
fail_msg: "'daos_install_type' must be either 'client' or 'server'"
49+
50+
- name: Install Packages
51+
ansible.builtin.package:
52+
name: "{{ packages }}"
53+
state: present
54+
55+
- name: Add DAOS repo
56+
ansible.builtin.get_url:
57+
url: "{{ daos_repo_base_url }}/v{{ daos_version }}/{{ daos_packages_repo_file }}"
58+
dest: /etc/yum.repos.d/daos_packages.repo
59+
owner: root
60+
group: root
61+
mode: "0644"
62+
63+
- name: List of DAOS packages to be installed
64+
debug:
65+
var: item
66+
with_items: "{{ daos_packages[daos_install_type] }}"
67+
68+
- name: Install DAOS packages
69+
ansible.builtin.package:
70+
name: "{{ daos_packages[daos_install_type] }}"
71+
state: present

0 commit comments

Comments
 (0)