Skip to content

Commit

Permalink
podvm: fix podvm_mkosi_image build and some links issues
Browse files Browse the repository at this point in the history
- fix podvm mkosi build
- and some links issue

Signed-off-by: Da Li Liu <[email protected]>
  • Loading branch information
liudalibj authored and Qi Feng Huo committed Mar 22, 2024
1 parent 7796bee commit 2df4da2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/podvm_mkosi_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: mkosi build podvm builder, binaries and image
on:
workflow_dispatch:

defaults:
run:
working-directory: src/cloud-api-adaptor/podvm-mkosi

jobs:
build-podvm-image-mkosi:
name: Build podvm image via mkosi
Expand Down Expand Up @@ -41,9 +37,11 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build builder
working-directory: src/cloud-api-adaptor/podvm-mkosi
run: make fedora-binaries-builder

- name: Build binaries
working-directory: src/cloud-api-adaptor/podvm-mkosi
run: make binaries

# TODO - build image via mkosi when s390x is available
Expand Down
2 changes: 1 addition & 1 deletion src/cloud-api-adaptor/aws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ echo ${PODVM_AMI_ID}

## Build CAA container image

> **Note**: If you have made changes to the CAA code and you want to deploy those changes then follow [these instructions](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/install/README.md#building-custom-cloud-api-adaptor-image) to build the container image from the root of this repository.
> **Note**: If you have made changes to the CAA code and you want to deploy those changes then follow [these instructions](../install/README.md#building-custom-cloud-api-adaptor-image) to build the container image from the root of this repository.
If you would like to deploy the latest code from the default branch (`main`) of this repository then expose the following environment variable:

Expand Down
16 changes: 8 additions & 8 deletions src/cloud-api-adaptor/docs/addnewprovider.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

### Step 1: Initialize and register the cloud provider manager

The provider-specific cloud manager should be placed under `pkg/adaptor/cloud/<provider>/`.
The provider-specific cloud manager should be placed under `src/cloud-providers/<provider>`.

:information_source:[Example code](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/pkg/adaptor/cloud/aws)
:information_source:[Example code](../../cloud-providers/aws)

### Step 2: Add provider specific code

Under `pkg/adaptor/cloud/<provider>`, start by adding a new file called `types.go`. This file defines a configuration struct that contains the required parameters for a cloud provider.
Under `src/cloud-providers/<provider>`, start by adding a new file called `types.go`. This file defines a configuration struct that contains the required parameters for a cloud provider.

:information_source:[Example code](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/pkg/adaptor/cloud/aws/types.go)
:information_source:[Example code](../../cloud-providers/aws/types.go)

#### Step 2.1: Implement the Cloud interface

Expand All @@ -28,7 +28,7 @@ func init() {
}
```

:information_source:[Example code](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/pkg/adaptor/cloud/aws/manager.go)
:information_source:[Example code](../../cloud-providers/aws/manager.go)

#### Step 2.2: Implement the Provider interface

Expand All @@ -38,20 +38,20 @@ The Provider interface defines a set of methods that need to be implemented by t
- DeleteInstance
- Teardown

:information_source:[Example code](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/pkg/adaptor/cloud/aws/provider.go#L76-L175)
:information_source:[Example code](../../cloud-providers/aws/provider.go)

Also, consider adding additional files to modularize the code. You can refer to existing providers such as `aws`, `azure`, `ibmcloud`, and `libvirt` for guidance. Adding unit tests wherever necessary is good practice.

#### Step 2.3: Include Provider package from main

To include your provider you need reference it from the main package. Go build tags are used to selectively include different providers.

:information_source:[Example code](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/cmd/cloud-api-adaptor/aws.go)
:information_source:[Example code](../../cloud-api-adaptor/cmd/cloud-api-adaptor/aws.go)

```go
//go:build aws
```
Note the comment at the top of the file, when building ensure `-tags=` is set to include your new provider. See the [Makefile](https://github.com/confidential-containers/cloud-api-adaptor/blob/main/Makefile#L26) for more context and usage.
Note the comment at the top of the file, when building ensure `-tags=` is set to include your new provider. See the [Makefile](../../cloud-api-adaptor/Makefile#L26) for more context and usage.

#### Step 3: Add documentation on how to build a Pod VM image

Expand Down
4 changes: 3 additions & 1 deletion src/cloud-api-adaptor/podvm-mkosi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ binaries:
docker buildx use default
@echo "Building binaries..."
rm -rf ./resources/binaries-tree
cp -rf ../../../.git ../../.git
docker buildx build \
--build-arg BUILDER_IMG=$(BUILDER) \
--build-arg AA_KBC=$(AA_KBC) \
$(if $(DEFAULT_AGENT_POLICY_FILE),--build-arg DEFAULT_AGENT_POLICY_FILE=$(DEFAULT_AGENT_POLICY_FILE),) \
-o type=local,dest="./resources/binaries-tree" \
-f ../podvm/Dockerfile.podvm_binaries.fedora ../.
-f ../podvm/Dockerfile.podvm_binaries.fedora ../../
rm -rf ../../.git

PHONY: image
image:
Expand Down
2 changes: 1 addition & 1 deletion src/cloud-api-adaptor/test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Use the properties on the table below for AWS:
|vxlan_port|VXLAN port number||

>Notes:
* The AWS credentials are obtained from the CLI [configuration files](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html). **Important**: the access key and secret are recorded in plain-text in [install/overlays/aws/kustomization.yaml](https://github.com/confidential-containers/cloud-api-adaptor/tree/main/install/overlays/aws/kustomization.yaml)
* The AWS credentials are obtained from the CLI [configuration files](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html). **Important**: the access key and secret are recorded in plain-text in [install/overlays/aws/kustomization.yaml](../../install/overlays/aws/kustomization.yaml)
* The subnet is created with CIDR IPv4 block 10.0.0.0/25. In case of deploying an EKS cluster,
a secondary (private) subnet is created with CIDR IPv4 block 10.0.0.128/25
* The cluster type **onprem** assumes Kubernetes is already provisioned and its kubeconfig file path can be found at the `KUBECONFIG` environment variable or in the `~/.kube/config` file. Whereas **eks** type instructs to create an [AWS EKS](https://aws.amazon.com/eks/) cluster on the VPC
Expand Down

0 comments on commit 2df4da2

Please sign in to comment.