Skip to content

Commit

Permalink
[Spider][k8s]Environment cleanup in the affiliation cron
Browse files Browse the repository at this point in the history
Creation of the share folder and cleanup of the environment in the affiliation cron (as it will not need most of the secrets)
  • Loading branch information
cronosnull committed Jun 2, 2020
1 parent cc2e839 commit 1407d99
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 61 deletions.
63 changes: 7 additions & 56 deletions k8s/cronjobs/spider-cron-affiliation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
serviceAccountName: spider-account
containers:
- name: cms-htcondor-es
image: cronosnull/cms_htcondor_es:0.2
image: cronosnull/cms_htcondor_es:0.3
args:
- /bin/sh
- -c
Expand All @@ -25,7 +25,7 @@ spec:
command:
- bash
- -c
- sudo chmod 0777 $AFFILIATION_DIR_LOCATION; sudo chown spider:spider $AFFILIATION_DIR_LOCATION; ls -al $AFFILIATION_DIR_LOCATION
- sudo chmod 0777 $AFFILIATION_DIR_LOCATION; sudo chown 1414:1414 $AFFILIATION_DIR_LOCATION; ls -al $AFFILIATION_DIR_LOCATION
env:
- name: AFFILIATION_DIR_LOCATION
value: /cms_shared/affiliation_dir.json
Expand All @@ -35,68 +35,19 @@ spec:
value: redis://$(REDIS_SERVICE_HOST):$(REDIS_SERVICE_PORT_6379)/1
- name: CELERY_TEST
value: '"true"'
- name: CMS_AMQ_PASSWORD_FILE
value: /cms_secrets/amq-password/amq-password
- name: CMS_AMQ_USERNAME_FILE
value: /cms_secrets/amq-username/amq-username
- name: CMS_ES_CONF_FILE
value: /cms_secrets/es-conf/es-conf
- name: CMS_HTCONDOR_BROKER
value: cms-test-mb.cern.ch
- name: CMS_HTCONDOR_PRODUCER
value: condor-test
- name: CMS_HTCONDOR_TOPIC
value: /topic/cms.jobmon.condor
- name: COLLECTORS_FILE_LOCATION
value: /cms_secrets/collectors/collectors
- name: C_FORCE_ROOT
value: '"true"'
- name: PYTHONPATH
value: /cms-htcondor-es/src:$PYTHONPATH
- name: REQUESTS_CA_BUNDLE
value: /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
- name: SPIDER_CHECKPOINT
value: redis://$(REDIS_CHECKPOINT_SERVICE_HOST):$(REDIS_CHECKPOINT_SERVICE_PORT)/0

volumeMounts:
- mountPath: /cms_secrets/amq-username
name: amq-username
- mountPath: /cms_secrets/amq-password
name: amq-password
- mountPath: /cms_secrets/es-conf
name: es-conf
- mountPath: /cms_secrets/collectors
name: collectors
- mountPath: /cms_shared
name: shared-spider

volumes:
- name: shared-spider
persistentVolumeClaim:
claimName: affilations-cephfs-claim
restartPolicy: Never
securityContext:
fsGroup: 1414
volumes: &spider_volumes
- name: amq-username
secret:
items:
- key: amq-username
path: amq-username
secretName: amq-username
- name: amq-password
secret:
items:
- key: amq-password
path: amq-password
secretName: amq-password
- name: es-conf
secret:
items:
- key: es-conf
path: es-conf
secretName: es-conf
- name: collectors
secret:
items:
- key: collectors
path: collectors
secretName: collectors
- name: shared-spider
emptyDir: {}
fsGroup: 1414
5 changes: 3 additions & 2 deletions k8s/cronjobs/spider-cron-queues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
serviceAccountName: spider-account
containers:
- name: cms-htcondor-es
image: cronosnull/cms_htcondor_es:0.2
image: cronosnull/cms_htcondor_es:0.3
args:
- python
- /cms-htcondor-es/celery_spider_cms.py
Expand Down Expand Up @@ -88,5 +88,6 @@ spec:
path: collectors
secretName: collectors
- name: shared-spider
emptyDir: {}
persistentVolumeClaim:
claimName: affilations-cephfs-claim

7 changes: 4 additions & 3 deletions k8s/deployments/spider-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ spec:
spec:
containers:
- name: spider-worker
image: cronosnull/cms_htcondor_es:0.2
image: cronosnull/cms_htcondor_es:0.3
args:
- celery
- -A
- htcondor_es.celery.celery
- worker
resources:
requests:
cpu: 500m
cpu: 100m
memory: 200Mi
limits:
cpu: 2000m
Expand Down Expand Up @@ -102,4 +102,5 @@ spec:
path: collectors
secretName: collectors
- name: shared-spider
emptyDir: {}
persistentVolumeClaim:
claimName: affilations-cephfs-claim
12 changes: 12 additions & 0 deletions k8s/storages/shared_spider.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: affilations-cephfs-claim
namespace: spider
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1G
storageClassName: meyrin-cephfs

0 comments on commit 1407d99

Please sign in to comment.