Skip to content

(A) Basic PhotonOS Patterns

Brendan O'Connor edited this page Jan 16, 2024 · 32 revisions

Pattern A-01: The OVFtool Container

Step 1: using the master controller, navigate to the drop repo.

cd /usr/local/drop

Step 2: Verify the VMware-ovftool-4.4.3-18663434-lin.x86_64 bundle has been downloaded.

ls

Should return:

root@photon-machine [ /usr/local/drop ]# ls
VMware-ovftool-4.4.3-18663434-lin.x86_64.bundle

Step 3: build the ovftool container

cd /usr/local/e2e-patterns/photon/
sh build-e2e-pattern-ovftool.sh

Use the following syntax to test or run the ovftool

docker run ovftool --rm -it -v $PWD --help

Pattern A-02: The PowerCLI Container

  • Prerequisites: None.
  • Description: build powercli container.
  • Expected runtime: 1-2min

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo.

cd /usr/local/e2e-patterns/photon

Step 2: build the powercli container.

sh build-e2e-pattern-pcli.sh

To run the PowerCLI container interactively, run the following:

docker run --rm -it vmware/powerclicore

To run a PowerShell script, run the following (replace sample.ps1 with appropriate script name):

docker run --rm --entrypoint="/usr/bin/pwsh" -v ${PWD}:/tmp vmware/powerclicore /tmp/sample.ps1

NOTE: all PowerShell scripts need to begin with #!/bin/sh otherwise you will receive exec format error from Docker. For example: sample.ps1

#!/bin/sh
echo "Hello World!"

Pattern A-03: The Terraform Container

  • Prerequisites: None.
  • Description: build Terraform container.
  • Expected runtime: 1-2min

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo.

cd /usr/local/e2e-patterns/photon

Step 2: build the terraform container.

sh build-e2ep-terraform.sh

To run the Terraform container interactively, run the following:

docker run -i -t hashicorp/terraform --help

Create main.tf file in a dedicated directory on the Photon appliance and use the following syntax to initialize:

docker  run  -v $(pwd):$(pwd) -w $(pwd) -i -t hashicorp/terraform init

Pattern A-04: Kubernetes

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/minikube repo.

cd /usr/local/e2e-patterns/minikube

Step 2: build the minikube pattern on the Master Controller (small scale) using the -p parameter.

python3 build-e2ep-k8.py -p

Or build the minikube pattern on its own Photon Controller using the -a parameter.

python3 build-e2ep-k8.py -a

Step 3: validate kubectl

kubectl --help

Pattern A-05: The Ansible Container

  • Prerequisites: None.
  • Description: builds an Ansible container.
  • Expected runtime: 1-2min

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo.

cd /usr/local/e2e-patterns/photon

Step 2: build the ansible container.

sh build-e2ep-ansible.sh

To run the ansible container interactively, run the following:

docker run -i -t alpinelinux/ansible ansible --help

Pattern A-06: Build Photon template from ISO

Warning This Pattern is actively being developed.

  • Prerequisites: Download PhotonOS ISO from here. Upload the ISO to the local ESXI datastore.

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo:

cd /usr/local/e2e-patterns/photon

Step 2: build the template by running the following script

python3 build-e2ep-photon-template.py

The script will pause when it is ready for you to mount the ISO to the virtual machine. Follow the instructions posted to the CLI.

Pattern A-07: Build Photon from template

Warning This Pattern is actively being developed.

Pattern A-08: Build a Node Controller (i.e. a prepped PhotonOS appliance)

Warning This Pattern is actively being developed.

  • Prerequisites: Prerequisites: Pattern A-01 & Pattern A-02
  • Description: deploy a PhotonOS appliance to the ESXi host and run the prep script.
  • Expected runtime: 7-10min

Step 1: using the master controller, navigate to the /usr/local/e2e-patterns/photon repo:

cd /usr/local/e2e-patterns/photon

Step 2: deploy the photon controller using the following inputs:

  1. VM Name (as it will appear in vCenter)
python3 build-e2ep-photon-controller.py e2ep-photontest-02
Clone this wiki locally