Skip to content

Commit

Permalink
wip -- e2e for non webhook installation
Browse files Browse the repository at this point in the history
Signed-off-by: Spolti <[email protected]>
  • Loading branch information
spolti committed Sep 11, 2023
1 parent 64a9ada commit 39b7f82
Show file tree
Hide file tree
Showing 9 changed files with 406 additions and 2 deletions.
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ help: ## Display this help.
manifests: generate ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:allowDangerousTypes=true webhook paths="./api/..." paths="./controllers/..." output:crd:artifacts:config=config/crd/bases

.PHONY: manifests-crd-no-webhooks
manifests-crd-no-webhooks: generate ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:allowDangerousTypes=true webhook paths="./api/..." paths="./controllers/..." output:crd:artifacts:config=config/crd-no-webhooks/bases

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./api/..." paths="./container-builder/api/..."
Expand Down Expand Up @@ -203,6 +207,10 @@ endif
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -

.PHONY: install-no-webhooks
install-no-webhooks: manifests-crd-no-webhooks kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd-no-webhooks | kubectl apply -f -

.PHONY: uninstall
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
Expand All @@ -212,6 +220,11 @@ deploy: manifests kustomize install-cert-manager ## Deploy controller to the K8s
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | kubectl apply -f -

.PHONY: deploy-no-webhooks
deploy-no-webhooks: manifests-crd-no-webhooks kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default-no-webhooks | kubectl apply -f -

.PHONY: undeploy
undeploy: uninstall-cert-manager ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
Expand Down
2 changes: 1 addition & 1 deletion config/default-no-webhooks/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namePrefix: sonataflow-operator-
bases:
- ../crd-no-webhooks
- ../rbac
- ../manager
- ../manager-no-webhooks
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
#- ../prometheus

Expand Down
11 changes: 11 additions & 0 deletions config/manager-no-webhooks/controller_manager_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
kind: ControllerManagerConfig
health:
healthProbeBindAddress: :8081
metrics:
bindAddress: 127.0.0.1:8080
webhook:
port: 9443
leaderElection:
leaderElect: true
resourceName: 1be5e57d.kiegroup.org
40 changes: 40 additions & 0 deletions config/manager-no-webhooks/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
resources:
- manager.yaml

generatorOptions:
disableNameSuffixHash: true

configMapGenerator:
- files:
- controller_manager_config.yaml
name: manager-config
- files:
- Dockerfile=sonataflow_builder_dockerfile.yaml
literals:
- DEFAULT_BUILDER_RESOURCE_NAME=Dockerfile
- DEFAULT_WORKFLOW_EXTENSION=.sw.json
name: builder-config

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/kiegroup/kogito-serverless-operator-nightly
newTag: latest
patchesJson6902:
- patch: |-
- op: add
path: /spec/template/spec/containers/0/env
value:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ENABLE_WEBHOOKS
value: "false"
target:
group: apps
kind: Deployment
name: controller-manager
namespace: system
version: v1
65 changes: 65 additions & 0 deletions config/manager-no-webhooks/manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
control-plane: controller-manager
name: system
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
namespace: system
labels:
control-plane: controller-manager
spec:
selector:
matchLabels:
control-plane: controller-manager
replicas: 1
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
control-plane: controller-manager
spec:
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- command:
- /usr/local/bin/manager
args:
- --leader-elect
- --v=2
image: controller:latest
name: manager
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 10m
memory: 64Mi
serviceAccountName: controller-manager
terminationGracePeriodSeconds: 10
31 changes: 31 additions & 0 deletions config/manager-no-webhooks/sonataflow_builder_dockerfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM quay.io/kiegroup/kogito-swf-builder-nightly:latest AS builder

# variables that can be overridden by the builder
# To add a Quarkus extension to your application
ARG QUARKUS_EXTENSIONS
# Args to pass to the Quarkus CLI add extension command
ARG QUARKUS_ADD_EXTENSION_ARGS

# Copy from build context to skeleton resources project
COPY --chmod=644 * ./resources/

RUN /home/kogito/launch/build-app.sh ./resources

#=============================
# Runtime Run
#=============================
FROM registry.access.redhat.com/ubi8/openjdk-11:latest

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'

# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --from=builder --chown=185 /home/kogito/serverless-workflow-project/target/quarkus-app/lib/ /deployments/lib/
COPY --from=builder --chown=185 /home/kogito/serverless-workflow-project/target/quarkus-app/*.jar /deployments/
COPY --from=builder --chown=185 /home/kogito/serverless-workflow-project/target/quarkus-app/app/ /deployments/app/
COPY --from=builder --chown=185 /home/kogito/serverless-workflow-project/target/quarkus-app/quarkus/ /deployments/quarkus/

EXPOSE 8080
USER 185
ENV AB_JOLOKIA_OFF=""
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"
2 changes: 2 additions & 0 deletions operator-no-webhooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3592,6 +3592,8 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: ENABLE_WEBHOOKS
value: "false"
image: quay.io/kiegroup/kogito-serverless-operator-nightly:latest
livenessProbe:
httpGet:
Expand Down
Loading

0 comments on commit 39b7f82

Please sign in to comment.