Skip to content

Commit

Permalink
fix chart, added admin credentials in config, added jvm params, clean…
Browse files Browse the repository at this point in the history
…up tailor templates
  • Loading branch information
Vazquez,Brais (IT EDP) committed Mar 27, 2024
1 parent 4334407 commit 3a4d3ca
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 338 deletions.
25 changes: 11 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ SHELL = /bin/bash
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules

ODS_NAMESPACE := $(shell $(CURDIR)/scripts/get-config-param.sh ODS_NAMESPACE)
NEXUS_URL := $(shell $(CURDIR)/scripts/get-config-param.sh NEXUS_URL)
SONARQUBE_URL := $(shell $(CURDIR)/scripts/get-config-param.sh SONARQUBE_URL)
# Load environment variables from .env file
include ../ods-configuration/ods-core.env
export $(shell sed 's/=.*//' ../ods-configuration/ods-core.env)

INSECURE := false
INSECURE_FLAG :=
ifeq ($(INSECURE), $(filter $(INSECURE), true yes))
Expand Down Expand Up @@ -147,27 +148,23 @@ configure-sonarqube:

# NEXUS
## Install or update Nexus.
install-nexus: apply-nexus-build start-nexus-build apply-nexus-deploy
install-nexus: apply-nexus-chart start-nexus-build
.PHONY: nexus

## Update OpenShift resources related to the Nexus image.
apply-nexus-build:
cd nexus/ocp-config && tailor apply --namespace $(ODS_NAMESPACE) bc,is
.PHONY: apply-nexus-build
## Apply OpenShift resources related to the Nexus.
apply-nexus-chart:
# cd nexus/chart && envsubst < values.yaml.template > values.yaml && helm upgrade --install --namespace $(ODS_NAMESPACE) nexus . && rm values.yaml
cd nexus/chart && envsubst < values.yaml.template > values.yaml && helm upgrade --install --namespace $(ODS_NAMESPACE) nexus .
.PHONY: apply-nexus-chart

## Start build of BuildConfig "nexus".
start-nexus-build:
ocp-scripts/start-and-follow-build.sh --namespace $(ODS_NAMESPACE) --build-config nexus
.PHONY: start-nexus-build

## Update OpenShift resources related to the Nexus service.
apply-nexus-deploy:
cd nexus/ocp-config && tailor apply --namespace $(ODS_NAMESPACE) --exclude bc,is
.PHONY: apply-nexus-deploy

## Configure Nexus service.
configure-nexus:
cd nexus && ./configure.sh --namespace $(ODS_NAMESPACE) --nexus=$(NEXUS_URL) $(INSECURE_FLAG)
cd nexus && ./configure.sh --namespace $(ODS_NAMESPACE) --nexus=$(NEXUS_URL) --admin-password=$(NEXUS_ADMIN_PASSWORD) $(INSECURE_FLAG)
.PHONY: configure-nexus
### configure-nexus is not part of install-nexus because it is not idempotent yet.

Expand Down
9 changes: 7 additions & 2 deletions configuration-sample/ods-core.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,16 @@ NEXUS_URL=https://nexus-cd.192.168.56.101.nip.io
NEXUS_USERNAME=developer
NEXUS_PASSWORD=changeme
NEXUS_PASSWORD_B64=changeme
# Password of Nexus administrator - should be set to a secure password
# of your choice.
NEXUS_ADMIN_PASSWORD=changeme
NEXUS_ADMIN_PASSWORD_B64=changeme
# Nexus (basic) authentication username:password
NEXUS_AUTH=developer:changeme

# All params defined in the template https://github.com/opendevstack/ods-core/blob/master/nexus/ocp-config/bc.yml
# can be overwritten by specifying the param in this file.
# Nexus JVM parameters, adjust acording to organization size
# See https://help.sonatype.com/en/sonatype-nexus-repository-system-requirements.html
NEXUS_JVM_PARAMS="-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=/nexus-data/javaprefs"

#############
# SonarQube #
Expand Down
2 changes: 1 addition & 1 deletion nexus/chart/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
OpenDevStack Nexus OSS edition on version {{ .Values.nexus.nexusTag }} released with Helm!
OpenDevStack Nexus OSS edition on version {{ .Values.global.nexusImageTag }} released with Helm!
2 changes: 1 addition & 1 deletion nexus/chart/templates/buildconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
dockerStrategy:
from:
kind: DockerImage
name: sonatype/nexus3:{{ .Values.nexus.nexusImageTag }}
name: sonatype/nexus3:{{ .Values.global.nexusImageTag }}
forcePull: true
noCache: true
successfulBuildsHistoryLimit: 5
4 changes: 2 additions & 2 deletions nexus/chart/templates/deploymentconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ spec:
timeoutSeconds: 2
failureThreshold: 3
env:
- name: SONAR_AUTH_SAML_ENABLED
value: '{{ .Values.sonarqube.sonarAuthSaml }}'
- name: INSTALL4J_ADD_VM_PARAMS
value: '{{ .Values.global.nexusJvmParams }}'
ports:
- containerPort: 8081
protocol: TCP
Expand Down
2 changes: 1 addition & 1 deletion nexus/chart/templates/route-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Route
metadata:
labels:
app: {{ .Values.global.appName }}
name: {{ .Values.global.appName }}
name: {{ .Values.global.appName }}-docker
spec:
host: {{ .Values.global.nexusDockerGroup }}-{{ .Values.global.odsNamespace }}{{ .Values.global.openshiftAppDomain}}
port:
Expand Down
9 changes: 9 additions & 0 deletions nexus/chart/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
data:
admin-password: {{ .Values.global.nexusAdminPasswordB64 }}
metadata:
labels:
app: {{ .Values.global.appName }}
name: {{ .Values.global.appName }}-app
type: Opaque
25 changes: 13 additions & 12 deletions nexus/chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
global:
odsImageTag: $ODS_IMAGE_TAG
repoBase: $REPO_BASE
odsBitBucketProject: $ODS_BITBUCKET_PROJECT
odsGitRef: $ODS_GIT_REF
odsNamespace: $ODS_NAMESPACE
nexusImageTag: $NEXUS_IMAGE_TAG
odsImageTag: latest
repoBase: https://bitbucket-dev.biscrum.com/scm
odsBitBucketProject: odstest
odsGitRef: feature/nexus-maintenance
odsNamespace: odstest
nexusImageTag: 3.66.0
appName: 'nexus'
storageProvisioner: $STORAGE_PROVISIONER
storageClassData: $STORAGE_CLASS_DATA
nexusHost: $NEXUS_HOST
nexusAdminPasswordB64: $SONAR_ADMIN_PASSWORD_B64
registry: $DOCKER_REGISTRY
openshiftAppDomain: $OPENSHIFT_APPS_BASEDOMAIN
storageProvisioner: "netapp.io/trident"
storageClassData: "standard-nas"
nexusHost: nexus-odstest.apps.us-test.ocp.aws.boehringer.com
nexusAdminPasswordB64: YWRtaW4=
registry: image-registry.openshift-image-registry.svc:5000
openshiftAppDomain: .apps.us-test.ocp.aws.boehringer.com
nexusDockerGroup: 'docker-group'
nexusJvmParams: "-Xms2703m -Xmx2703m -XX:MaxDirectMemorySize=2703m -Djava.util.prefs.userRoot=/nexus-data/javaprefs"
nexus:
cpuRequest: 200m
cpuLimit: 1
Expand Down
26 changes: 26 additions & 0 deletions nexus/chart/values.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
global:
odsImageTag: $ODS_IMAGE_TAG
repoBase: $REPO_BASE
odsBitBucketProject: $ODS_BITBUCKET_PROJECT
odsGitRef: $ODS_GIT_REF
odsNamespace: $ODS_NAMESPACE
nexusImageTag: $NEXUS_IMAGE_TAG
appName: 'nexus'
storageProvisioner: $STORAGE_PROVISIONER
storageClassData: $STORAGE_CLASS_DATA
nexusHost: $NEXUS_HOST
nexusAdminPasswordB64: $NEXUS_ADMIN_PASSWORD_B64
registry: $DOCKER_REGISTRY
openshiftAppDomain: $OPENSHIFT_APPS_BASEDOMAIN
nexusDockerGroup: 'docker-group'
nexusJvmParams: $NEXUS_JVM_PARAMS
nexus:
cpuRequest: 200m
cpuLimit: 1
memRequest: 2Gi
memLimit: 4Gi
buildConfig:
cpuRequest: 200m
cpuLimit: 1
memRequest: 1Gi
memLimit: 2Gi
2 changes: 1 addition & 1 deletion nexus/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# FROM instruction is overwritten with NEXUS_FROM_IMAGE.
# FROM instruction is overwritten with BuildConfig and NEXUS_IMAGE_TAG.
FROM sonatype/nexus3:latest
10 changes: 0 additions & 10 deletions nexus/ocp-config/Tailorfile

This file was deleted.

61 changes: 0 additions & 61 deletions nexus/ocp-config/bc.yml

This file was deleted.

87 changes: 0 additions & 87 deletions nexus/ocp-config/dc.yml

This file was deleted.

12 changes: 0 additions & 12 deletions nexus/ocp-config/is.yml

This file was deleted.

0 comments on commit 3a4d3ca

Please sign in to comment.