Skip to content

Commit

Permalink
Merge pull request #1663 from NCEAS/feature-1623-working-tests
Browse files Browse the repository at this point in the history
Feature 1623 working tests
Merging, since all either  docker, helm, or test code, apart from updating metacatui tag to 2.25.0 in build.xml, which I already discussed with @taojing2002
  • Loading branch information
artntek committed Jul 20, 2023
2 parents 6076328 + 1ce0cd4 commit a383197
Show file tree
Hide file tree
Showing 11 changed files with 901 additions and 716 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<project name="metacat" default="jar" basedir="."
xmlns:artifact="antlib:org.apache.maven.artifact.ant">

<property name="metacatui-tag" value="2.23.0"/>
<property name="metacatui-tag" value="2.25.0"/>
<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_1_2"/>

<property environment="env"/>
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ WORKDIR "$TC_HOME"/bin

EXPOSE 8080
EXPOSE 5701
EXPOSE 5702
EXPOSE 5703

ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

Expand Down
6 changes: 6 additions & 0 deletions docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ ${METACAT_ADMINISTRATOR_PASSWORD}&username=${METACAT_ADMINISTRATOR_USERNAME}" \
if [[ $ADMIN_LOGGED_IN -eq 0 ]]; then
echo 'FAILED - unable to log in as admin'
echo '**************************************'
echo "grepping log $TC_HOME/logs/localhost*.$(date +%Y-%m-%d).log for startup conditions..."
exec grep -B7 -A20 "FATAL" "$TC_HOME"/logs/*
echo
echo '**************************************'
echo
echo
if [[ "$METACAT_DEBUG" != "true" ]]; then
echo 'Exiting...'
exit 3
Expand Down
6 changes: 4 additions & 2 deletions helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ kubectl delete pvc -l release=my-release ## deletes both
| `metacat.auth.administrators` | A colon-separated list of admin usernames or LDAP-style DN | `admin@localhost:uid=jones,ou=Account,dc=ecoinformatics,dc=org` |
| `metacat.database.connectionURI` | postgres DB URI (RELEASE PREFIX, or blank for sub-chart) | `jdbc:postgresql://mc-postgresql/metacat` |
| `metacat.guid.doi.enabled` | Allow users to publish Digital Object Identifiers at doi.org? | `true` |
| `metacat.server.httpPort` | The http port exposed internally by the metacat container | `8080` |
| `metacat.server.httpPort` | The http port exposed externally by the Ingress or Service | `80` |
| `metacat.server.name` | The hostname for the server, as exposed by the ingress | `localhost` |
| `metacat.solr.baseURL` | The url to access solr | `http://host.docker.internal:8983/solr` |
| `metacat.replication.logdir` | Location for the replication logs | `/var/metacat/logs` |
Expand Down Expand Up @@ -145,7 +145,9 @@ kubectl delete pvc -l release=my-release ## deletes both
| `ingress.hosts` | A collection of rules mapping different hosts to the backend. | `[]` |
| `ingress.annotations` | Annotations for the ingress | `{}` |
| `ingress.tls` | The TLS configuration | `[]` |
| `service.type` | Kubernetes Service type | `ClusterIP` |
| `service.enabled` | Enable another optional service in addition to headless svc | `false` |
| `service.type` | Kubernetes Service type. Defaults to ClusterIP if not set | `LoadBalancer` |
| `service.clusterIP` | IP address of the service. Auto-generated if not set | `""` |
| `service.ports` | The port(s) to be exposed | `[]` |
| `livenessProbe.enabled` | Enable livenessProbe for Metacat container | `true` |
| `livenessProbe.httpGet.path` | The url path to probe. | `/metacat/` |
Expand Down
11 changes: 3 additions & 8 deletions helm/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "metacat.fullname" . -}}
{{- $svcPort := 0 -}}
{{- range .Values.service.ports }}
{{- if eq .name "metacat-svc-web" }}
{{- $svcPort = .port }}
{{- end }}
{{- end }}
{{- $svcPort := 8080 -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
Expand Down Expand Up @@ -54,11 +49,11 @@ spec:
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}-headless-svc
name: {{ $fullName }}-hl
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}-headless-svc
serviceName: {{ $fullName }}-hl
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
Expand Down
7 changes: 4 additions & 3 deletions helm/templates/service-headless.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "metacat.fullname" . }}-headless-svc
name: {{ include "metacat.fullname" . }}-hl
labels:
{{- include "metacat.labels" . | nindent 4 }}
spec:
Expand All @@ -10,6 +10,7 @@ spec:
clusterIP: None
publishNotReadyAddresses: true
ports:
{{- toYaml .Values.service.ports | nindent 4 }}
- port: 8080
name: metacat-svc-web
selector:
{{- include "metacat.selectorLabels" . | nindent 4 }}
{{- include "metacat.selectorLabels" . | nindent 4 }}
15 changes: 15 additions & 0 deletions helm/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.service.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "metacat.fullname" . }}
labels:
{{- include "metacat.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type | default "ClusterIP" }}
clusterIP: {{ .Values.service.clusterIP | default "" }}
ports:
{{- toYaml .Values.service.ports | nindent 4 }}
selector:
{{- include "metacat.selectorLabels" . | nindent 4 }}
{{- end }}
8 changes: 7 additions & 1 deletion helm/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
{{- include "metacat.labels" . | nindent 4 }}
spec:
serviceName: {{ include "metacat.fullname" . }}-headless-svc
serviceName: {{ include "metacat.fullname" . }}-hl
replicas: 1
selector:
matchLabels:
Expand Down Expand Up @@ -35,6 +35,12 @@ spec:
ports:
- containerPort: 8080
name: metacat-web
- containerPort: 5701
name: hazelcast-port1
- containerPort: 5702
name: hazelcast-port2
- containerPort: 5703
name: hazelcast-port3
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
Expand Down
32 changes: 23 additions & 9 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ metacat:
##
guid.doi.enabled: true

## @param metacat.server.httpPort The http port exposed internally by the metacat container
##
server.httpPort: 8080
## @param metacat.server.httpPort The http port exposed externally by the Ingress or Service
## being used to allow connections from outside the k8s cluster.
## Must be defined here, even if unchanged from the default value in metacat.properties, since it
## is needed by the entrypoint script to populate metacatui's config.
##
server.httpPort: 80

## @param metacat.server.name The hostname for the server, as exposed by the ingress
## and seen by end users outside the cluster
Expand Down Expand Up @@ -278,20 +281,31 @@ ingress:
## secretName: ingress-nginx-tls-cert
tls: []

## Headless ClusterIP required for StatefulSet
## Optional service in addition to the Headless ClusterIP that is required for StatefulSet
service:
## @param service.type Kubernetes Service type
## @param service.enabled Enable another optional service in addition to headless svc
enabled: false

## @param service.type Kubernetes Service type. Defaults to ClusterIP if not set
type: LoadBalancer

## @param service.clusterIP IP address of the service. Auto-generated if not set
## Valid values are "None", empty string (""), or a valid IP address. Setting this to "None"
## makes a "headless service" (no virtual IP). Using empty string ("") will auto-generate an IP
##
type: ClusterIP
clusterIP: ""

## @param service.ports [array] The port(s) to be exposed
## service.ports.port The port to expose
## service.ports.name A unique name to identify this port.
## Note that the ingress will direct metacat traffic to the port named "metacat-svc-web"
##
ports:
- port: 8080
name: metacat-svc-web
- name: http-port
port: 8080
targetPort: metacat-web
- name: hazelcast-test1
port: 5701
targetPort: 5701

## LivenessProbe
## Periodic probe of container liveness. Container will be restarted if the probe fails.
Expand Down
Loading

0 comments on commit a383197

Please sign in to comment.