Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to guide for private bicpe registry support feature. #1230

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
type: docs
title: "How-To: Pull Bicep Recipes from private OCI container registry."
linkTitle: "Private bicep registries"
description: "Learn how to setup your Radius environment to use Bicep Recipe templates published to a private OCI container registry."
weight: 500
categories: "How-To"
tags: ["recipes", "bicep"]
---

This how-to guide will describe how to:
vishwahiremat marked this conversation as resolved.
Show resolved Hide resolved

- Configure a Radius environment to utilize Bicep Recipe templates that are stored in a private OCI (Open Container Initiative) complaint container registry. This setup will ensure the templates are securely stored and managed within private OCI registry.
vishwahiremat marked this conversation as resolved.
Show resolved Hide resolved

### Prerequisites

Before you get started, you'll need to make sure you have the following tools and resources:

- [rad CLI]({{< ref "installation#step-1-install-the-rad-cli" >}})
- [Bicep VSCode extension]({{< ref "installation#step-2-install-the-vs-code-extension" >}})
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
- [Radius initialized with `rad init`]({{< ref howto-environment >}})
Comment on lines +19 to +22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you confirm that all these relative paths to the other docs pages will work since this page itself isn't in the root directory? there are more similar cases below that I haven't commented, please check those as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i have tested it locally and all the links are accessible.


## Step 1: Setting up private OCI container registry authentication.
vishwahiremat marked this conversation as resolved.
Show resolved Hide resolved
Radius supports three authentication methods for accessing private container registries:
- Basic Authentication: This method uses a username and password for authentication and is applicable to all OCI complaint registries. Obtain the username and password details used to login to private registry.
vishwahiremat marked this conversation as resolved.
Show resolved Hide resolved
- Azure Workload Identity: This federated identity-based authentication is used for connecting to Azure Container Registry (ACR). [Here]({{< ref howto-azure-provider-wi >}}) is the guide to setup Azure Workload Identity for Radius. Obtain `clientId` and `tenant ID` used during the setup.
- AWS IRSA: This federated identity-based authentication is used for accessing Amazon Elastic Container Registry (ECR). [Here]({{< ref howto-aws-provider-irsa >}}) is the guide to setup the AWS IRSA for Radius. Obtain `roleARN` from the role created during the setup.

## Step 2: Define a secret store resource

Create a [Radius Secret Store]({{< ref "/guides/author-apps/secrets/overview" >}}) to manage and securely store the secerts information required for authenticating with a private registry. Define the namespace for the cluster that will contain your [Kubernetes Secret](https://kubernetes.io/docs/concepts/configuration/secret/) with the `resource` property. And specify the type of secret e.g. basicAuthentication,azureWorkloadIdeneity, awsIRSA.
vishwahiremat marked this conversation as resolved.
Show resolved Hide resolved

> While this example shows a Radius-managed secret store where Radius creates the underlying secrets infrastructure, you can also bring your own existing secrets. Refer to the [secrets documentation]({{< ref "/guides/author-apps/secrets/overview" >}}) for more information.

Secretstore example for secret type `awsIRSA`:
vishwahiremat marked this conversation as resolved.
Show resolved Hide resolved
{{< rad file="snippets/env.bicep" embed=true marker="//SECRETSTORE" >}}

## Step 3: Configure authentication for private bicep registries and add a Bicep recipe.
vishwahiremat marked this conversation as resolved.
Show resolved Hide resolved

`recipeConfig` allows you to configure how Recipes should be setup and run. One available option is to specify the registry secrets for pulling Bicep recipes from private registries. For more information refer to the [Radius Environment schema]({{< ref environment-schema >}}) page.
vishwahiremat marked this conversation as resolved.
Show resolved Hide resolved

In your `env.bicep` file add an Environment resource, along with Recipe configuration which leverages the previously defined secret store for private OCI registry authentication.
vishwahiremat marked this conversation as resolved.
Show resolved Hide resolved

{{< rad file="snippets/env.bicep" embed=true marker="//ENV" >}}


## Step 5: Deploy your Radius Environment

Deploy your new Radius Environment:

```
rad deploy ./env.bicep
```

## Done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this "Done" header, I recommend showing the console output they should expect to see after deploying the environment, and then below the expected output the concluding "done" sentence can follow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated it


Your Radius Environment is now ready to utilize your Radius Recipes stored inside your private registry. For more information on Radius Recipes visit the [Recipes overview page]({{< ref "/guides/recipes/overview" >}}).

## Cleanup

You can delete a Radius Environment by running the following command:

```
rad env delete my-env
```

## Further reading

- [Recipes overview]({{< ref "/guides/recipes/overview" >}})
- [Radius Environments]({{< ref "/guides/deploy-apps/environments/overview" >}})
- [`rad recipe CLI reference`]({{< ref rad_recipe >}})
- [`rad env CLI reference`]({{< ref rad_env >}})
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//ENV
resource env 'Applications.Core/environments@2023-10-01-preview' = {
name: 'my-env'
properties: {
compute: {
kind: 'kubernetes'
namespace: 'my-namespace'
}
recipeConfig: {
bicep:{
authentication:{
// The hostname of your container registry, such as 'docker.io' or '<registry-name>.azurecr.io'
'<account-id>.dkr.ecr.<region>.amazonaws.com':{
secret: registrySecrets.id
}
}
}
}
recipes: {
'Applications.Messaging/rabbitMQQueues': {
default: {
templateKind: 'bicep'
templatePath: '<account-id>.dkr.ecr.<region>.amazonaws.com/test-private-ecr:2.0'
}
}
}
}
}
//ENV

//SECRETSTORE
resource registrySecrets 'Applications.Core/secretStores@2023-10-01-preview' = {
name: 'registry-secrets'
properties: {
resource: 'registry-secrets/ecr'
type: 'awsIRSA'
data: {
roleARN: {
value: 'arn:aws:iam::<account-id>:role/test-role'
}
}
}
}
//SECRETSTORE
Loading