From 30bcb6f52996563d9d6cfb59e1e85e20d76635e2 Mon Sep 17 00:00:00 2001 From: dpshekhawat Date: Thu, 1 Sep 2022 18:13:38 +0530 Subject: [PATCH 1/3] WIP --- configmapenv.yaml | 7 +++++++ configmaps.yaml | 10 ++++++++++ deployments.yaml | 27 +++++++++++++++++++++++++++ edgedevice.yaml | 12 ++++++++++++ edgeworkload.yaml | 21 +++++++++++++++++++++ envfile.properties | 1 + secrets.yaml | 9 +++++++++ 7 files changed, 87 insertions(+) create mode 100644 configmapenv.yaml create mode 100644 configmaps.yaml create mode 100644 deployments.yaml create mode 100644 edgedevice.yaml create mode 100644 edgeworkload.yaml create mode 100644 envfile.properties create mode 100644 secrets.yaml diff --git a/configmapenv.yaml b/configmapenv.yaml new file mode 100644 index 0000000..6e0059d --- /dev/null +++ b/configmapenv.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: capture + namespace: default +data: + CAPTURE: "True" \ No newline at end of file diff --git a/configmaps.yaml b/configmaps.yaml new file mode 100644 index 0000000..80e1892 --- /dev/null +++ b/configmaps.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: s3config + namespace: default +data: + BUCKET_HOST: play.min.io + BUCKET_NAME: flotta-ic-data-bucket + BUCKET_PORT: "443" + BUCKET_REGION: us-east-1 \ No newline at end of file diff --git a/deployments.yaml b/deployments.yaml new file mode 100644 index 0000000..cdc57f6 --- /dev/null +++ b/deployments.yaml @@ -0,0 +1,27 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: ic-test-pod + labels: + app: example-ic +spec: + selector: + matchLabels: + app: example-ic + replicas: 1 + template: + metadata: + labels: + app: example-ic + spec: + containers: + - name: test-container + image: quay.io/dpshekhawat/img-class + imagePullPolicy: Always + command: [ "/bin/sh", "-c", "env" ] + env: + - name: CAPTURE + valueFrom: + configMapKeyRef: + name: configmapenv + key: CAPTURE diff --git a/edgedevice.yaml b/edgedevice.yaml new file mode 100644 index 0000000..f478d56 --- /dev/null +++ b/edgedevice.yaml @@ -0,0 +1,12 @@ +apiVersion: management.project-flotta.io/v1alpha1 +kind: EdgeDevice +metadata: + name: ic-edge-device + namespace: default + labels: + app: edge-device-app +spec: + storage: + s3: + configMapName: "s3config" + secretName: "s3secret" \ No newline at end of file diff --git a/edgeworkload.yaml b/edgeworkload.yaml new file mode 100644 index 0000000..dcdbe38 --- /dev/null +++ b/edgeworkload.yaml @@ -0,0 +1,21 @@ +apiVersion: management.project-flotta.io/v1alpha1 +kind: EdgeWorkload +metadata: + name: edge-ic-workload +spec: + deviceSelector: + matchLabels: + app: edge-device-app + data: + egress: + - source: tmp + target: ic-edge-device + type: pod + pod: + spec: + containers: + - name: edge-ic-workload + image: quay.io/dpshekhawat/img-class:v1 + securityContext: + capabilities: + add: ["ALL"] \ No newline at end of file diff --git a/envfile.properties b/envfile.properties new file mode 100644 index 0000000..675e679 --- /dev/null +++ b/envfile.properties @@ -0,0 +1 @@ +CAPTURE=True \ No newline at end of file diff --git a/secrets.yaml b/secrets.yaml new file mode 100644 index 0000000..29ebdc4 --- /dev/null +++ b/secrets.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: s3secret + namespace: default +type: Opaque +data: + AWS_ACCESS_KEY_ID: Q3AM3UQ867SPQQA43P2F + AWS_SECRET_ACCESS_KEY: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG \ No newline at end of file From 2239da4a57fb23d9cf17398fe4925ce8788ccc48 Mon Sep 17 00:00:00 2001 From: dpshekhawat Date: Fri, 2 Sep 2022 12:33:11 +0530 Subject: [PATCH 2/3] workload files --- configmapenv.yaml | 7 ---- configmaps.yaml => deployment/configmaps.yaml | 0 edgedevice.yaml => deployment/edgedevice.yaml | 2 +- deployment/edgeworkload.yaml | 33 +++++++++++++++++++ secrets.yaml => deployment/secrets.yaml | 0 deployments.yaml | 27 --------------- edgeworkload.yaml | 21 ------------ envfile.properties | 1 - 8 files changed, 34 insertions(+), 57 deletions(-) delete mode 100644 configmapenv.yaml rename configmaps.yaml => deployment/configmaps.yaml (100%) rename edgedevice.yaml => deployment/edgedevice.yaml (89%) create mode 100644 deployment/edgeworkload.yaml rename secrets.yaml => deployment/secrets.yaml (100%) delete mode 100644 deployments.yaml delete mode 100644 edgeworkload.yaml delete mode 100644 envfile.properties diff --git a/configmapenv.yaml b/configmapenv.yaml deleted file mode 100644 index 6e0059d..0000000 --- a/configmapenv.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: capture - namespace: default -data: - CAPTURE: "True" \ No newline at end of file diff --git a/configmaps.yaml b/deployment/configmaps.yaml similarity index 100% rename from configmaps.yaml rename to deployment/configmaps.yaml diff --git a/edgedevice.yaml b/deployment/edgedevice.yaml similarity index 89% rename from edgedevice.yaml rename to deployment/edgedevice.yaml index f478d56..75e79cd 100644 --- a/edgedevice.yaml +++ b/deployment/edgedevice.yaml @@ -4,7 +4,7 @@ metadata: name: ic-edge-device namespace: default labels: - app: edge-device-app + app: camera spec: storage: s3: diff --git a/deployment/edgeworkload.yaml b/deployment/edgeworkload.yaml new file mode 100644 index 0000000..f57d3ca --- /dev/null +++ b/deployment/edgeworkload.yaml @@ -0,0 +1,33 @@ +apiVersion: management.project-flotta.io/v1alpha1 +kind: EdgeWorkload +metadata: + name: edge-ic-workload + namespace: default + annotations: + podman/run.oci.keep_original_groups: "1" +spec: + deviceSelector: + matchLabels: + app: camera + data: + egress: + - source: images + target: images + type: pod + pod: + spec: + containers: + - name: edge-ic-workload + image: quay.io/dpshekhawat/img-class:latest + volumeMounts: + - mountPath: /dev/video0 + name: video + securityContext: + seLinuxOptions: + type: 'spc_t' + restartPolicy: Always + volumes: + - name: video + hostPath: + path: /dev/video0 + type: File \ No newline at end of file diff --git a/secrets.yaml b/deployment/secrets.yaml similarity index 100% rename from secrets.yaml rename to deployment/secrets.yaml diff --git a/deployments.yaml b/deployments.yaml deleted file mode 100644 index cdc57f6..0000000 --- a/deployments.yaml +++ /dev/null @@ -1,27 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: ic-test-pod - labels: - app: example-ic -spec: - selector: - matchLabels: - app: example-ic - replicas: 1 - template: - metadata: - labels: - app: example-ic - spec: - containers: - - name: test-container - image: quay.io/dpshekhawat/img-class - imagePullPolicy: Always - command: [ "/bin/sh", "-c", "env" ] - env: - - name: CAPTURE - valueFrom: - configMapKeyRef: - name: configmapenv - key: CAPTURE diff --git a/edgeworkload.yaml b/edgeworkload.yaml deleted file mode 100644 index dcdbe38..0000000 --- a/edgeworkload.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: management.project-flotta.io/v1alpha1 -kind: EdgeWorkload -metadata: - name: edge-ic-workload -spec: - deviceSelector: - matchLabels: - app: edge-device-app - data: - egress: - - source: tmp - target: ic-edge-device - type: pod - pod: - spec: - containers: - - name: edge-ic-workload - image: quay.io/dpshekhawat/img-class:v1 - securityContext: - capabilities: - add: ["ALL"] \ No newline at end of file diff --git a/envfile.properties b/envfile.properties deleted file mode 100644 index 675e679..0000000 --- a/envfile.properties +++ /dev/null @@ -1 +0,0 @@ -CAPTURE=True \ No newline at end of file From 8c93c9d41023fdcfb81fba5c7b1ae3e5acdff2e9 Mon Sep 17 00:00:00 2001 From: dpshekhawat Date: Sun, 4 Sep 2022 18:35:46 +0530 Subject: [PATCH 3/3] modified --- deployment/configmaps.yaml | 11 ++++++++++- deployment/edgeworkload.yaml | 4 ++++ deployment/secrets.yaml | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/deployment/configmaps.yaml b/deployment/configmaps.yaml index 80e1892..0b11304 100644 --- a/deployment/configmaps.yaml +++ b/deployment/configmaps.yaml @@ -1,10 +1,19 @@ apiVersion: v1 kind: ConfigMap +metadata: + name: ic-config +data: + CAPTURE: "True" + THRES: "0.25" + TIMEINT: "5" +--- +apiVersion: v1 +kind: ConfigMap metadata: name: s3config namespace: default data: - BUCKET_HOST: play.min.io + BUCKET_HOST: s3://flotta-ic-data-bucket BUCKET_NAME: flotta-ic-data-bucket BUCKET_PORT: "443" BUCKET_REGION: us-east-1 \ No newline at end of file diff --git a/deployment/edgeworkload.yaml b/deployment/edgeworkload.yaml index f57d3ca..f2f1ee1 100644 --- a/deployment/edgeworkload.yaml +++ b/deployment/edgeworkload.yaml @@ -19,6 +19,10 @@ spec: containers: - name: edge-ic-workload image: quay.io/dpshekhawat/img-class:latest + envFrom: + - configMapRef: + name: ic-config + optional: false volumeMounts: - mountPath: /dev/video0 name: video diff --git a/deployment/secrets.yaml b/deployment/secrets.yaml index 29ebdc4..4cf46ac 100644 --- a/deployment/secrets.yaml +++ b/deployment/secrets.yaml @@ -5,5 +5,5 @@ metadata: namespace: default type: Opaque data: - AWS_ACCESS_KEY_ID: Q3AM3UQ867SPQQA43P2F - AWS_SECRET_ACCESS_KEY: zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG \ No newline at end of file + AWS_ACCESS_KEY_ID: + AWS_SECRET_ACCESS_KEY: