Git Product home page Git Product logo

epam / edp-nexus-operator Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 4.0 1.16 MB

It installs the Nexus EDP Component on a cluster to store/manage artifacts of codebases. It also exposes configuration that allows Nexus to perform with other EDP components

Home Page: https://docs.kuberocketci.io

License: Apache License 2.0

Dockerfile 0.43% Go 96.39% Smarty 0.53% Makefile 2.65%
ci cd cicd nexus nexus-operator nexus3 operator k8s kubernetes edp

edp-nexus-operator's Introduction

codecov

Nexus Operator

โ— Please refer to EDP documentation to get the notion of the main concepts and guidelines.

Get acquainted with the Nexus Operator and the installation process as well as the local development, and architecture scheme.

Overview

Nexus Operator is an EDP operator that is responsible for configuring Nexus.

NOTE: Operator is platform-independent, that is why there is a unified instruction for deploying.

Prerequisites

  1. Linux machine or Windows Subsystem for Linux instance with Helm 3 installed;
  2. Cluster admin access to the cluster;

Installation

In order to install the Nexus operator, follow the steps below:

  1. To add the Helm EPAMEDP Charts for local client, run "helm repo add":

    helm repo add epamedp https://epam.github.io/edp-helm-charts/stable
  2. Choose available Helm chart version:

    helm search repo epamedp/nexus-operator -l
    NAME                        CHART VERSION   APP VERSION     DESCRIPTION
    epamedp/nexus-operator      3.2.0           3.2.0           A Helm chart for EDP Nexus Operator
    epamedp/nexus-operator      3.1.0           3.1.0           A Helm chart for EDP Nexus Operator

    NOTE: It is highly recommended to use the latest released version.

  3. Full chart parameters available in deploy-templates/README.md.

  4. Install operator in the nexus-operator namespace with the helm command; find below the installation command example:

    helm install nexus-operator epamedp/nexus-operator --version <chart_version> --namespace nexus
  5. Check the nexus-operator namespace that should contain operator deployment with your operator in a running status.

Quick Start

  1. Login into Nexus and create user. Attach permissions to user such as scripts, rules, blobs etc. Insert user credentials into Kubernetes secret.

    apiVersion: v1
    kind: Secret
    metadata:
      name: nexus-admin-password
    data:
      password: cGFzcw==  # base64-encoded value of "pass"
      user:     dXNlcg==  # base64-encoded value of "user"
  2. Create Custom Resource kind: Nexus with Nexus instance URL and secret created on the previous step:

    apiVersion: edp.epam.com/v1alpha1
    kind: Nexus
    metadata:
      name: nexus
    spec:
      secret: nexus-admin-password
      url: http://nexus.example.com

    Wait for the .status field with status.connected: true

  3. Create Role using Custom Resources NexusRole:

apiVersion: edp.epam.com/v1alpha1 kind: NexusRole metadata: name: edp-admin spec: description: Read and write access to all repos and scripts id: edp-admin name: edp-admin nexusRef: kind: Nexus name: nexus 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-*-run - nx-search-read ```

Inspect [CR templates folder](./deploy-templates/_crd_examples/) for more examples

Local Development

In order to develop the operator, first set up a local environment. For details, please refer to the Local Development page.

Development versions are also available, please refer to the snapshot Helm Chart repository page.

Related Articles

edp-nexus-operator's People

Contributors

aleksandr-morozov avatar artem-zahumonnyi avatar dependabot[bot] avatar elluvium avatar iryna-churkina avatar mykhailo-b avatar mykysha avatar nikolaymarusenko avatar oleksandr123234 avatar orfey95 avatar sergk avatar sugar-pack avatar totalalfie avatar victormysyk avatar viktor-voronin avatar yevheniipokhvalii avatar zmotso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

edp-nexus-operator's Issues

Automate rekor uuid in release tag

Acceptance Criteria:

  • as a result of release pipeline we need to automate 'Deployment Certifications and Source Traceability' section creation in release tag;

Bump to Go 1.22

Is your feature request related to a problem? Please describe.
Go version 1.20 needs to be updated. Most libraries already require a newer version.

Describe the solution you'd like
Bump Go from 1.20 to the 1.22 version.

Describe alternatives you've considered
Stay on the outdated 1.20 version.

Update groovy api nexus script

Change Api script to receive get-nuget-token in Sonatype Nexus in version 3.59.0

Acceptance Criteria:

  • the get-nuget-token task can get the nuget-token and push the artifact to the nexus.

Add label for nexus-ci.user secret provisioning

Headlamp UI use label to find and display secrets for integration with Nexus.

Acceptance Criteria:

  • nexus-operator create nexus-ci.user secret with label "app.edp.epam.com/secret-type: nexus";

Add NexusRepository custom resource

NexusRepository CR should contain the format for the repository(go/npm, maven...), type (proxy, hosted, group), and all configurations for the specific format/type.

Release 3.1.0

Acceptance Criteria:

  • nexus-operator 3.1.0 released;
  • nexus-operator available on OperatorHub;

Failed to create nexus repository with default values

For these nexus repositories default values are missing:

  • maven2(hosted
    • Version policy
    • Layout policy
    • Content disposition
  • maven2(group
    • Version policy
    • Layout policy
    • Content disposition
  • nuget(proxy)
    • metadata query cache age

Add NexusUser custom resource

The user should contain the following fields:

  • ID
  • First name
  • Last name
  • Email
  • Password
  • Status (active, disabled)
  • Roles

Release 3.0.0

Acceptance Criteria:

  • nexus-operator 3.0.0 released;
  • nexus-operator available on OperatorHub;

Fix github.com/go-resty/resty/v2 HTTP request body disclosure

Package github.com/go-resty/resty/v2
Affected versions >= 2.10.0

A race condition in go-resty can result in HTTP request body disclosure across requests.

This condition can be triggered by calling sync.Pool.Put with the same *bytes.Buffer more than once, when request retries are enabled and a retry occurs. The call to sync.Pool.Get will then return a bytes.Buffer that hasn't had bytes.Buffer.Reset called on it. This dirty buffer will contain the HTTP request body from an unrelated request, and go-resty will append the current HTTP request body to it, sending two bodies in one request.

The sync.Pool in question is defined at package level scope, so a completely unrelated server could receive the request body.

https://github.com/epam/edp-nexus-operator/security/dependabot/4

Related issue go-resty/resty#743

Incorrect NEXUS_CONTEXT environment variable makes Nexus docker repositories inaccessible (error 404)

What happened:

Docker repositories created in Nexus are inaccessible with HTTP error 404.

What you expected to happen:

When docker repositories are created in Nexus they should be available for curl "${nexus_url}/v2/_catalog" and docker push/pull commands.

How to reproduce it (as minimally and precisely as possible):

Create a docker repository in Nexus, that was deployed as a part of EDP.
Try to get the new repository's catalog with curl "${nexus_url}/v2/_catalog"
The response would be HTTP error 404.

Anything else we need to know?:

The issue is in the NEXUS_CONTEXT environment variable, which is filled with "//" (double forward slash) rather than the correct "/" (a single forward slash).

The defect happens due to the first forward slash introduced in the Nexus' default properties ConfigMap:
https://github.com/epam/edp-nexus-operator/blob/master/deploy-templates/templates/cm/configuration/nexus_default.properties.yaml#L9

And the second forward slash is specified in both the Deployment for Kubernetes and DeploymentConfig for OpenShift:
https://github.com/epam/edp-nexus-operator/blob/master/deploy-templates/templates/deployment/nexus_deployment_kubernetes.yaml#L37
https://github.com/epam/edp-nexus-operator/blob/master/deploy-templates/templates/deployment/nexus_deployment_config_openshift.yaml#L39

Environment:

  • Platform (e.g: cat /etc/os-release): Kubernetes and OpenShift
  • EDP version: All
  • Nexus Operator version: 2.5.0-RC.1 - 2.13.0
  • Others: -

Release 3.2.0

Acceptance Criteria:

  • nexus-operator 3.2.0 released;
  • nexus-operator available on OperatorHub;

Refactor Nexus CR

  • Remove all configurations from Nexus CR.
  • Nexus CR should contain only base parameters to get the connection - URL and credentials.
  • Move CR to the group edp and version v1alpha1.
  • Update operator dependencies.
  • Add integration tests for the Nexus CR.

We can use https://github.com/datadrivers/go-nexus-client to work with Nexus API.

NexusRepository validation

Is your feature request related to a problem? Please describe.

Currently, we can create NexusRepository with multiple formats and types.
Example:

apiVersion: edp.epam.com/v1alpha1
kind: NexusRepository
metadata:
  name: npm-hosted
spec:
  nexusRef:
    name: nexus-sample
  npm:
    hosted:
      name: npm-hosted
    proxy:
      name: npm-proxy
      proxy:
        remoteUrl: https://test.com
  go:
    group:
      name: go-group
      group:
          memberNames:
          - go-proxy

The operator doesn't support multiple types and formats in one CR. So we will get an error during resource reconciliation.

Describe the solution you'd like
Create a validation web-hook to validate NexusRepository.

  • Every repository should contain only one format (go,nmp, maven, etc.) and only one type (proxy, group, hosted).
  • Don't allow to change format and type.

Add NexusBlobStore custom resource

To configure Nexus with EDP, the nexus operator should manage blob stores.
Add NexusBlobStore custom resource for configuring blob stores.

The repository type pypi (hosted) was not created

To reproduce create pypi hosted repository

apiVersion: edp.epam.com/v1alpha1
kind: NexusRepository
metadata: 
  name: python-hosted
  namespace: nexus
status: 
  error: 'failed to get repository data: no pypi repository set'
  value: error
spec: 
  nexusRef: 
    kind: Nexus
    name: nexus
  pypi: 
    hosted: 
      component: 
        proprietaryComponents: true
      name: edp-python-snapshots
      online: true
      storage: 
        blobStoreName: edp-python
        strictContentTypeValidation: true
        writePolicy: ALLOW_ONCE

The repository is not created, and we have the error 'failed to get repository data: no pypi repository set.'
But from the Nexus UI we can create such type of the repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.