Skip to content

Commit

Permalink
Dockerfile updates as well as kustomize version updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cin committed Mar 1, 2024
1 parent 8b480aa commit cca2954
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 50 deletions.
3 changes: 2 additions & 1 deletion config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ resources:
- bases/gatling-operator.tech.zozo.com_gatlings.yaml
# +kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
# - patches/webhook_in_gatlings.yaml
Expand All @@ -19,3 +18,5 @@ patchesStrategicMerge:
# the following config is for teaching kustomize how to do kustomization for CRDs.
configurations:
- kustomizeconfig.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
42 changes: 8 additions & 34 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ namePrefix: gatling-operator-
# commonLabels:
# someName: someValue

bases:
- ../crd
- ../rbac
- ../manager
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
# - ../webhook
Expand All @@ -24,11 +20,9 @@ bases:
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
# - ../prometheus

patchesStrategicMerge:
# Protect the /metrics endpoint by putting it behind auth.
# If you want your controller-manager to expose the /metrics
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml

# Mount the controller config file for loading manager configurations
# through a ComponentConfig type
Expand All @@ -44,31 +38,11 @@ patchesStrategicMerge:
# - webhookcainjection_patch.yaml

# the following config is for teaching kustomize how to do var substitution
vars:
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
# - name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
# objref:
# kind: Certificate
# group: cert-manager.io
# version: v1
# name: serving-cert # this name should match the one in certificate.yaml
# fieldref:
# fieldpath: metadata.namespace
# - name: CERTIFICATE_NAME
# objref:
# kind: Certificate
# group: cert-manager.io
# version: v1
# name: serving-cert # this name should match the one in certificate.yaml
# - name: SERVICE_NAMESPACE # namespace of the service
# objref:
# kind: Service
# version: v1
# name: webhook-service
# fieldref:
# fieldpath: metadata.namespace
# - name: SERVICE_NAME
# objref:
# kind: Service
# version: v1
# name: webhook-service
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../crd
- ../rbac
- ../manager
patches:
- path: manager_auth_proxy_patch.yaml
8 changes: 6 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
resources:
- manager.yaml

# This file will get modified by kustomize file. Please don't commit any changes to the git repo!
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: gatling-operator
newTag: 20240214-221927
2 changes: 2 additions & 0 deletions config/prometheus/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
resources:
- monitor.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
11 changes: 3 additions & 8 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
resources:
# All RBAC will be applied under this service account in
# the deployment namespace. You may comment out this resource
# if your manager will use a service account that exists at
# runtime. Be sure to update RoleBinding and ClusterRoleBinding
# subjects if changing service account names.
resources:
- service_account.yaml
- role.yaml
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml
# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
# - auth_proxy_service.yaml
# - auth_proxy_role.yaml
# - auth_proxy_role_binding.yaml
# - auth_proxy_client_clusterrole.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
2 changes: 2 additions & 0 deletions config/samples/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ resources:
- gatling-notification-slack-secrets.yaml
- gatling-operator_v1alpha1_gatling01.yaml
- gatling-worker-service-account.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
27 changes: 22 additions & 5 deletions gatling/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,34 @@
# https://github.com/denvazh/gatling/tree/master/3.2.1
#
# Gatling is a highly capable load testing tool.
FROM maven:3.9.6 AS dependency_stage

WORKDIR /tmp

ARG MAVEN_REPO="https://repo.maven.apache.org/maven2/"
ARG MAVEN_ARTIFACTS="\
com.github.javafaker:javafaker:1.0.2 \
com.github.mifmif:generex:1.0.2 \
org.apache.commons:commons-lang3:3.5 \
org.yaml:snakeyaml:1.23 \
"

# Fetch dependencies using Maven
RUN for artifact in $MAVEN_ARTIFACTS; do \
mvn dependency:copy -Dartifact="$artifact" -DoutputDirectory="/tmp/lib/." -DremoteRepositories="$MAVEN_REPO"; \
done

FROM openjdk:17-jdk-slim-bullseye

# working directory for gatling
WORKDIR /opt

# gating version
ENV GATLING_VERSION 3.9.5
ENV GATLING_VERSION 3.10.4

# create directory for gatling install
RUN mkdir -p gatling
ENV APP_HOME /opt/gatling
ENV APP_USER gatling
ENV APP_GROUP appgroup

# install gatling
RUN set -x && mkdir -p gatling && \
Expand All @@ -29,8 +46,7 @@ RUN set -x && mkdir -p gatling && \
curl https://rclone.org/install.sh | bash && \
addgroup --system ${APP_GROUP} && \
adduser --system ${APP_USER} --ingroup ${APP_GROUP} --home ${APP_HOME} --no-create-home && \
chown -R ${APP_USER}:${APP_GROUP} ${APP_HOME} && \
chown -R ${APP_USER}:${APP_GROUP} /var/log/nginx /var/lib/nginx /usr/share/nginx
chown -R ${APP_USER}:${APP_GROUP} ${APP_HOME} /var/log/nginx /var/lib/nginx /usr/share/nginx

USER gatling

Expand All @@ -44,6 +60,7 @@ VOLUME ["/opt/gatling/conf", "/opt/gatling/results", "/opt/gatling/user-files"]
COPY user-files/simulations user-files/simulations
COPY user-files/resources user-files/resources
COPY conf conf
COPY --from=dependency_stage /tmp/lib ${APP_HOME}/user-files/lib/

# set environment variables
ENV PATH /opt/gatling/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Expand Down

0 comments on commit cca2954

Please sign in to comment.