Sonatype Nexus Repository OSS Integration
This documentation guide provides comprehensive instructions for integrating Sonatype Nexus Repository OSS (Nexus) with KubeRocketCI.
Prerequisitesβ
Before proceeding, ensure the following prerequisites are met:
- Kubectl version 1.26.0+ is installed. Please refer to the Kubernetes official website for details.
- Helm version 3.14.0+ is installed. Please refer to the Helm page on GitHub for details.
Installationβ
To install Nexus in environment, it's recommended to use the resources provided in the Cluster Add-Ons repository. This approach involves installing both the Nexus repository manager and the nexus-operator. Leveraging the Cluster Add-Ons simplifies the deployment and management process, providing a streamlined method to integrate Nexus into infrastructure.
-
Nexus Repository Manager: First, navigate to the forked cluster Add-Ons repository and align the nexus values.yaml and nexus-operator values.yaml files. Follow the instructions to deploy Nexus, ensuring it's correctly configured to serve as artifact repository.
-
Update the configuration to enable nexus and nexus-operator in Add-Ons repository:
clusters/core/apps/values.yamlnexus:
createNamespace: true
enable: true
nexus-operator:
createNamespace: true
enable: true -
Sync resources and wait till the all nexus and nexus-operator resources is created:
-
Sign In into Nexus Repository Manager using the default credentials Username:
admin
and Password:admin123
and update the default password for better security:
Configurationβ
With Add-ons approach nexus-operator
create the necessary roles,Service Account ci.user
, blob stores, repository, scripts, cleanup policies automatically. Below is a comprehensive guide on how to create all resources manually.
Configuration Nexus Repository Manager with nexus-operatorβ
- Create a Kubernetes Secret that the nexus-operator will use to connect to the Nexus Repository Manager and create all resources:
- Manifests
- External Secrets Operator
apiVersion: v1
kind: Secret
metadata:
name: nexus-admin-password
namespace: nexus
type: Opaque
data:
user: YWRtaW4= # base64-encoded value of "admin"
password: cGFzcw== # base64-encoded value of "pass"
"nexus-admin-password":
{
"user": "XXXXXXX",
"password": "XXXXXXX"
}
- Create a secret using
manifests
or withExternal Secrets Operator
to enable the edp-nexus-operator to connect to the Nexus Repository Manager for provisioning:
- Manifests
- External Secrets Operator
apiVersion: v1
kind: Secret
metadata:
name: ci-nexus
namespace: nexus
type: Opaque
stringData:
password: <nexus-user-password>
"ci-nexus":
{
"password": "XXXXXXX"
}
Configuration Nexus Repository Manager without nexus-operatorβ
Without using the nexus-operator, manual updates are required for the Helm chart values of the Nexus Repository Manager, as well as the creation of blob stores, repositories, roles, and the Service Account ci.user
:
-
Create blob store. Open the Nexus UI and navigate to Server administration and configuration -> Repository -> Blob Stores and click Create Blob Store, fill the following fields and click Save button:
- Java
- JavaScript
- DotNet
- Python
- RPM
- Type:
File
- Name:
edp-maven
- Type:
File
- Name:
edp-npm
- Type:
File
- Name:
edp-dotnet
- Type:
File
- Name:
edp-python
- Type:
File
- Name:
edp-yum
-
KubeRocketCI operates using a specific repository naming convention, where all repository names adhere to predefined standards. To align with this, navigate to Server administration and configuration -> Repository -> Repositories within Nexus. Here, repository creation is limited to those that match the required programming language, ensuring consistency and compliance with the KubeRocketCI framework.
- Java
- JavaScript
- DotNet
- Python
- RPM
a) Click Create a repository by selecting
maven2(proxy)
fill the following fields and click Create repository:- Name
edp-maven-proxy
- Remote storage URL
https://repo1.maven.org/maven2/
- Blob store
edp-maven
- HTTP request settings
check
- Use-agent customization
user-agent-suffix
- Connection retries
10
- Connection timeout
1440
b) Click Create a repository by selecting
maven2(hosted)
fill the following fields and click Create repository:- Name
edp-maven-snapshots
- Version policy
snapshots
- Blob store
edp-maven
c) Click Create a repository by selecting
maven2(hosted)
fill the following fields and click Create repository:- Name
edp-maven-releases
- Version policy
release
- Blob store
edp-maven
d) Click Create a repository by selecting
maven2(group)
fill the following fields and click Create repository:- Name
edp-maven-group
- Version policy
release
- Member repositories
edp-maven-proxy
,edp-maven-snapshots
,edp-maven-releases
a) Click Create a repository by selecting
npm(proxy)
fill the following fields Create repository:- Name
edp-npm-proxy
- Remote storage URL
https://registry.npmjs.org
- Blob store
edp-npm
- HTTP request settings
check
- Use-agent customization
user-agent-suffix
- Connection retries
10
- Connection timeout
1440
b) Click Create a repository by selecting
npm(hosted)
fill the following fields and click Create repository:- Name
edp-npm-snapshots
- Blob store
edp-npm
c) Click Create a repository by selecting
npm(hosted)
fill the following fields and click Create repository:- Name
edp-npm-releases
- Blob store
edp-npm
d) Click Create a repository by selecting
npm(hosted)
fill the following fields and click Create repository:- Name
edp-npm-hosted
- Blob store
edp-npm
e) Click Create a repository by selecting
npm(group)
fill the following fields and click Create repository:- Name
edp-npm-group
- Member repositories
edp-npm-proxy
,edp-npm-snapshots
,edp-npm-releases
,edp-npm-hosted
a) Click Create a repository by selecting
nuget(proxy)
fill the following fields and click Create repository:- Name
edp-dotnet-proxy
- Protocol version NuGet V3
check
- Remote storage URL
https://api.nuget.org/v3/index.json
- Blob store
edp-dotnet
- HTTP request settings
check
- Use-agent customization
user-agent-suffix
- Connection retries
10
- Connection timeout
1440
b) Click Create a repository by selecting
nuget(hosted)
fill the following fields and click Create repository:- Name
edp-dotnet-snapshots
- Blob store
edp-dotnet
c) Click Create a repository by selecting
nuget(hosted)
fill the following fields and click Create repository:- Name
edp-dotnet-releases
- Blob store
edp-dotnet
d) Click Create a repository by selecting
nuget(hosted)
fill the following fields and click Create repository:- Name
edp-dotnet-hosted
- Blob store
edp-dotnet
e) Click Create a repository by selecting
nuget(group)
fill the following fields and click Create repository:- Name
edp-dotnet-group
- Member repositories
edp-dotnet-proxy
,edp-dotnet-snapshots
,edp-dotnet-releases
,edp-dotnet-hosted
a) Click Create a repository by selecting
pypi(proxy)
fill the following fields and click Create repository:- Name
edp-python-proxy
- Remote storage URL
https://pypi.org
- Blob store
edp-python
- HTTP request settings
check
- Use-agent customization
user-agent-suffix
- Connection retries
10
- Connection timeout
1440
b) Click Create a repository by selecting
pypi(hosted)
fill the following fields and click Create repository:- Name
edp-python-snapshots
- Blob store
edp-python
c) Click Create a repository by selecting
pypi(hosted)
fill the following fields and click Create repository:- Name
edp-python-releases
- Blob store
edp-python
d) Click Create a repository by selecting
pypi(group)
fill the following fields and click Create repository:- Name
edp-python-group
- Member repositories
edp-python-proxy
,edp-python-snapshots
,edp-python-releases
a) Click Create a repository by selecting
yum(proxy)
fill the following fields and click Create repository:- Name
edp-yum-proxy
- Remote storage URL
http://fedora.ip-connect.info/linux/development/rawhide/Everything/x86_64/os/
- Blob store
edp-yum
- HTTP request settings
check
- Use-agent customization
user-agent-suffix
- Connection retries
10
- Connection timeout
1440
b) Click Create a repository by selecting
yum(hosted)
fill the following fields and click Create repository:- Name
edp-yum-snapshots
- Repo data Depth
3
- Blob store
edp-yum
c) Click Create a repository by selecting
yum(hosted)
fill the following fields and click Create repository:- Name
edp-yum-releases
- Repo data Depth
3
- Blob store
edp-yum
-
Open the Nexus UI and navigate to Server administration and configuration -> Security -> Roles. Click the Create Role button, fill the following fields and click Save button:
- Type:
Nexus role
- Role ID:
krci-admin
- Role Name:
krci-admin
- Role Descriptions:
Read and write access to all repos and scripts
- Applied Privileges:
nx-apikey-all
,nx-repository-view-*-*-add
,nx-repository-view-*-*-browse
,nx-repository-view-*-*-edit
,nx-repository-view-*-*-read
,nx-script-*-add
,nx-script-*-delete
,nx-script-*-read
,nx-script-*-run
- Type:
-
Create repository Service Account
ci.user
. Open the Nexus UI and navigate to Server administration and configuration -> Security -> User. Click theCreate local user
button to create a new user: -
Type the
ci.user
username, fill the following fields and click the Create local user button to create the *Service Account, fill the following fields and click Save button::- ID:
ci.user
- First name:
ci.user
- Last name:
CI
- Email:
ci.user@krci.com
- Password:
<nexus-user-password>
- Status:
Active
- Roles:
krci-admin
- ID:
Integration Nexus Repository Manager with KubeRocketCIβ
For provision secret using manifest, KubeRocketCI portal or with the externalSecrets operator:
- KubeRocketCI portal
- Manifests
- External Secrets Operator
Go to Portal -> Configuration -> ARTIFACTS STORAGE -> NEXUS. Update or click + ADD INTEGRATION fill the following fields and click the SAVE
button:
- Quick link URL
https://nexus.example.com
- URL
http://nexus.nexus:8081
- User
nexus-user-id
- Password
nexus-user-password
apiVersion: v1
kind: Secret
metadata:
name: ci-nexus
namespace: edp
labels:
app.edp.epam.com/secret-type: nexus
app.edp.epam.com/integration-secret: "true"
type: Opaque
stringData:
url: https://nexus.example.com
username: <nexus-user-id>
password: <nexus-user-password>
"ci-nexus":
{
"url": "https://nexus.example.com",
"username": "XXXXXXX",
"password": "XXXXXXX"
},
Go to Portal -> Configuration -> ARTIFACTS STORAGE -> NEXUS and see Managed by External Secret
message:
More detail of External Secrets Operator Integration can found on the following page