Skip to content

Commit

Permalink
Feat/argo events fixes (#2336)
Browse files Browse the repository at this point in the history
* Fixed a few glitches/errors with kube-setup-argo-events

* Removed the hardcoded environment from the awsnodetemplate template.

* Added code to copy the environment from the global configmap, and use that new configmap when creating new resources.

* Removing the afterStart setting and going with the default

* Missed the removal on the last commit

* Maybe it does need to be explicitly set
  • Loading branch information
AidanHilt authored Aug 29, 2023
1 parent 16f034a commit 7c63114
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 18 deletions.
16 changes: 14 additions & 2 deletions gen3/bin/kube-setup-argo-events.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,22 @@ if ! kubectl get namespace argo-events > /dev/null 2>&1; then
kubectl create namespace argo-events
fi

# Check if target configmap exists
if ! kubectl get configmap environment -n argo-events > /dev/null 2>&1; then

# Get value from source configmap
VALUE=$(kubectl get configmap global -n default -o jsonpath="{.data.environment}")

# Create target configmap
kubectl create configmap environment -n argo-events --from-literal=environment=$VALUE

fi

if [[ "$ctxNamespace" == "default" || "$ctxNamespace" == "null" || "$override_namespace" == true ]]; then
if (! helm status argo -n argo-events > /dev/null 2>&1 ) || [[ "$force" == true ]]; then
helm repo add argo https://argoproj.github.io/argo-helm --force-update 2> >(grep -v 'This is insecure' >&2)
helm repo update 2> >(grep -v 'This is insecure' >&2)
helm upgrade --install argo argo/argo-events -n argo-events --version "2.1.3"
helm upgrade --install argo-events argo/argo-events -n argo-events --version "2.1.3"
else
gen3_log_info "argo-events Helm chart already installed. To force reinstall, run with --force"
fi
Expand All @@ -46,7 +57,7 @@ if [[ "$ctxNamespace" == "default" || "$ctxNamespace" == "null" || "$override_na
kubectl apply -f ${GEN3_HOME}/kube/services/argo-events/eventbus.yaml
fi
else
gen3_log_info "Not running in default namespace, will not install argo-events helm chart"
gen3_log_info "Not running in default namespace, will not install argo-events helm chart. This behavior can be overwritten with the --override-namespace flag"
fi

if [[ "$create_workflow_resources" == true ]]; then
Expand All @@ -57,4 +68,5 @@ if [[ "$create_workflow_resources" == true ]]; then
#Creating rolebindings to allow Argo Events to create jobs, and allow those jobs to manage Karpenter resources
kubectl create rolebinding argo-events-job-admin-binding --role=job-admin --serviceaccount=argo-events:default --namespace=argo-events
kubectl create clusterrolebinding karpenter-admin-binding --clusterrole=karpenter-admin --serviceaccount=argo-events:default
kubectl create clusterrolebinding argo-workflows-view-binding --clusterrole=argo-argo-workflows-view --serviceaccount=argo-events:default
fi
3 changes: 2 additions & 1 deletion kube/services/argo-events/eventbus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ apiVersion: argoproj.io/v1alpha1
kind: EventBus
metadata:
name: default
namespace: argo-events
spec:
nats:
native:
# Optional, defaults to 3. If it is < 3, set it to 3, that is the minimal requirement.
replicas: 3
# Optional, authen strategy, "none" or "token", defaults to "none"
auth: token
auth: token
10 changes: 5 additions & 5 deletions kube/services/argo-events/workflows/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ data:
name: workflow-$WORKFLOW_NAME
spec:
subnetSelector:
karpenter.sh/discovery: vhdcperf
karpenter.sh/discovery: $ENVIRONMENT
securityGroupSelector:
karpenter.sh/discovery: vhdcperf-workflow
karpenter.sh/discovery: $ENVIRONMENT-workflow
tags:
Environment: vhdcperf
Name: eks-vhdcperf-workflow-karpenter
karpenter.sh/discovery: vhdcperf
Environment: $ENVIRONMENT
Name: eks-$ENVIRONMENT-workflow-karpenter
karpenter.sh/discovery: $ENVIRONMENT
workflowname: $WORKFLOW_NAME
gen3username: $GEN3_USERNAME
gen3service: argo-workflows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ spec:
eventTypes:
- ADD
filter:
afterStart: false
afterStart: true
22 changes: 13 additions & 9 deletions kube/services/argo-events/workflows/sensor-created.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,20 @@ spec:
- name: karpenter-resource-creator
image: quay.io/cdis/awshelper
command: ["/bin/sh"]
args:
- "-c"
- |
for file in /home/manifests/*.yaml; do envsubst < $file | kubectl apply -f -; done
args:
- "-c"
- |
for file in /home/manifests/*.yaml; do envsubst < $file | kubectl apply -f -; done
env:
- name: WORKFLOW_NAME
value: ""
- name: GEN3_USERNAME
value: ""
- name: WORKFLOW_NAME
value: ""
- name: GEN3_USERNAME
value: ""
- name: ENVIRONMENT
valueFrom:
configMapKeyRef:
name: environment
key: environment
volumeMounts:
- name: karpenter-templates-volume
mountPath: /home/manifests
Expand All @@ -73,4 +78,3 @@ spec:
configMap:
name: karpenter-templates
backoffLimit: 0

0 comments on commit 7c63114

Please sign in to comment.