While contributions to this repository are generally not expected, AlphaSense Inc. may consider contributions that align with the project's goals and standards. Any potential contributors should contact AlphaSense Inc. for guidance and permission before proceeding.
See LICENSE.md for more details.
The information below is provided for informational purposes only. It is not an approval for any contributions.
- Changie
- Docker
- Go v1.24.2 or later
- GoReleaser
- Task
-
Clone the repository:
git clone https://github.com/AlphaSense-Engineering/privatecloud-cli.git cd privatecloud-cli -
Install dependencies:
go mod tidy
We use Task to manage development commands. The following commands are available:
-
Enabling Git Hooks:
task githooks
-
CI Commands:
-
Full Pipeline:
task ci
-
Linting:
task ci-lint
-
Testing:
task ci-test
-
-
Building the Application:
task build
-
Running the Application:
task run -- <command> <args>
-
Running the Check Command:
task check -- <first_step_file>
N.B. See available flags by running
task check -- -h. -
Running the Install Command:
task install -- <context> [<secrets_file>] <first_step_file> <second_step_file> <third_step_file>
N.B. See available flags by running
task install -- -h. -
Running the Pod Command:
task pod
This command requires
ENVCONFIGenvironment variable to be set with the base64 encoded YAML representation of theEnvConfigKubernetes resource.
-
-
Building the Pod Image:
task pod-image-build
By default, the command builds the image with the
devtag. To build the image with a specific tag, set theVERSIONenvironment variable to the desired tag.
The check command is designed to ensure that the infrastructure in your cloud environment is ready for deployment. It performs several steps to achieve this,
including spinning up a Pod in the Kubernetes cluster and using a Docker image with the same binary but running the pod command, which acts as a hidden
mode.
Here is a high-level overview of the process:
-
The command first ensures that the necessary
crossplanenamespace exists in the cluster. If it does not, it creates it. -
The command creates the required ServiceAccount, Role, ClusterRole, RoleBinding, and ClusterRoleBinding resources in the cluster. These resources define the permissions needed for the Pod to operate correctly.
-
The command then creates a Pod in the cluster. This Pod uses a Docker image that contains the same binary as the
privatecloud-clibut runs thepodcommand, specifically designed for the in-cluster check operation. -
The Pod is started, and the command waits for it to reach the running state.
-
Once the Pod is running, the command streams the logs from the Pod to provide real-time feedback on the in-cluster check operation.
-
After the in-cluster check operation is complete, the command cleans up all of the resources it created.
The check command uses a Pod and a Docker image to utilize the same codebase while isolating the in-cluster check operation within a controlled
environment in the Kubernetes cluster. This method ensures that the in-cluster check operation has the required permissions and environment to execute
its tasks without needing any additional commands or permissions that would be necessary if run locally.
The install command is designed to install the Private Cloud Kubernetes resources from the specified YAML files.
The command performs the following steps:
-
The command runs the infrastructure check to ensure the cluster is ready for installation.
-
The command sequentially applies the YAML files to the cluster. Step 1 file is applied twice to account for the resource mapping not being found on the first apply.
-
The command waits for the phases to be completed.
This project does not possess any specific styleguides. Please, make sure to follow general best practices used in Go community.
You can use the following resources for the reference:
This project adheres to the Conventional Commits specification. Please, make sure that your commit messages follow that specification.
This project uses Changie to manage the changelog. Please, make sure to use it when adding a new changelog entry. Do not add a changelog entry if the changes are not visible to the end users.