├── azure-iot ├── CONTRIBUTING.md ├── LICENSE ├── azure-iot-read │ ├── Dockerfile │ ├── azure-send-message-deviceto-cloud.py │ ├── read.py │ └── requirements.txt ├── azure-iot-runtime-0.2.10.tgz ├── azure-iot-runtime-0.2.11.tgz ├── azure-iot-runtime-old │ ├── .helmignore │ ├── Chart.yaml │ ├── LICENSE │ ├── NOTICE │ ├── templates │ │ ├── NOTES.txt │ │ ├── _helpers.tpl │ │ ├── crd.yaml │ │ ├── edge-rbac.yaml │ │ ├── iotedged-agent-config.yaml │ │ ├── iotedged-config-secret.yaml │ │ ├── iotedged-deployment.yaml │ │ ├── iotedged-proxy-config.yaml │ │ ├── iotedged-pvc.yaml │ │ └── iotedged-service.yaml │ └── values.yaml ├── azure-iot-runtime │ ├── .helmignore │ ├── Chart.yaml │ ├── LICENSE │ ├── NOTICE │ ├── templates │ │ ├── NOTES.txt │ │ ├── _helpers.tpl │ │ ├── crd.yaml │ │ ├── edge-rbac.yaml │ │ ├── iotedged-agent-config.yaml │ │ ├── iotedged-config-secret.yaml │ │ ├── iotedged-deployment.yaml │ │ ├── iotedged-proxy-config.yaml │ │ ├── iotedged-pvc.yaml │ │ └── iotedged-service.yaml │ └── values.yaml ├── azure-video-analytics-demo-0.1.5.tgz ├── readme.md ├── video-analytics-demo-0.1.8.tgz ├── video-analytics-demo-old │ ├── Chart.yaml │ ├── README.md │ ├── _helmignore │ ├── config │ │ ├── create_config.py │ │ └── play.html │ ├── templates │ │ ├── NOTES.txt │ │ ├── _helpers.tpl │ │ ├── configmap.yaml │ │ ├── deployment.yaml │ │ ├── ingress.yaml │ │ ├── service.yaml │ │ └── tests │ │ │ └── test-connection.yaml │ └── values.yaml └── video-analytics-demo │ ├── Chart.yaml │ ├── README.md │ ├── _helmignore │ ├── config │ ├── create_config.py │ ├── create_config_a100.py │ ├── create_config_backup.py │ └── play.html │ ├── templates │ ├── NOTES.txt │ ├── _helpers.tpl │ ├── configmap.yaml │ ├── deployment.yaml │ ├── ingress.yaml │ ├── service.yaml │ └── tests │ │ └── test-connection.yaml │ └── values.yaml └── readme.md /azure-iot/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribute to the NVIDIA Fleet Command 2 | 3 | Want to hack on the NVIDIA Fleet Command Project? Awesome! 4 | We only require you to sign your work, the below section describes this! 5 | 6 | ## Sign your work 7 | 8 | The sign-off is a simple line at the end of the explanation for the patch. Your 9 | signature certifies that you wrote the patch or otherwise have the right to pass 10 | it on as an open-source patch. The rules are pretty simple: if you can certify 11 | the below (from [developercertificate.org](http://developercertificate.org/)): 12 | 13 | ``` 14 | Developer Certificate of Origin 15 | Version 1.1 16 | 17 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 18 | 1 Letterman Drive 19 | Suite D4700 20 | San Francisco, CA, 94129 21 | 22 | Everyone is permitted to copy and distribute verbatim copies of this 23 | license document, but changing it is not allowed. 24 | 25 | Developer's Certificate of Origin 1.1 26 | 27 | By making a contribution to this project, I certify that: 28 | 29 | (a) The contribution was created in whole or in part by me and I 30 | have the right to submit it under the open source license 31 | indicated in the file; or 32 | 33 | (b) The contribution is based upon previous work that, to the best 34 | of my knowledge, is covered under an appropriate open source 35 | license and I have the right under that license to submit that 36 | work with modifications, whether created in whole or in part 37 | by me, under the same open source license (unless I am 38 | permitted to submit under a different license), as indicated 39 | in the file; or 40 | 41 | (c) The contribution was provided directly to me by some other 42 | person who certified (a), (b) or (c) and I have not modified 43 | it. 44 | 45 | (d) I understand and agree that this project and the contribution 46 | are public and that a record of the contribution (including all 47 | personal information I submit with it, including my sign-off) is 48 | maintained indefinitely and may be redistributed consistent with 49 | this project or the open source license(s) involved. 50 | ``` 51 | 52 | Then you just add a line to every git commit message: 53 | 54 | Signed-off-by: Joe Smith 55 | 56 | Use your real name (sorry, no pseudonyms or anonymous contributions.) 57 | 58 | If you set your `user.name` and `user.email` git configs, you can sign your 59 | commit automatically with `git commit -s`. 60 | -------------------------------------------------------------------------------- /azure-iot/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2021 Anurag Guda 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-read/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7 2 | 3 | COPY . ./ 4 | #COPY azure-send-message.py . 5 | 6 | RUN pip3 install -r requirements.txt 7 | 8 | ENTRYPOINT python azure-send-message-deviceto-cloud.py 9 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-read/azure-send-message-deviceto-cloud.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | import os 15 | import asyncio 16 | from azure.iot.device.aio import IoTHubDeviceClient 17 | import time 18 | import datetime 19 | 20 | async def main(): 21 | # Fetch the connection string from an enviornment variable 22 | conn_str = os.getenv("IOTHUB_DEVICE_CONNECTION_STRING") 23 | hostname = os.getenv("HOSTNAME") 24 | 25 | # Create instance of the device client using the authentication provider 26 | device_client = IoTHubDeviceClient.create_from_connection_string(conn_str) 27 | 28 | # Connect the device client. 29 | await device_client.connect() 30 | 31 | # Send a single message 32 | print("Sending message to {}".format(conn_str)) 33 | #tail = sh.tail("-f", "/home/deepstream.log", _iter=True) 34 | tail = os.popen("cat /home/deepstream.log | tail -125f | grep -v -e '^$'") 35 | #await device_client.send_message("This is a message that is being sent from {}".format(hostname)) 36 | await device_client.send_message("{} host current time is {}".format(hostname, str(datetime.datetime.now()))) 37 | await device_client.send_message(tail.read()) 38 | #await device_client.send_message("This is a message that is being sent from {}".format(hostname)) 39 | print("Message successfully sent!") 40 | print() 41 | 42 | # finally, disconnect 43 | await device_client.disconnect() 44 | 45 | 46 | if __name__ == "__main__": 47 | while True: 48 | time.sleep(3) 49 | asyncio.run(main()) 50 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-read/read.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | import asyncio 15 | from azure.eventhub import TransportType 16 | from azure.eventhub.aio import EventHubConsumerClient 17 | import os 18 | import logging 19 | 20 | # Event Hub-compatible endpoint 21 | # az iot hub show --query properties.eventHubEndpoints.events.endpoint --name {your IoT Hub name} 22 | EVENTHUB_COMPATIBLE_ENDPOINT = "{your Event Hubs compatible endpoint}" 23 | 24 | # Event Hub-compatible name 25 | # az iot hub show --query properties.eventHubEndpoints.events.path --name {your IoT Hub name} 26 | EVENTHUB_COMPATIBLE_PATH = "{your Event Hubs compatible name}" 27 | 28 | # Primary key for the "service" policy to read messages 29 | # az iot hub policy show --name service --query primaryKey --hub-name {your IoT Hub name} 30 | IOTHUB_SAS_KEY = "{your service primary key}" 31 | 32 | # If you have access to the Event Hub-compatible connection string from the Azure portal, then 33 | # you can skip the Azure CLI commands above, and assign the connection string directly here. 34 | #CONNECTION_STR = f'Endpoint={EVENTHUB_COMPATIBLE_ENDPOINT}/;SharedAccessKeyName=service;SharedAccessKey={IOTHUB_SAS_KEY};EntityPath={EVENTHUB_COMPATIBLE_PATH}' 35 | CONNECTION_STR = os.getenv("IOTHUB_CONNECTION_STRING") 36 | 37 | # Define callbacks to process events 38 | async def on_event_batch(partition_context, events): 39 | for event in events: 40 | #print("Received event from partition: {}.".format(partition_context.partition_id)) 41 | print("Telemetry received: ", event.body_as_str()) 42 | #print("Properties (set by device): ", event.properties) 43 | #print("System properties (set by IoT Hub): ", event.system_properties) 44 | print() 45 | await partition_context.update_checkpoint() 46 | 47 | async def on_error(partition_context, error): 48 | # Put your code here. partition_context can be None in the on_error callback. 49 | if partition_context: 50 | print("An exception: {} occurred during receiving from Partition: {}.".format( 51 | partition_context.partition_id, 52 | error 53 | )) 54 | else: 55 | print("An exception: {} occurred during the load balance process.".format(error)) 56 | 57 | 58 | async def main(): 59 | loop = asyncio.get_event_loop() 60 | client = EventHubConsumerClient.from_connection_string( 61 | conn_str=CONNECTION_STR, 62 | consumer_group="$default", 63 | eventhub_name = os.getenv("IOTHUB_NAME") 64 | #eventhub_name="egx-iot" 65 | # transport_type=TransportType.AmqpOverWebsocket, # uncomment it if you want to use web socket 66 | # http_proxy={ # uncomment if you want to use proxy 67 | # 'proxy_hostname': '127.0.0.1', # proxy hostname. 68 | # 'proxy_port': 3128, # proxy port. 69 | # 'username': '', 70 | # 'password': '' 71 | # } 72 | ) 73 | try: 74 | #print("try loop") 75 | recv_task = asyncio.ensure_future(client.receive_batch(on_event_batch=on_event_batch, on_error=on_error)) 76 | #loop.run_until_complete(client.receive_batch(on_event_batch=on_event_batch, on_error=on_error)) 77 | await asyncio.sleep(3) 78 | recv_task.cancel() 79 | await client.close() 80 | except KeyboardInterrupt: 81 | print("Receiving has stopped.") 82 | 83 | if __name__ == '__main__': 84 | while True: 85 | asyncio.run(main()) 86 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-read/requirements.txt: -------------------------------------------------------------------------------- 1 | azure-iot-device 2 | azure-iot-hub 3 | azure-eventhub 4 | asyncio 5 | sh 6 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-0.2.10.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NVIDIA/fleet-command/a7b4a9dfa438216e87f600a3eeb0637c495d4312/azure-iot/azure-iot-runtime-0.2.10.tgz -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-0.2.11.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NVIDIA/fleet-command/a7b4a9dfa438216e87f600a3eeb0637c495d4312/azure-iot/azure-iot-runtime-0.2.11.tgz -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | appVersion: '1.0' 3 | description: A Helm chart for running Azure IoT Edge on Kubernetes 4 | name: azure-iot-runtime 5 | version: 0.2.10 6 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | 22 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/NOTICE: -------------------------------------------------------------------------------- 1 | This repository includes software from https://github.com/Azure/iotedge/tree/release/1.1-k8s-preview licensed under the MIT License, (the "License") 2 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | Thank you for installing {{ .Chart.Name }}. 2 | 3 | Your release is named {{ .Release.Name }}. 4 | 5 | To learn more about the release, try: 6 | 7 | $ helm status {{ .Release.Name }} 8 | $ helm get {{ .Release.Name }} 9 | 10 | Your resources have been deployed to the namespace {{ include "edge-kubernetes.namespace" . | quote }} -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* vim: set filetype=mustache: */}} 2 | {{/* 3 | Expand the name of the chart. 4 | */}} 5 | {{- define "edge-kubernetes.name" -}} 6 | {{- default .Chart.Name | trunc 63 | trimSuffix "-" -}} 7 | {{- end -}} 8 | 9 | {{/* 10 | Create chart name and version as used by the chart label. 11 | */}} 12 | {{- define "edge-kubernetes.chart" -}} 13 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 14 | {{- end -}} 15 | 16 | {{/* Template for iotedged's configuration YAML. */}} 17 | {{- define "edge-kubernetes.iotedgedconfig" }} 18 | provisioning: 19 | {{- range $key, $val := .Values.provisioning }} 20 | {{- if eq $key "attestation"}} 21 | attestation: 22 | {{- range $atkey, $atval := $val }} 23 | {{- if eq $atkey "identityCert" }} 24 | identity_cert: "file:///etc/edge-attestation/identity_cert" 25 | {{- else if eq $atkey "identityPk" }} 26 | identity_pk: "file:///etc/edge-attestation/identity_pk" 27 | {{- else }} 28 | {{ $atkey | snakecase }}: {{$atval | quote }} 29 | {{- end }} 30 | {{- end }} 31 | {{- else if eq $key "authentication" }} 32 | authentication: 33 | {{- range $aukey, $auval := $val }} 34 | {{- if eq $aukey "identityCert" }} 35 | identity_cert: "file:///etc/edge-authentication/identity_cert" 36 | {{- else if eq $aukey "identityPk" }} 37 | identity_pk: "file:///etc/edge-authentication/identity_pk" 38 | {{- else }} 39 | {{ $aukey | snakecase }}: {{$auval | quote }} 40 | {{- end }} 41 | {{- end }} 42 | {{- else }} 43 | {{ $key | snakecase }}: {{- if or (kindIs "float64" $val) (kindIs "bool" $val) }} {{ $val }} {{- else }} {{ $val | quote }} 44 | {{- end }} 45 | {{- end }} 46 | {{- end }} 47 | {{- with .Values.iotedged.certificates }} 48 | certificates: 49 | {{- if .secret }} 50 | device_ca_cert: "/etc/edgecerts/device_ca_cert" 51 | device_ca_pk: "/etc/edgecerts/device_ca_pk" 52 | trusted_ca_certs: "/etc/edgecerts/trusted_ca_certs" 53 | {{- end }} 54 | {{- if .auto_generated_ca_lifetime_days }} 55 | auto_generated_ca_lifetime_days: {{ .auto_generated_ca_lifetime_days }} 56 | {{- end }} 57 | {{ end }} 58 | agent: 59 | name: "edgeAgent" 60 | type: "docker" 61 | {{- if .Values.edgeAgent.env }} 62 | env: 63 | {{- if .Values.iotedged.data.httpsProxy }} 64 | https_proxy: {{ .Values.iotedged.data.httpsProxy | quote }} 65 | {{- end}} 66 | {{- if .Values.iotedged.data.noProxy }} 67 | no_proxy: {{ .Values.iotedged.data.noProxy | quote }} 68 | {{- end}} 69 | {{- range $envkey, $envval := .Values.edgeAgent.env }} 70 | {{- if eq $envkey "portMappingServiceType"}} 71 | PortMappingServiceType: {{ $envval | quote }} 72 | {{- else if eq $envkey "backupConfigFilePath"}} 73 | BackupConfigFilePath: {{ $envval | quote }} 74 | {{- else if eq $envkey "enableK8sServiceCallTracing"}} 75 | EnableK8sServiceCallTracing: {{ $envval | quote }} 76 | {{- else if eq $envkey "runtimeLogLevel"}} 77 | RuntimeLogLevel: {{ $envval | quote }} 78 | {{- else if eq $envkey "persistentVolumeClaimDefaultSizeInMb"}} 79 | {{- $sizeInMb := $envval }} 80 | PersistentVolumeClaimDefaultSizeInMb: {{- if kindIs "float64" $sizeInMb }} {{ printf "%.0f" $sizeInMb | quote }} {{- else }} {{ $sizeInMb | quote }} {{end}} 81 | {{- else if eq $envkey "upstreamProtocol"}} 82 | UpstreamProtocol: {{ $envval | quote }} 83 | {{- else if eq $envkey "useMountSourceForVolumeName"}} 84 | UseMountSourceForVolumeName: {{ $envval | quote }} 85 | {{- else if eq $envkey "storageClassName"}} 86 | StorageClassName: {{- if (eq "-" $envval) }} "" {{- else }} {{ $envval | quote }} {{- end }} 87 | {{- else if eq $envkey "enableExperimentalFeatures" }} 88 | ExperimentalFeatures__Enabled: {{ $envval | quote }} 89 | {{- else if eq $envkey "enableK8sExtensions" }} 90 | ExperimentalFeatures__EnableK8SExtensions: {{ $envval | quote }} 91 | {{- else if eq $envkey "runAsNonRoot" }} 92 | RunAsNonRoot: {{ $envval | quote }} 93 | {{- else }} 94 | {{ $envkey }}: {{$envval | quote }} 95 | {{- end }} 96 | {{- end }} 97 | {{ else }} 98 | env: {} 99 | {{ end }} 100 | config: 101 | image: "{{ .Values.edgeAgent.image.repository }}:{{ .Values.edgeAgent.image.tag }}" 102 | {{- if .Values.edgeAgent.registryCredentials }} 103 | auth: 104 | username: {{ .Values.edgeAgent.registryCredentials.username | quote }} 105 | password: {{ .Values.edgeAgent.registryCredentials.password | quote }} 106 | serveraddress: {{ .Values.edgeAgent.registryCredentials.serveraddress | quote }} 107 | {{ else }} 108 | auth: {} 109 | {{ end }} 110 | {{- if .Values.maxRetries }} 111 | max_retries: {{ .Values.maxRetries }} 112 | {{- end }} 113 | hostname: {{ .Values.edgeAgent.hostname }} 114 | connect: 115 | management_uri: "https://localhost:{{ .Values.iotedged.ports.management }}" 116 | workload_uri: "https://localhost:{{ .Values.iotedged.ports.workload }}" 117 | listen: 118 | management_uri: "https://0.0.0.0:{{ .Values.iotedged.ports.management }}" 119 | workload_uri: "https://0.0.0.0:{{ .Values.iotedged.ports.workload }}" 120 | homedir: {{ .Values.iotedged.data.targetPath | quote }} 121 | namespace: {{ .Release.Namespace | quote }} 122 | device_hub_selector: "" 123 | config_map_name: "iotedged-agent-config" 124 | config_path: "/etc/edgeAgent" 125 | config_map_volume: "agent-config-volume" 126 | {{- if .Values.edgeAgent.resources }} 127 | resources: 128 | {{ toYaml .Values.edgeAgent.resources | indent 2 }} 129 | {{- end }} 130 | proxy: 131 | image: "{{.Values.iotedgedProxy.image.repository}}:{{.Values.iotedgedProxy.image.tag}}" 132 | image_pull_policy: {{ .Values.iotedgedProxy.image.pullPolicy | quote }} 133 | {{- if .Values.iotedgedProxy.registryCredentials }} 134 | auth: 135 | username: {{ .Values.iotedgedProxy.registryCredentials.username | quote }} 136 | password: {{ .Values.iotedgedProxy.registryCredentials.password | quote }} 137 | serveraddress: {{ .Values.iotedgedProxy.registryCredentials.serveraddress | quote }} 138 | {{ else }} 139 | auth: {} 140 | {{ end }} 141 | config_map_name: "iotedged-proxy-config" 142 | config_path: "/etc/iotedge-proxy" 143 | trust_bundle_config_map_name: "iotedged-proxy-trust-bundle" 144 | trust_bundle_path: "/etc/trust-bundle" 145 | {{- if .Values.iotedgedProxy.resources }} 146 | resources: 147 | {{ toYaml .Values.iotedgedProxy.resources | indent 4 }} 148 | {{- end }} 149 | {{ end }} 150 | 151 | {{/* Template for agent's configuration. */}} 152 | {{- define "edge-kubernetes.agentconfig" }} 153 | AgentConfigPath: "/etc/edgeAgent" 154 | AgentConfigMapName: "iotedged-agent-config" 155 | AgentConfigVolume: "agent-config-volume" 156 | ProxyImage: "{{.Values.iotedgedProxy.image.repository}}:{{.Values.iotedgedProxy.image.tag}}" 157 | ProxyConfigVolume: "config-volume" 158 | ProxyConfigMapName: "iotedged-proxy-config" 159 | ProxyConfigPath: "/etc/iotedge-proxy" 160 | ProxyTrustBundlePath: "/etc/trust-bundle" 161 | ProxyTrustBundleVolume: "trust-bundle-volume" 162 | ProxyTrustBundleConfigMapName: "iotedged-proxy-trust-bundle" 163 | {{- if .Values.iotedgedProxy.resources }} 164 | ProxyResourceRequests: 165 | {{ toYaml .Values.iotedgedProxy.resources | indent 2 }} 166 | {{- end }} 167 | {{- if .Values.edgeAgent.resources }} 168 | AgentResourceRequests: 169 | {{ toYaml .Values.edgeAgent.resources | indent 2 }} 170 | {{- end }} 171 | {{ end }} 172 | 173 | {{/* Template for rendering registry credentials. */}} 174 | {{- define "edge-kubernetes.regcreds" }} 175 | auths: 176 | {{- range $key, $val := .Values.registryCredentials }} 177 | {{ $key | quote }}: 178 | auth: {{ printf "%s:%s" $val.username $val.password | b64enc | quote }} 179 | {{- end }} 180 | {{- end }} 181 | 182 | {{/* 183 | Parse the device ID from connection string. 184 | */}} 185 | {{- define "edge-kubernetes.deviceid" -}} 186 | {{- regexFind "DeviceId=[^;]+" .Values.deviceConnectionString | regexFind "=.+" | substr 1 -1 | lower -}} 187 | {{- end -}} 188 | 189 | {{/* 190 | Parse the host name from connection string. 191 | */}} 192 | {{- define "edge-kubernetes.hostname" -}} 193 | {{- regexFind "HostName=[^;]+" .Values.deviceConnectionString | regexFind "=.+" | substr 1 -1 | lower -}} 194 | {{- end -}} 195 | 196 | {{/* 197 | Parse the hub name from connection string. 198 | */}} 199 | {{- define "edge-kubernetes.hubname" -}} 200 | {{- include "edge-kubernetes.hostname" . | splitList "." | first | lower -}} 201 | {{- end -}} 202 | 203 | {{/* 204 | Generate namespace from release namespace parameter. 205 | */}} 206 | {{- define "edge-kubernetes.namespace" -}} 207 | {{ .Release.Namespace }} 208 | {{- end -}} 209 | 210 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/templates/crd.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apiextensions.k8s.io/v1beta1 2 | kind: CustomResourceDefinition 3 | metadata: 4 | name: edgedeployments.microsoft.azure.devices.edge 5 | spec: 6 | group: microsoft.azure.devices.edge 7 | names: 8 | kind: EdgeDeployment 9 | listKind: EdgeDeploymentList 10 | plural: edgedeployments 11 | singular: edgedeployment 12 | scope: Namespaced 13 | subresources: 14 | # status enables the status subresource. 15 | status: {} 16 | version: v1 17 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/templates/edge-rbac.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: iotedged 6 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 7 | labels: 8 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 9 | app.kubernetes.io/instance: {{.Release.Name | quote }} 10 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 11 | ... 12 | --- 13 | apiVersion: rbac.authorization.k8s.io/v1 14 | kind: ClusterRoleBinding 15 | metadata: 16 | name: iotedge:{{ .Release.Name }}:auth-delegator 17 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 18 | labels: 19 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 20 | app.kubernetes.io/instance: {{.Release.Name | quote }} 21 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 22 | roleRef: 23 | apiGroup: rbac.authorization.k8s.io 24 | kind: ClusterRole 25 | name: system:auth-delegator 26 | subjects: 27 | - kind: ServiceAccount 28 | name: iotedged 29 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 30 | ... 31 | --- 32 | {{- if .Values.iotedged.data.enableGetNodesRBAC }} 33 | apiVersion: rbac.authorization.k8s.io/v1 34 | kind: ClusterRoleBinding 35 | metadata: 36 | name: iotedge:{{ .Release.Name }}:node-observer 37 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 38 | labels: 39 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 40 | app.kubernetes.io/instance: {{.Release.Name | quote }} 41 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 42 | roleRef: 43 | apiGroup: rbac.authorization.k8s.io 44 | kind: ClusterRole 45 | name: iotedge:{{ .Release.Name }}:node-observer 46 | subjects: 47 | - kind: ServiceAccount 48 | name: iotedged 49 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 50 | ... 51 | {{ end }} 52 | --- 53 | apiVersion: rbac.authorization.k8s.io/v1 54 | kind: RoleBinding 55 | metadata: 56 | name: iotedged 57 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 58 | labels: 59 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 60 | app.kubernetes.io/instance: {{.Release.Name | quote }} 61 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 62 | roleRef: 63 | apiGroup: rbac.authorization.k8s.io 64 | kind: Role 65 | name: iotedged 66 | subjects: 67 | - kind: ServiceAccount 68 | name: iotedged 69 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 70 | ... 71 | --- 72 | {{- if .Values.iotedged.data.enableGetNodesRBAC }} 73 | apiVersion: rbac.authorization.k8s.io/v1 74 | kind: ClusterRole 75 | metadata: 76 | name: iotedge:{{ .Release.Name }}:node-observer 77 | labels: 78 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 79 | app.kubernetes.io/instance: {{.Release.Name | quote }} 80 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 81 | rules: 82 | - apiGroups: [""] 83 | resources: ["nodes"] 84 | verbs: ["list", "watch", "get"] 85 | ... 86 | {{ end }} 87 | --- 88 | apiVersion: rbac.authorization.k8s.io/v1 89 | kind: Role 90 | metadata: 91 | name: iotedged 92 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 93 | labels: 94 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 95 | app.kubernetes.io/instance: {{.Release.Name | quote }} 96 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 97 | rules: 98 | - apiGroups: [""] 99 | resources: ["nodes"] 100 | verbs: ["list"] 101 | - apiGroups: [""] 102 | resources: ["pods", "pods/log"] 103 | verbs: ["list", "watch"] 104 | - apiGroups: [""] 105 | resources: ["services"] 106 | verbs: ["list", "create", "delete", "update"] 107 | - apiGroups: ["apps"] 108 | resources: ["deployments"] 109 | verbs: ["list", "get", "create", "delete", "update"] 110 | - apiGroups: [""] 111 | resources: ["secrets", "serviceaccounts", "configmaps"] 112 | verbs: ["list", "get", "create", "update", "delete"] 113 | - apiGroups: [""] 114 | resources: ["persistentvolumeclaims"] 115 | verbs: ["list", "create", "update", "delete"] 116 | - apiGroups: ["rbac.authorization.k8s.io"] 117 | resources: ["rolebindings"] 118 | verbs: ["list", "create", "delete", "update"] 119 | - apiGroups: ["microsoft.azure.devices.edge"] 120 | resources: ["edgedeployments"] 121 | verbs: ["list", "get", "create", "update", "delete", "watch"] 122 | - apiGroups: ["microsoft.azure.devices.edge"] 123 | resources: ["edgedeployments/status"] 124 | verbs: ["list", "get", "create", "update", "delete"] 125 | ... 126 | --- 127 | apiVersion: rbac.authorization.k8s.io/v1 128 | kind: Role 129 | metadata: 130 | name: edgeagent 131 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 132 | labels: 133 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 134 | app.kubernetes.io/instance: {{.Release.Name | quote }} 135 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 136 | rules: 137 | - apiGroups: [""] 138 | resources: ["pods", "pods/log"] 139 | verbs: ["list", "watch"] 140 | - apiGroups: [""] 141 | resources: ["services"] 142 | verbs: ["list", "create", "delete", "update"] 143 | - apiGroups: ["apps"] 144 | resources: ["deployments"] 145 | verbs: ["list", "get", "create", "delete", "update"] 146 | - apiGroups: [""] 147 | resources: ["secrets", "serviceaccounts"] 148 | verbs: ["list", "get", "create", "update", "delete"] 149 | - apiGroups: [""] 150 | resources: ["persistentvolumeclaims"] 151 | verbs: ["list", "create", "update", "delete"] 152 | - apiGroups: ["microsoft.azure.devices.edge"] 153 | resources: ["edgedeployments"] 154 | verbs: ["list", "get", "create", "update", "delete", "watch"] 155 | - apiGroups: ["microsoft.azure.devices.edge"] 156 | resources: ["edgedeployments/status"] 157 | verbs: ["list", "get", "create", "update", "delete"] 158 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/templates/iotedged-agent-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: iotedged-agent-config 5 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 6 | labels: 7 | app.kubernetes.io/name: iotedged-agent-config 8 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 9 | app.kubernetes.io/instance: {{ .Release.Name }} 10 | app.kubernetes.io/managed-by: {{ .Release.Service }} 11 | data: 12 | appsettings_k8s.json: |- 13 | {{ include "edge-kubernetes.agentconfig" . | fromYaml | toJson }} 14 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/templates/iotedged-config-secret.yaml: -------------------------------------------------------------------------------- 1 | {{/* Render the config.yaml file as a secret for iotedged. */}} 2 | --- 3 | apiVersion: v1 4 | kind: Secret 5 | metadata: 6 | name: iotedged-config 7 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 8 | labels: 9 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 10 | app.kubernetes.io/instance: {{.Release.Name | quote }} 11 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 12 | type: Opaque 13 | data: 14 | config.yaml: |- 15 | {{ include "edge-kubernetes.iotedgedconfig" . | b64enc }} 16 | ... 17 | {{/* Render all the registry credentials as secrets. */}} 18 | {{- if .Values.registryCredentials }} 19 | --- 20 | apiVersion: v1 21 | kind: Secret 22 | metadata: 23 | name: regcreds 24 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 25 | labels: 26 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 27 | app.kubernetes.io/instance: {{.Release.Name | quote }} 28 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 29 | type: kubernetes.io/dockerconfigjson 30 | data: 31 | {{- /* 32 | The "fromYaml | toJson" pipeline below is a hack to convert the YAML string 33 | returned by the "regcreds" template into a JSON. Without first converting it 34 | to YAML (i.e. a Go Map object), "toJson" just JSONifies the raw YAML string. 35 | Generating a JSON directly from the "regcreds" template also doesn't work 36 | because we are iterating over a map from ".Values.registryCredentials" 37 | using the "range" action and it doesn't provide a way to detect if we are 38 | at the end of the iteration so we can omit the trailing comma for the last 39 | entry. 40 | */}} 41 | .dockerconfigjson: |- 42 | {{ include "edge-kubernetes.regcreds" . | fromYaml | toJson | b64enc }} 43 | ... 44 | {{ end }} 45 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/templates/iotedged-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: iotedged 5 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 6 | labels: 7 | app.kubernetes.io/name: {{ include "edge-kubernetes.name" . }}-iotedged 8 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 9 | app.kubernetes.io/instance: {{ .Release.Name }} 10 | app.kubernetes.io/managed-by: {{ .Release.Service }} 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app.kubernetes.io/name: {{ include "edge-kubernetes.name" . }}-iotedged 16 | app.kubernetes.io/instance: {{ .Release.Name }} 17 | template: 18 | metadata: 19 | labels: 20 | app.kubernetes.io/name: {{ include "edge-kubernetes.name" . }}-iotedged 21 | app.kubernetes.io/instance: {{ .Release.Name }} 22 | spec: 23 | containers: 24 | - name: iotedged 25 | image: "{{ .Values.iotedged.image.repository }}:{{ .Values.iotedged.image.tag }}" 26 | imagePullPolicy: {{ .Values.iotedged.image.pullPolicy }} 27 | command: ["/app/iotedged"] 28 | args: ["-c", "/etc/iotedged/config.yaml"] 29 | {{- if .Values.iotedged.data.resources }} 30 | resources: 31 | {{ toYaml .Values.iotedged.data.resources | indent 12 }} 32 | {{- end }} 33 | env: 34 | - name: "IOTEDGE_LOG" 35 | value: "info" 36 | {{- if .Values.iotedged.data.httpsProxy }} 37 | - name: "https_proxy" 38 | value: {{ .Values.iotedged.data.httpsProxy | quote}} 39 | {{- end}} 40 | {{- if .Values.iotedged.data.noProxy }} 41 | - name: "no_proxy" 42 | value: {{ .Values.iotedged.data.noProxy | quote}} 43 | {{- end}} 44 | volumeMounts: 45 | - name: config 46 | mountPath: "/etc/iotedged" 47 | readOnly: true 48 | - name: edge-home 49 | mountPath: {{ .Values.iotedged.data.targetPath | quote }} 50 | {{- with .Values.iotedged.certificates }} 51 | {{- if .secret }} 52 | - name: edge-certs 53 | mountPath: "/etc/edgecerts" 54 | readOnly: true 55 | {{- end}} 56 | {{- end}} 57 | {{- if .Values.iotedged.data.useHostTrust }} 58 | - name: ca-edge-host-trust 59 | mountPath: "/etc/ssl/certs" 60 | {{- end }} 61 | {{- with .Values.provisioning.authentication }} 62 | {{- if .identitySecret }} 63 | - name: edge-authentication 64 | mountPath: "/etc/edge-authentication" 65 | readOnly: true 66 | {{- end}} 67 | {{- end}} 68 | {{- with .Values.provisioning.attestation }} 69 | {{- if .identitySecret }} 70 | - name: edge-attestation 71 | mountPath: "/etc/edge-attestation" 72 | readOnly: true 73 | {{- end}} 74 | {{- end}} 75 | ports: 76 | - name: management 77 | containerPort: {{ .Values.iotedged.ports.management }} 78 | protocol: TCP 79 | - name: workload 80 | containerPort: {{ .Values.iotedged.ports.workload }} 81 | protocol: TCP 82 | livenessProbe: 83 | httpGet: 84 | scheme: HTTPS 85 | path: "/systeminfo?api-version={{ .Values.iotedged.apiVersion }}" 86 | port: {{ .Values.iotedged.ports.management }} 87 | readinessProbe: 88 | httpGet: 89 | scheme: HTTPS 90 | path: "/systeminfo?api-version={{ .Values.iotedged.apiVersion }}" 91 | port: {{ .Values.iotedged.ports.management }} 92 | serviceAccount: "iotedged" 93 | {{- /* Render image pull secrets if they have been provided. */ -}} 94 | {{- if .Values.registryCredentials }} 95 | imagePullSecrets: 96 | - name: regcreds 97 | {{ end }} 98 | securityContext: 99 | runAsNonRoot: true 100 | runAsUser: 1000 101 | {{- if .Values.iotedged.fsGroup }} 102 | fsGroup: {{ .Values.iotedged.fsGroup }} 103 | {{ end }} 104 | {{- if .Values.iotedged.nodeSelector }} 105 | nodeSelector: 106 | {{ toYaml .Values.iotedged.nodeSelector | indent 8 }} 107 | {{- end }} 108 | volumes: 109 | - name: config 110 | secret: 111 | secretName: iotedged-config 112 | {{- with .Values.provisioning.authentication }} 113 | {{- if .identitySecret }} 114 | {{- /* 115 | NOTE: This sets up iotedged with a volume "/etc/edge-authentication" populated with authentication certs. 116 | */}} 117 | - name: edge-authentication 118 | secret: 119 | secretName: {{ .identitySecret }} 120 | items: 121 | - key: {{ .identityCert | default "identity_certificate.pem" }} 122 | path: identity_cert 123 | - key: {{ .identityPk | default "identity_key.pem" }} 124 | path: identity_pk 125 | {{- end}} 126 | {{- end}} 127 | {{- with .Values.provisioning.attestation }} 128 | {{- if .identitySecret }} 129 | {{- /* 130 | NOTE: This sets up iotedged with a volume "/etc/edge-attestation" populated with the attestation certs. 131 | */}} 132 | - name: edge-attestation 133 | secret: 134 | secretName: {{ .identitySecret }} 135 | items: 136 | - key: {{ .identityCert | default "identity_certificate.pem" }} 137 | path: identity_cert 138 | - key: {{ .identityPk | default "identity_key.pem" }} 139 | path: identity_pk 140 | {{- end}} 141 | {{- end}} 142 | {{- if .Values.iotedged.data.useHostTrust }} 143 | - name: ca-edge-host-trust 144 | hostPath: 145 | path: /etc/ssl/certs 146 | type: Directory 147 | {{- end}} 148 | {{- with .Values.iotedged.certificates }} 149 | {{- if .secret }} 150 | {{- /* 151 | NOTE: This sets up iotedged with a volume "/etc/edgecerts" populated with the given CA certs. 152 | */}} 153 | - name: edge-certs 154 | secret: 155 | secretName: {{ .secret }} 156 | items: 157 | - key: {{ .device_ca_cert | default "device_ca_cert" }} 158 | path: device_ca_cert 159 | - key: {{ .device_ca_pk | default "device_ca_pk" }} 160 | path: device_ca_pk 161 | - key: {{ .trusted_ca_certs | default "trusted_ca_certs" }} 162 | path: trusted_ca_certs 163 | 164 | {{- end}} 165 | {{- else}} 166 | {{- /* 167 | NOTE: This sets up iotedged in the "quickstart" mode which is NOT meant 168 | for production use. For PoCs though, its wonderful! For production, this 169 | volume should probably be populated with proper CA certs. 170 | */}} 171 | {{- end}} 172 | - name: edge-home 173 | {{- if .Values.iotedged.data.persistentVolumeClaim }} 174 | persistentVolumeClaim: 175 | claimName: {{ .Values.iotedged.data.persistentVolumeClaim.name }} 176 | readOnly: false 177 | {{ else }} 178 | emptyDir: {} 179 | {{ end -}} 180 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/templates/iotedged-proxy-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: iotedged-proxy-config 5 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 6 | labels: 7 | app.kubernetes.io/name: iotedged-proxy-config 8 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 9 | app.kubernetes.io/instance: {{ .Release.Name }} 10 | app.kubernetes.io/managed-by: {{ .Release.Service }} 11 | data: 12 | config.yaml: |- 13 | services: 14 | - name: "management" 15 | entrypoint: "http://localhost:{{ .Values.iotedged.ports.management }}" 16 | backend: "https://{{ .Values.iotedged.service.name }}:{{ .Values.iotedged.ports.management }}" 17 | certificate: "/etc/trust-bundle/trust_bundle.pem" 18 | 19 | - name: "workload" 20 | entrypoint: "http://localhost:{{ .Values.iotedged.ports.workload }}" 21 | backend: "https://{{ .Values.iotedged.service.name }}:{{ .Values.iotedged.ports.workload }}" 22 | certificate: "/etc/trust-bundle/trust_bundle.pem" 23 | 24 | api: 25 | entrypoint: "http://localhost:8080" 26 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/templates/iotedged-pvc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.iotedged.data.persistentVolumeClaim }} 2 | {{- if and (.Values.iotedged.data.persistentVolumeClaim.size) (.Values.iotedged.data.persistentVolumeClaim.storageClassName) }} 3 | apiVersion: v1 4 | kind: PersistentVolumeClaim 5 | metadata: 6 | name: {{ .Values.iotedged.data.persistentVolumeClaim.name | quote }} 7 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 8 | labels: 9 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 10 | app.kubernetes.io/instance: {{.Release.Name | quote }} 11 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 12 | spec: 13 | resources: 14 | requests: 15 | storage: {{ .Values.iotedged.data.persistentVolumeClaim.size }} 16 | accessModes: 17 | - ReadWriteOnce 18 | storageClassName: {{ .Values.iotedged.data.persistentVolumeClaim.storageClassName | quote }} 19 | {{- if .Values.iotedged.data.persistentVolumeClaim.volumeName }} 20 | volumeName: {{ .Values.iotedged.data.persistentVolumeClaim.volumeName | quote }} 21 | {{- end }} 22 | {{- end }} 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/templates/iotedged-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ .Values.iotedged.service.name | quote }} 5 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 6 | labels: 7 | app.kubernetes.io/name: {{ include "edge-kubernetes.name" . }}-iotedged 8 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 9 | app.kubernetes.io/instance: {{ .Release.Name }} 10 | app.kubernetes.io/managed-by: {{ .Release.Service }} 11 | spec: 12 | selector: 13 | app.kubernetes.io/name: {{ include "edge-kubernetes.name" . }}-iotedged 14 | app.kubernetes.io/instance: {{ .Release.Name }} 15 | type: {{ .Values.iotedged.service.type | quote }} 16 | ports: 17 | - name: management 18 | port: {{ .Values.iotedged.ports.management }} 19 | targetPort: management 20 | - name: workload 21 | port: {{ .Values.iotedged.ports.workload }} 22 | targetPort: workload -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime-old/values.yaml: -------------------------------------------------------------------------------- 1 | # iotedged configuration 2 | iotedged: 3 | image: 4 | repository: azureiotedge/azureiotedge-iotedged 5 | tag: 0.1.0-beta12 6 | pullPolicy: Always 7 | nodeSelector: {} 8 | # Volumes which support ownership management are modified to be owned and 9 | # writable by the GID specified in fsGroup. 10 | # fsGroup: 2000 11 | service: 12 | name: iotedged 13 | type: ClusterIP 14 | apiVersion: '2019-01-30' 15 | # TCP ports on which iotedged should listen 16 | ports: 17 | management: 35000 18 | workload: 35001 19 | data: 20 | enableGetNodesRBAC: true 21 | targetPath: /var/lib/iotedge 22 | # Normally the iotedged is running as a host process, and has access to 23 | # the host's trusted CA certificates. Use this options to allow the 24 | # iotedged deployment to use the host OS's /etc/ssl/certs 25 | # useHostTrust: false 26 | # 27 | # In order to benefit from HA, at a minimum the data location for iotedged 28 | # should be backed by a persistent volume. 29 | # User may create a PersistentVolumeClaim and provide the name only here. Alternatively. 30 | # user may set persistent volume claim details below. In that case the charts will define a PVC. 31 | # If nothing is provided then the iotedged pod will default to using an 32 | # "emptyDir" volume which is not recommended because emptyDir storage is tied to the Pod's 33 | # lifetime and the runtime will fail if iotedged is restarted. 34 | # 35 | # persistentVolumeClaim: 36 | # # name is required for iotedged to use persistence. 37 | # name: 38 | # # Set the following fields if you would like the chart to create a PVC 39 | # storageClassName: 40 | # volumeName: 41 | # size: 100Mi 42 | # 43 | ############################################################################### 44 | # Proxy settings 45 | ############################################################################### 46 | # Set the following if an HTTPS proxy is needed 47 | # httpsProxy: "" 48 | # noProxy: "" 49 | ############################################################################### 50 | # Watchdog settings 51 | ############################################################################### 52 | # 53 | # The IoT edge daemon has a watchdog that periodically checks the health of the 54 | # Edge Agent module and restarts it if it's down. 55 | # 56 | # maxRetries - Configures the number of retry attempts that the IoT edge daemon 57 | # should make for failed operations before failing with a fatal error. 58 | # 59 | # If this configuration is not specified, the daemon keeps retrying 60 | # on errors and doesn't fail fatally. 61 | # 62 | # On a fatal failure, the daemon returns an exit code which 63 | # signifies the kind of error encountered. Currently, the following 64 | # error codes are returned by the daemon - 65 | # 66 | # 150 - Invalid Device ID specified. 67 | # 151 - Invalid IoT hub configuration. 68 | # 152 - Invalid SAS token used to call IoT hub. 69 | # This could signal an invalid SAS key. 70 | # 1 - All other errors. 71 | ############################################################################### 72 | # maxRetries: 2 73 | ############################################################################### 74 | # Resource limit settings 75 | ############################################################################### 76 | # 77 | # We want QoS to be "Guaranteed" so we are setting resource requests and limits 78 | # to equal values. Values can be adjusted, or may be set to null to remove. 79 | # iotedged: 80 | # Values set here will apply directly to iotedged deployment. 81 | # Proxy: 82 | # Values set in iotedgedProxy section will apply to all proxy containers in deployment. 83 | # Agent: 84 | # Values set in agent section will apply to agent as the bootstrap values. 85 | # It may be overwritten in the edge deployment on the IoT Hub via $edgeAgent's 86 | # createOptions. 87 | # modules: 88 | # All module container resources should be set through edge deployment on the 89 | # IoT Hub via module's createOptions 90 | ############################################################################### 91 | resources: 92 | requests: 93 | memory: "100Mi" 94 | cpu: "100m" 95 | limits: 96 | memory: "100Mi" 97 | cpu: "100m" 98 | 99 | ############################################################################### 100 | # Certificate settings 101 | ############################################################################### 102 | # 103 | # Configures the certificates required to operate the IoT Edge 104 | # runtime as a gateway which enables external leaf devices to securely 105 | # communicate with the Edge Hub. If not specified, the required certificates 106 | # are auto generated for quick start scenarios which are not intended for 107 | # production environments. 108 | # 109 | # Please create a secret containing 3 items, the Device CA cert, the Device CA private key, and 110 | # the root CA. Then give the chart the secret name and the item names. For example, if a secret 111 | # is created like this: 112 | # `kubectl create secret generic -n device-namespace edge-certs --from-file=certs/iot-edge-device-ca-MyEdgeDeviceCA-full-chain.cert.pem --from-file=private/iot-edge-device-ca-MyEdgeDeviceCA.key.pem --from-file=certs/azure-iot-test-only.root.ca.cert.pem` 113 | # The YAML would look like: 114 | # certificates: 115 | # secret: "edge-certs" 116 | # device_ca_cert: "iot-edge-device-ca-MyEdgeDeviceCA-full-chain.cert.pem" 117 | # device_ca_pk: "iot-edge-device-ca-MyEdgeDeviceCA.key.pem" 118 | # trusted_ca_certs: "azure-iot-test-only.root.ca.cert.pem" 119 | # 120 | # certificates: 121 | # secret: "" 122 | # device_ca_cert: "" 123 | # device_ca_pk: "" 124 | # trusted_ca_certs: "" 125 | # auto_generated_ca_lifetime_days: 126 | 127 | # module to iotedged proxy sidecar settings. 128 | # Available Settings: 129 | # image: 130 | # repository: 131 | # tag: 132 | # pullPolicy: 133 | # registryCredentials: 134 | # username: 135 | # password: 136 | # serveraddress: 137 | # resources: (Set to null to remove.) 138 | 139 | iotedgedProxy: 140 | image: 141 | repository: azureiotedge/azureiotedge-proxy 142 | tag: 0.1.0-beta12 143 | pullPolicy: Always 144 | resources: 145 | requests: 146 | memory: "25Mi" 147 | cpu: "5m" 148 | limits: 149 | memory: "25Mi" 150 | cpu: "5m" 151 | 152 | 153 | # Edge Agent image configuration 154 | # Settings: 155 | # containerName - name of the edge agent module. Expected to be "edgeAgent". 156 | # image - Image tag and image pull policy 157 | # resources - cpu and memory limit may be set here for bootstrap agent. 158 | # (Set to null to remove resource requests.) 159 | # env - Any environment variable that needs to be set for edge agent module. 160 | # Some environment variables affect how Edge Agent creates modules in the 161 | # cluster see the descriptions below. 162 | edgeAgent: 163 | containerName: edgeagent 164 | image: 165 | repository: azureiotedge/azureiotedge-agent 166 | tag: 0.1.0-beta12 167 | pullPolicy: Always 168 | hostname: "localhost" 169 | resources: 170 | requests: 171 | memory: "200Mi" 172 | cpu: "50m" 173 | limits: 174 | memory: "200Mi" 175 | cpu: "50m" 176 | env: 177 | authScheme: 'sasToken' 178 | # Set this to one of "LoadBalancer", "NodePort", or "ClusterIP" to tell the 179 | # IoT Edge runtime how you want to expose mapped ports as Services. 180 | portMappingServiceType: 'ClusterIP' 181 | 182 | # Set the location of the backup configuration file. 183 | backupConfigFilePath: '/tmp/backup.json' 184 | 185 | # Set this to false if you want to turn off verbose k8s call tracing 186 | enableK8sServiceCallTracing: false 187 | 188 | # Configure edge agent log verbosity 189 | runtimeLogLevel: 'debug' 190 | 191 | # Set this to set the upstream protocol for edgeAgent (default: Amqp with AmpqWs as fallback) 192 | # upstreamProtocol: 'AmqpWs' 193 | 194 | # Configure the default claim size to use (in megabytes) when creating PVCs. 195 | # persistentVolumeClaimDefaultSizeInMb: "" 196 | 197 | # Set this as guidance for converting Docker Volume mounts to Persistent Volume Claims. 198 | # Set to true to tell the runtime to use the Volume mount source (mount.Source) as the 199 | # Persistent volume name (volumeName) in the PVC 200 | useMountSourceForVolumeName: false 201 | 202 | # Set this to the name of a storage class name if you wish the volumes that 203 | # back persistent storage in modules to use dynamically provisioned PVCs. 204 | # If you wish this to be an empty string then you'll need to use the string 205 | # literal "-" in liue of an empty string. 206 | # storageClassName: "" 207 | 208 | # Set this to true if you wish to turn on experimental features support. Please see 209 | # https://github.com/Azure/iotedge/blob/master/kubernetes/doc/create-options.md to 210 | # find more information about experimental create options feature. 211 | enableExperimentalFeatures: true 212 | 213 | # Create options extensions for Kubernetes 214 | # The feature allows the user to extend a module's create options with some Kubernetes primitives. 215 | # To activate this experimental feature, both "enableExperimentalFeatures" and "enableK8sExtensions" 216 | # must be set to "true". 217 | enableK8sExtensions: true 218 | 219 | # Configure default pod security context rule. If set true, it will allow kubernetes to run only non-root containers 220 | # under the user with uid(1000). 221 | # false dy default. 222 | # runAsNonRoot: false 223 | 224 | # If an environment variables is required and not defined above, they may be added as needed. 225 | # ANOTHER_ENV_VAR: "another env value" 226 | 227 | # Optional registry credentials for module images 228 | # registryCredentials: 229 | # : 230 | # username: '' 231 | # password: '' 232 | 233 | ############################################################################### 234 | # Provisioning mode and settings 235 | ############################################################################### 236 | # 237 | # Configures the identity provisioning mode of the daemon. 238 | # 239 | # Supported modes: 240 | # manual - using an iothub connection string or an X.509 identity certificate 241 | # dps - using dps for provisioning 242 | # external - the device has been provisioned externally. 243 | # Uses an external provisioning endpoint to get device specific information. 244 | # 245 | # Manual settings when using IoT Hub connection string 246 | # deviceConnectionString - Required. The Edge device connection string 247 | # when using SharedAccessKey authentication mode. 248 | # Ex. "HostName=.azure-devices.net;DeviceId=;SharedAccessKey= 249 | # 250 | # Manual authentication settings when using an X.509 identity certificate 251 | # Please create a secret containing 2 items, the Edge device identity X.509 certificate, and the 252 | # Edge device identity private key. Then give the chart the secret name and the item names. 253 | # For example, if a secret is created like this: 254 | # `kubectl create secret generic -n device-namespace edge-authentication --from-file=certs/identity_certificate.pem --from-file=private/identity_key.pem 255 | # The YAML would look like: 256 | # identitySecret: "edge-authentication" 257 | # identityCert: "identity_certificate.pem" 258 | # identityPk: "identity_key.pem" 259 | # 260 | # iothubHostname - Required. The Azure Iot Hub hostname. 261 | # Ex. .azure-devices.net 262 | # deviceId - Required. The Edge device id. 263 | # identitySecret - Required. The secret name. 264 | # identityCert - Required. The secret item name for Edge device identity X.509 certificate. 265 | # identityPk - Required. The secret item name forEdge device identity private key. 266 | # 267 | # DPS Settings 268 | # If configuring for configured for X.509 authentication, please create a secret containing 2 269 | # items, the Edge device identity X.509 certificate, and the Edge device identity private key. 270 | # Then give the chart the secret name and the item names. For example, if a secret is created like 271 | # this: 272 | # `kubectl create secret generic -n device-namespace edge-authentication --from-file=certs/identity_certificate.pem --from-file=private/identity_key.pem 273 | # The YAML would look like: 274 | # identitySecret: "edge-authentication" 275 | # identityCert: "identity_certificate.pem" 276 | # identityPk: "identity_key.pem" 277 | # 278 | # scopeId - Required. Value of a specific DPS instance's ID scope 279 | # registrationId - Required for TPM and symmetric key provisioning flows. 280 | # Optional for X.509 provisioning. Registration ID of a 281 | # specific device in DPS. 282 | # For more information regarding DPS registration ids 283 | # please see https://docs.microsoft.com/en-us/azure/iot-dps/concepts-device#registration-id 284 | # symmetricKey - Optional. This entry should only be specified when 285 | # provisioning devices configured for symmetric key 286 | # attestation. Device specific symmetric key. 287 | # identitySecret - Optional. The secret name. 288 | # identityCert - Optional. The secret item name for Edge device identity X.509 certificate. 289 | # identityPk - Optional. The secret item name forEdge device identity private key. 290 | # 291 | # External Settings 292 | # endpoint - Required. Value of the endpoint used to retrieve device specific 293 | # information such as its IoT hub connection information. 294 | # 295 | # Dynamic Re-provisioning Settings 296 | # dynamicReprovisioning - Optional. A flag to opt-in to the dynamic re-provisioning 297 | # feature. If enabled, IoT Edge on detecting a possible 298 | # device re-provisioning event will shut down the daemon. 299 | # This is so that on the next daemon startup, the device is 300 | # set up with the new provisioning information of the device in 301 | # in IoT Hub. 302 | # For the external provisioning mode specifically, the daemon 303 | # will notify the external provisioning endpoint about the 304 | # re-provisioning event before shutting down. 305 | ############################################################################### 306 | # Manual provisioning configuration using a connection string 307 | provisioning: 308 | source: "manual" 309 | #deviceConnectionString: "" 310 | dynamicReprovisioning: false 311 | 312 | # Manual provisioning configuration using an X.509 identity certificate 313 | # provisioning: 314 | # source: "manual" 315 | # authentication: 316 | # method: "x509" 317 | # iothubHostname: "" 318 | # deviceId: "" 319 | # identitySecret: "" 320 | # identityCert: "" 321 | # identityPk: "" 322 | # dynamicReprovisioning: false 323 | 324 | # DPS symmetric key provisioning configuration 325 | # provisioning: 326 | # source: "dps" 327 | # globalEndpoint: "https://global.azure-devices-provisioning.net" 328 | # scopeId: "{scope_id}" 329 | # attestation: 330 | # method: "symmetric_key" 331 | # registrationId: "{registration_id}" 332 | # symmetricKey: "{symmetric_key}" 333 | # dynamicReprovisioning: false 334 | 335 | # DPS X.509 provisioning configuration 336 | # provisioning: 337 | # source: "dps" 338 | # globalEndpoint: "https://global.azure-devices-provisioning.net" 339 | # scopeId: "{scope_id}" 340 | # attestation: 341 | # method: "x509" 342 | # registrationId: "" 344 | # identityCert: "" 345 | # identityPk: "" 346 | # dynamicReprovisioning: false 347 | 348 | # External provisioning configuration 349 | # provisioning: 350 | # source: "external" 351 | # endpoint: "http://localhost:9999" 352 | # dynamicReprovisioning: false 353 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | appVersion: "1.0" 3 | description: A Helm chart for running Azure IoT Edge on Kubernetes 4 | name: azure-iot-runtime 5 | version: 0.2.11 6 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | 22 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/NOTICE: -------------------------------------------------------------------------------- 1 | This repository includes software from https://github.com/Azure/iotedge/tree/release/1.1-k8s-preview licensed under the MIT License, (the "License") 2 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | Thank you for installing {{ .Chart.Name }}. 2 | 3 | Your release is named {{ .Release.Name }}. 4 | 5 | To learn more about the release, try: 6 | 7 | $ helm status {{ .Release.Name }} 8 | $ helm get {{ .Release.Name }} 9 | 10 | Your resources have been deployed to the namespace {{ include "edge-kubernetes.namespace" . | quote }} -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* vim: set filetype=mustache: */}} 2 | {{/* 3 | Expand the name of the chart. 4 | */}} 5 | {{- define "edge-kubernetes.name" -}} 6 | {{- default .Chart.Name | trunc 63 | trimSuffix "-" -}} 7 | {{- end -}} 8 | 9 | {{/* 10 | Create chart name and version as used by the chart label. 11 | */}} 12 | {{- define "edge-kubernetes.chart" -}} 13 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 14 | {{- end -}} 15 | 16 | {{/* Template for iotedged's configuration YAML. */}} 17 | {{- define "edge-kubernetes.iotedgedconfig" }} 18 | provisioning: 19 | {{- range $key, $val := .Values.provisioning }} 20 | {{- if eq $key "attestation"}} 21 | attestation: 22 | {{- range $atkey, $atval := $val }} 23 | {{- if eq $atkey "identityCert" }} 24 | identity_cert: "file:///etc/edge-attestation/identity_cert" 25 | {{- else if eq $atkey "identityPk" }} 26 | identity_pk: "file:///etc/edge-attestation/identity_pk" 27 | {{- else }} 28 | {{ $atkey | snakecase }}: {{$atval | quote }} 29 | {{- end }} 30 | {{- end }} 31 | {{- else if eq $key "authentication" }} 32 | authentication: 33 | {{- range $aukey, $auval := $val }} 34 | {{- if eq $aukey "identityCert" }} 35 | identity_cert: "file:///etc/edge-authentication/identity_cert" 36 | {{- else if eq $aukey "identityPk" }} 37 | identity_pk: "file:///etc/edge-authentication/identity_pk" 38 | {{- else }} 39 | {{ $aukey | snakecase }}: {{$auval | quote }} 40 | {{- end }} 41 | {{- end }} 42 | {{- else }} 43 | {{ $key | snakecase }}: {{- if or (kindIs "float64" $val) (kindIs "bool" $val) }} {{ $val }} {{- else }} {{ $val | quote }} 44 | {{- end }} 45 | {{- end }} 46 | {{- end }} 47 | {{- with .Values.iotedged.certificates }} 48 | certificates: 49 | {{- if .secret }} 50 | device_ca_cert: "/etc/edgecerts/device_ca_cert" 51 | device_ca_pk: "/etc/edgecerts/device_ca_pk" 52 | trusted_ca_certs: "/etc/edgecerts/trusted_ca_certs" 53 | {{- end }} 54 | {{- if .auto_generated_ca_lifetime_days }} 55 | auto_generated_ca_lifetime_days: {{ .auto_generated_ca_lifetime_days }} 56 | {{- end }} 57 | {{ end }} 58 | agent: 59 | name: "edgeAgent" 60 | type: "docker" 61 | {{- if .Values.edgeAgent.env }} 62 | env: 63 | {{- if .Values.iotedged.data.httpsProxy }} 64 | https_proxy: {{ .Values.iotedged.data.httpsProxy | quote }} 65 | {{- end}} 66 | {{- if .Values.iotedged.data.noProxy }} 67 | no_proxy: {{ .Values.iotedged.data.noProxy | quote }} 68 | {{- end}} 69 | {{- range $envkey, $envval := .Values.edgeAgent.env }} 70 | {{- if eq $envkey "portMappingServiceType"}} 71 | PortMappingServiceType: {{ $envval | quote }} 72 | {{- else if eq $envkey "backupConfigFilePath"}} 73 | BackupConfigFilePath: {{ $envval | quote }} 74 | {{- else if eq $envkey "enableK8sServiceCallTracing"}} 75 | EnableK8sServiceCallTracing: {{ $envval | quote }} 76 | {{- else if eq $envkey "runtimeLogLevel"}} 77 | RuntimeLogLevel: {{ $envval | quote }} 78 | {{- else if eq $envkey "persistentVolumeClaimDefaultSizeInMb"}} 79 | {{- $sizeInMb := $envval }} 80 | PersistentVolumeClaimDefaultSizeInMb: {{- if kindIs "float64" $sizeInMb }} {{ printf "%.0f" $sizeInMb | quote }} {{- else }} {{ $sizeInMb | quote }} {{end}} 81 | {{- else if eq $envkey "upstreamProtocol"}} 82 | UpstreamProtocol: {{ $envval | quote }} 83 | {{- else if eq $envkey "useMountSourceForVolumeName"}} 84 | UseMountSourceForVolumeName: {{ $envval | quote }} 85 | {{- else if eq $envkey "storageClassName"}} 86 | StorageClassName: {{- if (eq "-" $envval) }} "" {{- else }} {{ $envval | quote }} {{- end }} 87 | {{- else if eq $envkey "enableExperimentalFeatures" }} 88 | ExperimentalFeatures__Enabled: {{ $envval | quote }} 89 | {{- else if eq $envkey "enableK8sExtensions" }} 90 | ExperimentalFeatures__EnableK8SExtensions: {{ $envval | quote }} 91 | {{- else if eq $envkey "runAsNonRoot" }} 92 | RunAsNonRoot: {{ $envval | quote }} 93 | {{- else }} 94 | {{ $envkey }}: {{$envval | quote }} 95 | {{- end }} 96 | {{- end }} 97 | {{ else }} 98 | env: {} 99 | {{ end }} 100 | config: 101 | image: "{{ .Values.edgeAgent.image.repository }}:{{ .Values.edgeAgent.image.tag }}" 102 | {{- if .Values.edgeAgent.registryCredentials }} 103 | auth: 104 | username: {{ .Values.edgeAgent.registryCredentials.username | quote }} 105 | password: {{ .Values.edgeAgent.registryCredentials.password | quote }} 106 | serveraddress: {{ .Values.edgeAgent.registryCredentials.serveraddress | quote }} 107 | {{ else }} 108 | auth: {} 109 | {{ end }} 110 | {{- if .Values.maxRetries }} 111 | max_retries: {{ .Values.maxRetries }} 112 | {{- end }} 113 | hostname: {{ .Values.edgeAgent.hostname }} 114 | connect: 115 | management_uri: "https://localhost:{{ .Values.iotedged.ports.management }}" 116 | workload_uri: "https://localhost:{{ .Values.iotedged.ports.workload }}" 117 | listen: 118 | management_uri: "https://0.0.0.0:{{ .Values.iotedged.ports.management }}" 119 | workload_uri: "https://0.0.0.0:{{ .Values.iotedged.ports.workload }}" 120 | homedir: {{ .Values.iotedged.data.targetPath | quote }} 121 | namespace: {{ .Release.Namespace | quote }} 122 | device_hub_selector: "" 123 | config_map_name: "iotedged-agent-config" 124 | config_path: "/etc/edgeAgent" 125 | config_map_volume: "agent-config-volume" 126 | {{- if .Values.edgeAgent.resources }} 127 | resources: 128 | {{ toYaml .Values.edgeAgent.resources | indent 2 }} 129 | {{- end }} 130 | proxy: 131 | image: "{{.Values.iotedgedProxy.image.repository}}:{{.Values.iotedgedProxy.image.tag}}" 132 | image_pull_policy: {{ .Values.iotedgedProxy.image.pullPolicy | quote }} 133 | {{- if .Values.iotedgedProxy.registryCredentials }} 134 | auth: 135 | username: {{ .Values.iotedgedProxy.registryCredentials.username | quote }} 136 | password: {{ .Values.iotedgedProxy.registryCredentials.password | quote }} 137 | serveraddress: {{ .Values.iotedgedProxy.registryCredentials.serveraddress | quote }} 138 | {{ else }} 139 | auth: {} 140 | {{ end }} 141 | config_map_name: "iotedged-proxy-config" 142 | config_path: "/etc/iotedge-proxy" 143 | trust_bundle_config_map_name: "iotedged-proxy-trust-bundle" 144 | trust_bundle_path: "/etc/trust-bundle" 145 | {{- if .Values.iotedgedProxy.resources }} 146 | resources: 147 | {{ toYaml .Values.iotedgedProxy.resources | indent 4 }} 148 | {{- end }} 149 | {{ end }} 150 | 151 | {{/* Template for agent's configuration. */}} 152 | {{- define "edge-kubernetes.agentconfig" }} 153 | AgentConfigPath: "/etc/edgeAgent" 154 | AgentConfigMapName: "iotedged-agent-config" 155 | AgentConfigVolume: "agent-config-volume" 156 | ProxyImage: "{{.Values.iotedgedProxy.image.repository}}:{{.Values.iotedgedProxy.image.tag}}" 157 | ProxyConfigVolume: "config-volume" 158 | ProxyConfigMapName: "iotedged-proxy-config" 159 | ProxyConfigPath: "/etc/iotedge-proxy" 160 | ProxyTrustBundlePath: "/etc/trust-bundle" 161 | ProxyTrustBundleVolume: "trust-bundle-volume" 162 | ProxyTrustBundleConfigMapName: "iotedged-proxy-trust-bundle" 163 | {{- if .Values.iotedgedProxy.resources }} 164 | ProxyResourceRequests: 165 | {{ toYaml .Values.iotedgedProxy.resources | indent 2 }} 166 | {{- end }} 167 | {{- if .Values.edgeAgent.resources }} 168 | AgentResourceRequests: 169 | {{ toYaml .Values.edgeAgent.resources | indent 2 }} 170 | {{- end }} 171 | {{ end }} 172 | 173 | {{/* Template for rendering registry credentials. */}} 174 | {{- define "edge-kubernetes.regcreds" }} 175 | auths: 176 | {{- range $key, $val := .Values.registryCredentials }} 177 | {{ $key | quote }}: 178 | auth: {{ printf "%s:%s" $val.username $val.password | b64enc | quote }} 179 | {{- end }} 180 | {{- end }} 181 | 182 | {{/* 183 | Parse the device ID from connection string. 184 | */}} 185 | {{- define "edge-kubernetes.deviceid" -}} 186 | {{- regexFind "DeviceId=[^;]+" .Values.deviceConnectionString | regexFind "=.+" | substr 1 -1 | lower -}} 187 | {{- end -}} 188 | 189 | {{/* 190 | Parse the host name from connection string. 191 | */}} 192 | {{- define "edge-kubernetes.hostname" -}} 193 | {{- regexFind "HostName=[^;]+" .Values.deviceConnectionString | regexFind "=.+" | substr 1 -1 | lower -}} 194 | {{- end -}} 195 | 196 | {{/* 197 | Parse the hub name from connection string. 198 | */}} 199 | {{- define "edge-kubernetes.hubname" -}} 200 | {{- include "edge-kubernetes.hostname" . | splitList "." | first | lower -}} 201 | {{- end -}} 202 | 203 | {{/* 204 | Generate namespace from release namespace parameter. 205 | */}} 206 | {{- define "edge-kubernetes.namespace" -}} 207 | {{ .Release.Namespace }} 208 | {{- end -}} 209 | 210 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/templates/crd.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apiextensions.k8s.io/v1 2 | kind: CustomResourceDefinition 3 | metadata: 4 | name: edgedeployments.microsoft.azure.devices.edge 5 | spec: 6 | group: microsoft.azure.devices.edge 7 | names: 8 | kind: EdgeDeployment 9 | listKind: EdgeDeploymentList 10 | plural: edgedeployments 11 | singular: edgedeployment 12 | scope: Namespaced 13 | versions: 14 | - name: v1 15 | storage: true 16 | served: true 17 | subresources: 18 | status: {} 19 | schema: 20 | openAPIV3Schema: 21 | type: object 22 | properties: 23 | spec: 24 | type: array 25 | items: 26 | type: object 27 | properties: 28 | name: 29 | type: string 30 | version: 31 | type: string 32 | type: 33 | type: string 34 | status: 35 | type: string 36 | restartPolicy: 37 | type: string 38 | imagePullPolicy: 39 | type: string 40 | settings: 41 | type: string 42 | env: 43 | type: object 44 | x-kubernetes-preserve-unknown-fields: true 45 | owner: 46 | type: object 47 | x-kubernetes-preserve-unknown-fields: true 48 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/templates/edge-rbac.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: iotedged 6 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 7 | labels: 8 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 9 | app.kubernetes.io/instance: {{.Release.Name | quote }} 10 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 11 | ... 12 | --- 13 | apiVersion: rbac.authorization.k8s.io/v1 14 | kind: ClusterRoleBinding 15 | metadata: 16 | name: iotedge:{{ .Release.Name }}:auth-delegator 17 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 18 | labels: 19 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 20 | app.kubernetes.io/instance: {{.Release.Name | quote }} 21 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 22 | roleRef: 23 | apiGroup: rbac.authorization.k8s.io 24 | kind: ClusterRole 25 | name: system:auth-delegator 26 | subjects: 27 | - kind: ServiceAccount 28 | name: iotedged 29 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 30 | ... 31 | --- 32 | {{- if .Values.iotedged.data.enableGetNodesRBAC }} 33 | apiVersion: rbac.authorization.k8s.io/v1 34 | kind: ClusterRoleBinding 35 | metadata: 36 | name: iotedge:{{ .Release.Name }}:node-observer 37 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 38 | labels: 39 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 40 | app.kubernetes.io/instance: {{.Release.Name | quote }} 41 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 42 | roleRef: 43 | apiGroup: rbac.authorization.k8s.io 44 | kind: ClusterRole 45 | name: iotedge:{{ .Release.Name }}:node-observer 46 | subjects: 47 | - kind: ServiceAccount 48 | name: iotedged 49 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 50 | ... 51 | {{ end }} 52 | --- 53 | apiVersion: rbac.authorization.k8s.io/v1 54 | kind: RoleBinding 55 | metadata: 56 | name: iotedged 57 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 58 | labels: 59 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 60 | app.kubernetes.io/instance: {{.Release.Name | quote }} 61 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 62 | roleRef: 63 | apiGroup: rbac.authorization.k8s.io 64 | kind: Role 65 | name: iotedged 66 | subjects: 67 | - kind: ServiceAccount 68 | name: iotedged 69 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 70 | ... 71 | --- 72 | {{- if .Values.iotedged.data.enableGetNodesRBAC }} 73 | apiVersion: rbac.authorization.k8s.io/v1 74 | kind: ClusterRole 75 | metadata: 76 | name: iotedge:{{ .Release.Name }}:node-observer 77 | labels: 78 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 79 | app.kubernetes.io/instance: {{.Release.Name | quote }} 80 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 81 | rules: 82 | - apiGroups: [""] 83 | resources: ["nodes"] 84 | verbs: ["list", "watch", "get"] 85 | ... 86 | {{ end }} 87 | --- 88 | apiVersion: rbac.authorization.k8s.io/v1 89 | kind: Role 90 | metadata: 91 | name: iotedged 92 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 93 | labels: 94 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 95 | app.kubernetes.io/instance: {{.Release.Name | quote }} 96 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 97 | rules: 98 | - apiGroups: [""] 99 | resources: ["nodes"] 100 | verbs: ["list"] 101 | - apiGroups: [""] 102 | resources: ["pods", "pods/log"] 103 | verbs: ["list", "watch"] 104 | - apiGroups: [""] 105 | resources: ["services"] 106 | verbs: ["list", "create", "delete", "update"] 107 | - apiGroups: ["apps"] 108 | resources: ["deployments"] 109 | verbs: ["list", "get", "create", "delete", "update"] 110 | - apiGroups: [""] 111 | resources: ["secrets", "serviceaccounts", "configmaps"] 112 | verbs: ["list", "get", "create", "update", "delete"] 113 | - apiGroups: [""] 114 | resources: ["persistentvolumeclaims"] 115 | verbs: ["list", "create", "update", "delete"] 116 | - apiGroups: ["rbac.authorization.k8s.io"] 117 | resources: ["rolebindings"] 118 | verbs: ["list", "create", "delete", "update"] 119 | - apiGroups: ["microsoft.azure.devices.edge"] 120 | resources: ["edgedeployments"] 121 | verbs: ["list", "get", "create", "update", "delete", "watch"] 122 | - apiGroups: ["microsoft.azure.devices.edge"] 123 | resources: ["edgedeployments/status"] 124 | verbs: ["list", "get", "create", "update", "delete"] 125 | ... 126 | --- 127 | apiVersion: rbac.authorization.k8s.io/v1 128 | kind: Role 129 | metadata: 130 | name: edgeagent 131 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 132 | labels: 133 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 134 | app.kubernetes.io/instance: {{.Release.Name | quote }} 135 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 136 | rules: 137 | - apiGroups: [""] 138 | resources: ["pods", "pods/log"] 139 | verbs: ["list", "watch"] 140 | - apiGroups: [""] 141 | resources: ["services"] 142 | verbs: ["list", "create", "delete", "update"] 143 | - apiGroups: ["apps"] 144 | resources: ["deployments"] 145 | verbs: ["list", "get", "create", "delete", "update"] 146 | - apiGroups: [""] 147 | resources: ["secrets", "serviceaccounts"] 148 | verbs: ["list", "get", "create", "update", "delete"] 149 | - apiGroups: [""] 150 | resources: ["persistentvolumeclaims"] 151 | verbs: ["list", "create", "update", "delete"] 152 | - apiGroups: ["microsoft.azure.devices.edge"] 153 | resources: ["edgedeployments"] 154 | verbs: ["list", "get", "create", "update", "delete", "watch"] 155 | - apiGroups: ["microsoft.azure.devices.edge"] 156 | resources: ["edgedeployments/status"] 157 | verbs: ["list", "get", "create", "update", "delete"] 158 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/templates/iotedged-agent-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: iotedged-agent-config 5 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 6 | labels: 7 | app.kubernetes.io/name: iotedged-agent-config 8 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 9 | app.kubernetes.io/instance: {{ .Release.Name }} 10 | app.kubernetes.io/managed-by: {{ .Release.Service }} 11 | data: 12 | appsettings_k8s.json: |- 13 | {{ include "edge-kubernetes.agentconfig" . | fromYaml | toJson }} 14 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/templates/iotedged-config-secret.yaml: -------------------------------------------------------------------------------- 1 | {{/* Render the config.yaml file as a secret for iotedged. */}} 2 | --- 3 | apiVersion: v1 4 | kind: Secret 5 | metadata: 6 | name: iotedged-config 7 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 8 | labels: 9 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 10 | app.kubernetes.io/instance: {{.Release.Name | quote }} 11 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 12 | type: Opaque 13 | data: 14 | config.yaml: |- 15 | {{ include "edge-kubernetes.iotedgedconfig" . | b64enc }} 16 | ... 17 | {{/* Render all the registry credentials as secrets. */}} 18 | {{- if .Values.registryCredentials }} 19 | --- 20 | apiVersion: v1 21 | kind: Secret 22 | metadata: 23 | name: regcreds 24 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 25 | labels: 26 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 27 | app.kubernetes.io/instance: {{.Release.Name | quote }} 28 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 29 | type: kubernetes.io/dockerconfigjson 30 | data: 31 | {{- /* 32 | The "fromYaml | toJson" pipeline below is a hack to convert the YAML string 33 | returned by the "regcreds" template into a JSON. Without first converting it 34 | to YAML (i.e. a Go Map object), "toJson" just JSONifies the raw YAML string. 35 | Generating a JSON directly from the "regcreds" template also doesn't work 36 | because we are iterating over a map from ".Values.registryCredentials" 37 | using the "range" action and it doesn't provide a way to detect if we are 38 | at the end of the iteration so we can omit the trailing comma for the last 39 | entry. 40 | */}} 41 | .dockerconfigjson: |- 42 | {{ include "edge-kubernetes.regcreds" . | fromYaml | toJson | b64enc }} 43 | ... 44 | {{ end }} 45 | --- 46 | apiVersion: v1 47 | kind: Secret 48 | metadata: 49 | name: edge-authentication 50 | labels: 51 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 52 | app.kubernetes.io/instance: {{.Release.Name | quote }} 53 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 54 | type: Opaque 55 | data: 56 | {{ (.Files.Glob "config/*").AsConfig | indent 4 }} 57 | 58 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/templates/iotedged-deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: iotedged 5 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 6 | labels: 7 | app.kubernetes.io/name: {{ include "edge-kubernetes.name" . }}-iotedged 8 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 9 | app.kubernetes.io/instance: {{ .Release.Name }} 10 | app.kubernetes.io/managed-by: {{ .Release.Service }} 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | app.kubernetes.io/name: {{ include "edge-kubernetes.name" . }}-iotedged 16 | app.kubernetes.io/instance: {{ .Release.Name }} 17 | template: 18 | metadata: 19 | labels: 20 | app.kubernetes.io/name: {{ include "edge-kubernetes.name" . }}-iotedged 21 | app.kubernetes.io/instance: {{ .Release.Name }} 22 | spec: 23 | containers: 24 | - name: iotedged 25 | image: "{{ .Values.iotedged.image.repository }}:{{ .Values.iotedged.image.tag }}" 26 | imagePullPolicy: {{ .Values.iotedged.image.pullPolicy }} 27 | command: ["/app/iotedged"] 28 | args: ["-c", "/etc/iotedged/config.yaml"] 29 | {{- if .Values.iotedged.data.resources }} 30 | resources: 31 | {{ toYaml .Values.iotedged.data.resources | indent 12 }} 32 | {{- end }} 33 | env: 34 | - name: "IOTEDGE_LOG" 35 | value: "info" 36 | {{- if .Values.iotedged.data.httpsProxy }} 37 | - name: "https_proxy" 38 | value: {{ .Values.iotedged.data.httpsProxy | quote}} 39 | {{- end}} 40 | {{- if .Values.iotedged.data.noProxy }} 41 | - name: "no_proxy" 42 | value: {{ .Values.iotedged.data.noProxy | quote}} 43 | {{- end}} 44 | volumeMounts: 45 | - name: config 46 | mountPath: "/etc/iotedged" 47 | readOnly: true 48 | - name: edge-home 49 | mountPath: {{ .Values.iotedged.data.targetPath | quote }} 50 | {{- with .Values.iotedged.certificates }} 51 | {{- if .secret }} 52 | - name: edge-certs 53 | mountPath: "/etc/edgecerts" 54 | readOnly: true 55 | {{- end}} 56 | {{- end}} 57 | {{- if .Values.iotedged.data.useHostTrust }} 58 | - name: ca-edge-host-trust 59 | mountPath: "/etc/ssl/certs" 60 | {{- end }} 61 | {{- with .Values.provisioning.authentication }} 62 | {{- if .identitySecret }} 63 | - name: edge-authentication 64 | mountPath: "/etc/edge-authentication" 65 | readOnly: true 66 | {{- end}} 67 | {{- end}} 68 | {{- with .Values.provisioning.attestation }} 69 | {{- if .identitySecret }} 70 | - name: edge-attestation 71 | mountPath: "/etc/edge-attestation" 72 | readOnly: true 73 | {{- end}} 74 | {{- end}} 75 | ports: 76 | - name: management 77 | containerPort: {{ .Values.iotedged.ports.management }} 78 | protocol: TCP 79 | - name: workload 80 | containerPort: {{ .Values.iotedged.ports.workload }} 81 | protocol: TCP 82 | livenessProbe: 83 | httpGet: 84 | scheme: HTTPS 85 | path: "/systeminfo?api-version={{ .Values.iotedged.apiVersion }}" 86 | port: {{ .Values.iotedged.ports.management }} 87 | readinessProbe: 88 | httpGet: 89 | scheme: HTTPS 90 | path: "/systeminfo?api-version={{ .Values.iotedged.apiVersion }}" 91 | port: {{ .Values.iotedged.ports.management }} 92 | serviceAccount: "iotedged" 93 | {{- /* Render image pull secrets if they have been provided. */ -}} 94 | {{- if .Values.registryCredentials }} 95 | imagePullSecrets: 96 | - name: regcreds 97 | {{ end }} 98 | securityContext: 99 | runAsNonRoot: true 100 | runAsUser: 1000 101 | {{- if .Values.iotedged.fsGroup }} 102 | fsGroup: {{ .Values.iotedged.fsGroup }} 103 | {{ end }} 104 | {{- if .Values.iotedged.nodeSelector }} 105 | nodeSelector: 106 | {{ toYaml .Values.iotedged.nodeSelector | indent 8 }} 107 | {{- end }} 108 | volumes: 109 | - name: config 110 | secret: 111 | secretName: iotedged-config 112 | {{- with .Values.provisioning.authentication }} 113 | {{- if .identitySecret }} 114 | {{- /* 115 | NOTE: This sets up iotedged with a volume "/etc/edge-authentication" populated with authentication certs. 116 | */}} 117 | - name: edge-authentication 118 | secret: 119 | secretName: {{ .identitySecret }} 120 | items: 121 | - key: {{ .identity_cert_name }} 122 | path: identity_cert 123 | - key: {{ .identity_key_name }} 124 | path: identity_pk 125 | {{- end}} 126 | {{- end}} 127 | {{- with .Values.provisioning.attestation }} 128 | {{- if .identitySecret }} 129 | {{- /* 130 | NOTE: This sets up iotedged with a volume "/etc/edge-attestation" populated with the attestation certs. 131 | */}} 132 | - name: edge-attestation 133 | secret: 134 | secretName: {{ .identitySecret }} 135 | items: 136 | - key: {{ .identity_cert_name }} 137 | path: identity_cert 138 | - key: {{ .identity_key_name }} 139 | path: identity_pk 140 | {{- end}} 141 | {{- end}} 142 | {{- if .Values.iotedged.data.useHostTrust }} 143 | - name: ca-edge-host-trust 144 | hostPath: 145 | path: /etc/ssl/certs 146 | type: Directory 147 | {{- end}} 148 | {{- with .Values.iotedged.certificates }} 149 | {{- if .secret }} 150 | {{- /* 151 | NOTE: This sets up iotedged with a volume "/etc/edgecerts" populated with the given CA certs. 152 | */}} 153 | - name: edge-certs 154 | secret: 155 | secretName: {{ .secret }} 156 | items: 157 | - key: {{ .device_ca_cert | default "device_ca_cert" }} 158 | path: device_ca_cert 159 | - key: {{ .device_ca_pk | default "device_ca_pk" }} 160 | path: device_ca_pk 161 | - key: {{ .trusted_ca_certs | default "trusted_ca_certs" }} 162 | path: trusted_ca_certs 163 | 164 | {{- end}} 165 | {{- else}} 166 | {{- /* 167 | NOTE: This sets up iotedged in the "quickstart" mode which is NOT meant 168 | for production use. For PoCs though, its wonderful! For production, this 169 | volume should probably be populated with proper CA certs. 170 | */}} 171 | {{- end}} 172 | - name: edge-home 173 | {{- if .Values.iotedged.data.persistentVolumeClaim }} 174 | persistentVolumeClaim: 175 | claimName: {{ .Values.iotedged.data.persistentVolumeClaim.name }} 176 | readOnly: false 177 | {{ else }} 178 | emptyDir: {} 179 | {{ end -}} 180 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/templates/iotedged-proxy-config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: iotedged-proxy-config 5 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 6 | labels: 7 | app.kubernetes.io/name: iotedged-proxy-config 8 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 9 | app.kubernetes.io/instance: {{ .Release.Name }} 10 | app.kubernetes.io/managed-by: {{ .Release.Service }} 11 | data: 12 | config.yaml: |- 13 | services: 14 | - name: "management" 15 | entrypoint: "http://localhost:{{ .Values.iotedged.ports.management }}" 16 | backend: "https://{{ .Values.iotedged.service.name }}:{{ .Values.iotedged.ports.management }}" 17 | certificate: "/etc/trust-bundle/trust_bundle.pem" 18 | 19 | - name: "workload" 20 | entrypoint: "http://localhost:{{ .Values.iotedged.ports.workload }}" 21 | backend: "https://{{ .Values.iotedged.service.name }}:{{ .Values.iotedged.ports.workload }}" 22 | certificate: "/etc/trust-bundle/trust_bundle.pem" 23 | 24 | api: 25 | entrypoint: "http://localhost:8080" 26 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/templates/iotedged-pvc.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.iotedged.data.persistentVolumeClaim }} 2 | {{- if and (.Values.iotedged.data.persistentVolumeClaim.size) (.Values.iotedged.data.persistentVolumeClaim.storageClassName) }} 3 | apiVersion: v1 4 | kind: PersistentVolumeClaim 5 | metadata: 6 | name: {{ .Values.iotedged.data.persistentVolumeClaim.name | quote }} 7 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 8 | labels: 9 | app.kubernetes.io/managed-by: {{.Release.Service | quote }} 10 | app.kubernetes.io/instance: {{.Release.Name | quote }} 11 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 12 | spec: 13 | resources: 14 | requests: 15 | storage: {{ .Values.iotedged.data.persistentVolumeClaim.size }} 16 | accessModes: 17 | - ReadWriteOnce 18 | storageClassName: {{ .Values.iotedged.data.persistentVolumeClaim.storageClassName | quote }} 19 | {{- if .Values.iotedged.data.persistentVolumeClaim.volumeName }} 20 | volumeName: {{ .Values.iotedged.data.persistentVolumeClaim.volumeName | quote }} 21 | {{- end }} 22 | {{- end }} 23 | {{- end }} 24 | -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/templates/iotedged-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ .Values.iotedged.service.name | quote }} 5 | namespace: {{ include "edge-kubernetes.namespace" . | quote }} 6 | labels: 7 | app.kubernetes.io/name: {{ include "edge-kubernetes.name" . }}-iotedged 8 | helm.sh/chart: {{ include "edge-kubernetes.chart" . }} 9 | app.kubernetes.io/instance: {{ .Release.Name }} 10 | app.kubernetes.io/managed-by: {{ .Release.Service }} 11 | spec: 12 | selector: 13 | app.kubernetes.io/name: {{ include "edge-kubernetes.name" . }}-iotedged 14 | app.kubernetes.io/instance: {{ .Release.Name }} 15 | type: {{ .Values.iotedged.service.type | quote }} 16 | ports: 17 | - name: management 18 | port: {{ .Values.iotedged.ports.management }} 19 | targetPort: management 20 | - name: workload 21 | port: {{ .Values.iotedged.ports.workload }} 22 | targetPort: workload -------------------------------------------------------------------------------- /azure-iot/azure-iot-runtime/values.yaml: -------------------------------------------------------------------------------- 1 | # iotedged configuration 2 | iotedged: 3 | image: 4 | repository: azureiotedge/azureiotedge-iotedged 5 | tag: 0.1.0-beta15 6 | pullPolicy: Always 7 | nodeSelector: {} 8 | # Volumes which support ownership management are modified to be owned and 9 | # writable by the GID specified in fsGroup. 10 | # fsGroup: 2000 11 | service: 12 | name: iotedged 13 | type: ClusterIP 14 | apiVersion: '2019-01-30' 15 | # TCP ports on which iotedged should listen 16 | ports: 17 | management: 35000 18 | workload: 35001 19 | data: 20 | enableGetNodesRBAC: true 21 | targetPath: /var/lib/iotedge 22 | # set iotedged log level. 23 | runtimeLogLevel: "info" 24 | # Normally the iotedged is running as a host process, and has access to 25 | # the host's trusted CA certificates. Use this options to allow the 26 | # iotedged deployment to use the host OS's /etc/ssl/certs 27 | # useHostTrust: false 28 | # 29 | # In order to benefit from HA, at a minimum the data location for iotedged 30 | # should be backed by a persistent volume. 31 | # User may create a PersistentVolumeClaim and provide the name only here. Alternatively. 32 | # user may set persistent volume claim details below. In that case the charts will define a PVC. 33 | # If nothing is provided then the iotedged pod will default to using an 34 | # "emptyDir" volume which is not recommended because emptyDir storage is tied to the Pod's 35 | # lifetime and the runtime will fail if iotedged is restarted. 36 | # 37 | # persistentVolumeClaim: 38 | # # name is required for iotedged to use persistence. 39 | # name: 40 | # # Set the following fields if you would like the chart to create a PVC 41 | # storageClassName: 42 | # volumeName: 43 | # size: 100Mi 44 | # 45 | ############################################################################### 46 | # Proxy settings 47 | ############################################################################### 48 | # Set the following if an HTTPS proxy is needed 49 | # httpsProxy: "" 50 | # noProxy: "" 51 | ############################################################################### 52 | # Watchdog settings 53 | ############################################################################### 54 | # 55 | # The IoT edge daemon has a watchdog that periodically checks the health of the 56 | # Edge Agent module and restarts it if it's down. 57 | # 58 | # maxRetries - Configures the number of retry attempts that the IoT edge daemon 59 | # should make for failed operations before failing with a fatal error. 60 | # 61 | # If this configuration is not specified, the daemon keeps retrying 62 | # on errors and doesn't fail fatally. 63 | # 64 | # On a fatal failure, the daemon returns an exit code which 65 | # signifies the kind of error encountered. Currently, the following 66 | # error codes are returned by the daemon - 67 | # 68 | # 150 - Invalid Device ID specified. 69 | # 151 - Invalid IoT hub configuration. 70 | # 152 - Invalid SAS token used to call IoT hub. 71 | # This could signal an invalid SAS key. 72 | # 1 - All other errors. 73 | ############################################################################### 74 | # maxRetries: 2 75 | ############################################################################### 76 | # Resource limit settings 77 | ############################################################################### 78 | # 79 | # We want QoS to be "Guaranteed" so we are setting resource requests and limits 80 | # to equal values. Values can be adjusted, or may be set to null to remove. 81 | # iotedged: 82 | # Values set here will apply directly to iotedged deployment. 83 | # Proxy: 84 | # Values set in iotedgedProxy section will apply to all proxy containers in deployment. 85 | # Agent: 86 | # Values set in agent section will apply to agent as the bootstrap values. 87 | # It may be overwritten in the edge deployment on the IoT Hub via $edgeAgent's 88 | # createOptions. 89 | # modules: 90 | # All module container resources should be set through edge deployment on the 91 | # IoT Hub via module's createOptions 92 | ############################################################################### 93 | resources: 94 | requests: 95 | memory: "100Mi" 96 | cpu: "100m" 97 | limits: 98 | memory: "100Mi" 99 | cpu: "100m" 100 | 101 | ############################################################################### 102 | # Certificate settings 103 | ############################################################################### 104 | # 105 | # Configures the certificates required to operate the IoT Edge 106 | # runtime as a gateway which enables external leaf devices to securely 107 | # communicate with the Edge Hub. If not specified, the required certificates 108 | # are auto generated for quick start scenarios which are not intended for 109 | # production environments. 110 | # 111 | # Please create a secret containing 3 items, the Device CA cert, the Device CA private key, and 112 | # the root CA. Then give the chart the secret name and the item names. For example, if a secret 113 | # is created like this: 114 | # `kubectl create secret generic -n device-namespace edge-certs --from-file=certs/iot-edge-device-ca-MyEdgeDeviceCA-full-chain.cert.pem --from-file=private/iot-edge-device-ca-MyEdgeDeviceCA.key.pem --from-file=certs/azure-iot-test-only.root.ca.cert.pem` 115 | # The YAML would look like: 116 | # certificates: 117 | # secret: "edge-certs" 118 | # device_ca_cert: "iot-edge-device-ca-MyEdgeDeviceCA-full-chain.cert.pem" 119 | # device_ca_pk: "iot-edge-device-ca-MyEdgeDeviceCA.key.pem" 120 | # trusted_ca_certs: "azure-iot-test-only.root.ca.cert.pem" 121 | # 122 | # certificates: 123 | # secret: "" 124 | # device_ca_cert: "" 125 | # device_ca_pk: "" 126 | # trusted_ca_certs: "" 127 | # auto_generated_ca_lifetime_days: 128 | 129 | # module to iotedged proxy sidecar settings. 130 | # Available Settings: 131 | # image: 132 | # repository: 133 | # tag: 134 | # pullPolicy: 135 | # registryCredentials: 136 | # username: 137 | # password: 138 | # serveraddress: 139 | # resources: (Set to null to remove.) 140 | 141 | iotedgedProxy: 142 | image: 143 | repository: azureiotedge/azureiotedge-proxy 144 | tag: 0.1.0-beta15 145 | pullPolicy: Always 146 | resources: 147 | requests: 148 | memory: "25Mi" 149 | cpu: "5m" 150 | limits: 151 | memory: "25Mi" 152 | cpu: "5m" 153 | 154 | 155 | # Edge Agent image configuration 156 | # Settings: 157 | # containerName - name of the edge agent module. Expected to be "edgeAgent". 158 | # image - Image tag and image pull policy 159 | # resources - cpu and memory limit may be set here for bootstrap agent. 160 | # (Set to null to remove resource requests.) 161 | # env - Any environment variable that needs to be set for edge agent module. 162 | # Some environment variables affect how Edge Agent creates modules in the 163 | # cluster see the descriptions below. 164 | edgeAgent: 165 | containerName: edgeagent 166 | image: 167 | repository: azureiotedge/azureiotedge-agent 168 | tag: 0.1.0-beta15 169 | pullPolicy: Always 170 | hostname: "localhost" 171 | resources: 172 | requests: 173 | memory: "200Mi" 174 | cpu: "50m" 175 | limits: 176 | memory: "200Mi" 177 | cpu: "50m" 178 | env: 179 | authScheme: 'sasToken' 180 | # Set this to one of "LoadBalancer", "NodePort", or "ClusterIP" to tell the 181 | # IoT Edge runtime how you want to expose mapped ports as Services. 182 | portMappingServiceType: 'ClusterIP' 183 | 184 | # Set the location of the backup configuration file. 185 | backupConfigFilePath: '/tmp/backup.json' 186 | 187 | # Set this to false if you want to turn off verbose k8s call tracing 188 | enableK8sServiceCallTracing: false 189 | 190 | # Configure edge agent log verbosity 191 | runtimeLogLevel: 'info' 192 | 193 | # Set this to set the upstream protocol for edgeAgent (default: Amqp with AmpqWs as fallback) 194 | # upstreamProtocol: 'AmqpWs' 195 | 196 | # Configure the default claim size to use (in megabytes) when creating PVCs. 197 | # persistentVolumeClaimDefaultSizeInMb: "" 198 | 199 | # Set this as guidance for converting Docker Volume mounts to Persistent Volume Claims. 200 | # Set to true to tell the runtime to use the Volume mount source (mount.Source) as the 201 | # Persistent volume name (volumeName) in the PVC 202 | useMountSourceForVolumeName: false 203 | 204 | # Set this to the name of a storage class name if you wish the volumes that 205 | # back persistent storage in modules to use dynamically provisioned PVCs. 206 | # If you wish this to be an empty string then you'll need to use the string 207 | # literal "-" in liue of an empty string. 208 | # storageClassName: "" 209 | 210 | # Set this to true if you wish to turn on experimental features support. Please see 211 | # https://github.com/Azure/iotedge/blob/master/kubernetes/doc/create-options.md to 212 | # find more information about experimental create options feature. 213 | enableExperimentalFeatures: true 214 | 215 | # Create options extensions for Kubernetes 216 | # The feature allows the user to extend a module's create options with some Kubernetes primitives. 217 | # To activate this experimental feature, both "enableExperimentalFeatures" and "enableK8sExtensions" 218 | # must be set to "true". 219 | enableK8sExtensions: true 220 | 221 | # Enables RQT data for IoT Edge Agent (disabled until metadata is finalized) 222 | sendRuntimeQualityTelemetry: false 223 | 224 | # Sets timeout for operators running in Agent. Currently set to 3 minutes to guarantee correct 225 | # operation in all clusters. 226 | # AgentOperatorTimeoutSeconds: 180 227 | 228 | # Configure default pod security context rule. If set true, it will allow kubernetes to run only non-root containers 229 | # under the user with uid(1000). 230 | # false dy default. 231 | # runAsNonRoot: false 232 | 233 | # If an environment variables is required and not defined above, they may be added as needed. 234 | # ANOTHER_ENV_VAR: "another env value" 235 | 236 | # Optional registry credentials for module images 237 | # registryCredentials: 238 | # : 239 | # username: '' 240 | # password: '' 241 | 242 | ############################################################################### 243 | # Provisioning mode and settings 244 | ############################################################################### 245 | # 246 | # Configures the identity provisioning mode of the daemon. 247 | # 248 | # Supported modes: 249 | # manual - using an iothub connection string or an X.509 identity certificate 250 | # dps - using dps for provisioning 251 | # external - the device has been provisioned externally. 252 | # Uses an external provisioning endpoint to get device specific information. 253 | # 254 | # Manual settings when using IoT Hub connection string 255 | # deviceConnectionString - Required. The Edge device connection string 256 | # when using SharedAccessKey authentication mode. 257 | # Ex. "HostName=.azure-devices.net;DeviceId=;SharedAccessKey= 258 | # 259 | # Manual authentication settings when using an X.509 identity certificate 260 | # Please create a secret containing 2 items, the Edge device identity X.509 certificate, and the 261 | # Edge device identity private key. Then give the chart the secret name and the item names. 262 | # For example, if a secret is created like this: 263 | # `kubectl create secret generic -n device-namespace edge-authentication --from-file=certs/identity_certificate.pem --from-file=private/identity_key.pem 264 | # The YAML would look like: 265 | # identitySecret: "edge-authentication" 266 | # identityCert: "identity_certificate.pem" 267 | # identityPk: "identity_key.pem" 268 | # 269 | # iothubHostname - Required. The Azure Iot Hub hostname. 270 | # Ex. .azure-devices.net 271 | # deviceId - Required. The Edge device id. 272 | # identitySecret - Required. The secret name. 273 | # identityCert - Required. The secret item name for Edge device identity X.509 certificate. 274 | # identityPk - Required. The secret item name forEdge device identity private key. 275 | # 276 | # DPS Settings 277 | # If configuring for configured for X.509 authentication, please create a secret containing 2 278 | # items, the Edge device identity X.509 certificate, and the Edge device identity private key. 279 | # Then give the chart the secret name and the item names. For example, if a secret is created like 280 | # this: 281 | # `kubectl create secret generic -n device-namespace edge-authentication --from-file=certs/identity_certificate.pem --from-file=private/identity_key.pem 282 | # The YAML would look like: 283 | # identitySecret: "edge-authentication" 284 | # identityCert: "identity_certificate.pem" 285 | # identityPk: "identity_key.pem" 286 | # 287 | # scopeId - Required. Value of a specific DPS instance's ID scope 288 | # registrationId - Required for TPM and symmetric key provisioning flows. 289 | # Optional for X.509 provisioning. Registration ID of a 290 | # specific device in DPS. 291 | # For more information regarding DPS registration ids 292 | # please see https://docs.microsoft.com/en-us/azure/iot-dps/concepts-device#registration-id 293 | # symmetricKey - Optional. This entry should only be specified when 294 | # provisioning devices configured for symmetric key 295 | # attestation. Device specific symmetric key. 296 | # identitySecret - Optional. The secret name. 297 | # identityCert - Optional. The secret item name for Edge device identity X.509 certificate. 298 | # identityPk - Optional. The secret item name forEdge device identity private key. 299 | # 300 | # External Settings 301 | # endpoint - Required. Value of the endpoint used to retrieve device specific 302 | # information such as its IoT hub connection information. 303 | # 304 | # Dynamic Re-provisioning Settings 305 | # dynamicReprovisioning - Optional. A flag to opt-in to the dynamic re-provisioning 306 | # feature. If enabled, IoT Edge on detecting a possible 307 | # device re-provisioning event will shut down the daemon. 308 | # This is so that on the next daemon startup, the device is 309 | # set up with the new provisioning information of the device in 310 | # in IoT Hub. 311 | # For the external provisioning mode specifically, the daemon 312 | # will notify the external provisioning endpoint about the 313 | # re-provisioning event before shutting down. 314 | ############################################################################### 315 | # Manual provisioning configuration using a connection string 316 | provisioning: 317 | source: "manual" 318 | #deviceConnectionString: "" 319 | dynamicReprovisioning: false 320 | 321 | # Manual provisioning configuration using an X.509 identity certificate 322 | # provisioning: 323 | # source: "manual" 324 | # authentication: 325 | # method: "x509" 326 | # iothubHostname: "" 327 | # deviceId: "" 328 | # identitySecret: "" 329 | # identityCert: "" 330 | # identityPk: "" 331 | # dynamicReprovisioning: false 332 | 333 | # DPS symmetric key provisioning configuration 334 | # provisioning: 335 | # source: "dps" 336 | # globalEndpoint: "https://global.azure-devices-provisioning.net" 337 | # scopeId: "{scope_id}" 338 | # attestation: 339 | # method: "symmetric_key" 340 | # registrationId: "{registration_id}" 341 | # symmetricKey: "{symmetric_key}" 342 | # dynamicReprovisioning: false 343 | 344 | 345 | #provisioning: 346 | # source: "dps" 347 | # globalEndpoint: "https://global.azure-devices-provisioning.net" 348 | # scopeId: "" 349 | # attestation: 350 | # method: "x509" 351 | # identitySecret: "edge-authentication" 352 | # identity_cert: "file:///etc/edge-attestation/identity_cert" 353 | # identity_pk: "file:///etc/edge-attestation/identity_pk" 354 | # identity_cert_name: sampleDevice01_cert.pem 355 | # identity_key_name: sampleDevice01_key.pem 356 | # dynamicReprovisioning: false 357 | 358 | 359 | # DPS X.509 provisioning configuration 360 | # provisioning: 361 | # source: "dps" 362 | # globalEndpoint: "https://global.azure-devices-provisioning.net" 363 | # scopeId: "{scope_id}" 364 | # attestation: 365 | # method: "x509" 366 | # registrationId: "" 368 | # identityCert: "" 369 | # identityPk: "" 370 | # dynamicReprovisioning: false 371 | 372 | # External provisioning configuration 373 | # provisioning: 374 | # source: "external" 375 | # endpoint: "http://localhost:9999" 376 | # dynamicReprovisioning: false 377 | -------------------------------------------------------------------------------- /azure-iot/azure-video-analytics-demo-0.1.5.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NVIDIA/fleet-command/a7b4a9dfa438216e87f600a3eeb0637c495d4312/azure-iot/azure-video-analytics-demo-0.1.5.tgz -------------------------------------------------------------------------------- /azure-iot/readme.md: -------------------------------------------------------------------------------- 1 | 2 | # Fleet Command Integration with Azure IoT 3 | 4 | This repository provides the two main methods of integrating Fleet Command with Azure IoT Edge, For more information about the setup please refer [Fleet Command Integration with Azure IoT](https://docs.nvidia.com/fleet-command/prod_fleet-command/prod_fleet-command/integration-with-azure-iot.html) 5 | 6 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-0.1.8.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NVIDIA/fleet-command/a7b4a9dfa438216e87f600a3eeb0637c495d4312/azure-iot/video-analytics-demo-0.1.8.tgz -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | appVersion: "1.2" 3 | description: A Helm chart for Deepstream Intelligent Video Analytics 4 | name: azure-video-analytics-demo 5 | version: 0.1.6 6 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/README.md: -------------------------------------------------------------------------------- 1 | ## What is the Intelligent Video Analytics ? 2 | 3 | - Easy to use demo to demonstrate GPU accelerated Inference 4 | 5 | - Based on the NGC Deepstream Container (https://ngc.nvidia.com/catalog/containers/nvidia:deepstream) 6 | 7 | - Leverages Kubernetes, Helm, NGC, DeepStream 8 | 9 | - Best deployed via Helm to deploy the application 10 | 11 | - Does not require a Video Management System (VMS) 12 | 13 | ## What is DeepStream? 14 | 15 | DeepStream SDK delivers a complete streaming analytics toolkit for real-time AI based video and image understanding and multi-sensor processing. DeepStream SDK features hardware-accelerated building blocks, called plugins that bring deep neural networks and other complex processing tasks into a stream processing pipeline. The SDK allows you to focus on building core deep learning networks and IP rather than designing end-to-end solutions from scratch. 16 | 17 | More information on the DeepStream container here: (https://ngc.nvidia.com/catalog/containers/nvidia:deepstream) 18 | 19 | ### Running the Video Analytics Demo 20 | 21 | #### Prerequisites 22 | - Kubernetes Cluster 23 | - Helm/Tiller 24 | - NVIDIA GPU Operator 25 | - Run the helm chart 26 | 27 | Execute the below commands to deploy the Intelligent Video Analytics Demo with built-in Video and WebUI 28 | 29 | ``` 30 | helm fetch https://helm.ngc.nvidia.com/nvidia/charts/video-analytics-demo-0.1.5.tgz 31 | 32 | helm install video-analytics-demo-0.1.5.tgz 33 | ``` 34 | 35 | If you want to use camera as input, Please follow the below steps to deploy Intelligent Video Analytics Demo. 36 | 37 | ``` 38 | 1. helm fetch https://helm.ngc.nvidia.com/nvidia/charts/video-analytics-demo-0.1.5.tgz --untar 39 | 40 | 2. cd into the folder video-analytics-demo and update the file values.yaml 41 | 42 | 3. Go to the section Cameras in the values.yaml file and add the address of your IP camera. Read the comments section on how it can be added. Single or multiple cameras can be added as shown below 43 | cameras: 44 | camera1: rtsp://XXXX 45 | camera2: rtsp://XXXX 46 | 47 | 4. helm install video-analytics-demo 48 | ``` 49 | 50 | View the infered RTSP feed 51 | 52 | 1. Use the below WebUI URL to access deepstream application from browser 53 | 54 | ``` 55 | http://IPAddress of Node:31115/WebRTCApp/play.html?name=videoanalytics 56 | ``` 57 | 58 | 2. Download VLC Player from: https://www.videolan.org/vlc/ on the client machine where the user intends to view the video stream.We can view the video stream by entering the following URL in the VLC player. 59 | ``` 60 | rtsp://IPAddress of Node:31113/ds-test 61 | ``` 62 | IPAddress of the node can be viewed by executing ifconfig on the server node 63 | 64 | 65 | ## License 66 | The DeepStream SDK license is available within the container at the location opt/nvidia/deepstream/deepstream-5.0/LicenseAgreement.pdf. By pulling and using the DeepStream SDK (deepstream) container in NGC, you accept the terms and conditions of this license. 67 | 68 | ## Suggested Reading 69 | For more information on DeepStream documentation containing Development guide, Plug-ins manual, API reference manual, migration guide, FAQ and release notes can be found here https://docs.nvidia.com/metropolis/index.html 70 | 71 | If you have any questions or feedback, please refer to the discussions on DeepStream SDK Forum. 72 | 73 | For more information, including blogs and webinars, see the DeepStream SDK website 74 | 75 | ## Technical Support 76 | Email: EGXSupport@nvidia.com 77 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/_helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/config/create_config.py: -------------------------------------------------------------------------------- 1 | """ 2 | # Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved. 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | """ 15 | import sys 16 | import os 17 | from collections import OrderedDict 18 | 19 | tile_map = {1:(1,1), 2: (1,2), 4:(2,2), 6:(2,3), 8:(2,4), 10:(2,5), 12:(3,4), 15:(3,5), 18:(3,6)} 20 | tile_map = OrderedDict(tile_map) 21 | 22 | def read_camera_file(): 23 | camera_path = '/etc/config' 24 | files = os.listdir(camera_path) 25 | camera_ips = [] 26 | for file in files: 27 | current_file = os.path.join(camera_path,file) 28 | if os.path.isfile(current_file): 29 | camera_file = open(current_file) 30 | camera_ip = camera_file.readline() 31 | camera_ip = camera_ip.strip("\n") 32 | camera_file.close() 33 | camera_ips.append(camera_ip) 34 | return camera_ips 35 | 36 | 37 | def main(): 38 | ips = read_camera_file() 39 | print(ips) 40 | print(len(ips)) 41 | n_rows = None 42 | n_columns = None 43 | for key,val in tile_map.items(): 44 | if len(ips) < key: 45 | break 46 | n_rows = val[0] 47 | n_columns = val[1] 48 | 49 | write_list = [] 50 | if len(ips) != 0: 51 | 52 | with open(sys.argv[2]) as fp: 53 | line = fp.readline() 54 | while line: 55 | pair = line.split("=") 56 | if pair[0] == "rows": 57 | pair[1] = str(n_rows) 58 | elif pair[0] == "columns": 59 | pair[1] = str(n_columns) 60 | elif pair[0] == "batch-size": 61 | pair[1] = str(len(ips)) 62 | output = line 63 | if len(pair) > 1: 64 | output = "=".join(pair) 65 | output = output.replace('\n','') 66 | write_list.append(output) 67 | line = fp.readline() 68 | fp.close() 69 | else: 70 | with open(sys.argv[2]) as fp: 71 | line = fp.readline() 72 | while line: 73 | pair = line.split("=") 74 | if pair[0] == "rows": 75 | pair[1] = str("1") 76 | elif pair[0] == "columns": 77 | pair[1] = str("1") 78 | elif pair[0] == "num-sources": 79 | pair[1] = str("1") 80 | elif pair[0] == "file-loop": 81 | pair[1] = str("1") 82 | elif pair[0] == "batch-size": 83 | pair[1] = str("1") 84 | output = line 85 | if len(pair) > 1: 86 | output = "=".join(pair) 87 | output = output.replace('\n','') 88 | write_list.append(output) 89 | line = fp.readline() 90 | fp.close() 91 | 92 | 93 | 94 | 95 | if len(ips) != 0: 96 | for index,ip in enumerate(ips): 97 | write_list.append("\n") 98 | write_list.append("[source{}]".format(index)) 99 | write_list.append("enable=1") 100 | write_list.append("type=4") 101 | write_list.append("uri={}".format(ip)) 102 | write_list.append("num-sources=1") 103 | write_list.append("gpu-id=0") 104 | write_list.append("cudadec-memtype=0") 105 | write_list.append("\n") 106 | 107 | write_list.append("[sink0]") 108 | write_list.append("enable=1") 109 | write_list.append("type=4") 110 | write_list.append("container=1") 111 | write_list.append("codec=1") 112 | write_list.append("sync=0") 113 | write_list.append("bitrate=2000000") 114 | write_list.append("profile=0") 115 | write_list.append("output-file=out.mp4") 116 | write_list.append("source-id=0") 117 | 118 | 119 | if len(ips) == 0: 120 | write_list.append("\n") 121 | write_list.append("[sink0]") 122 | write_list.append("enable=1") 123 | write_list.append("type=1") 124 | write_list.append("sync=1") 125 | write_list.append("codec=1") 126 | write_list.append("bitrate=4000000") 127 | write_list.append("rtsp-port=8554") 128 | write_list.append("udp-port=5400") 129 | write_list.append("source-id=0") 130 | write_list.append("gpu-id=0") 131 | write_list.append("nvbuf-memory-type=0") 132 | write_list.append("\n") 133 | write_list.append("[sink2]") 134 | write_list.append("enable=1") 135 | write_list.append("type=4") 136 | write_list.append("container=1") 137 | write_list.append("codec=1") 138 | write_list.append("sync=1") 139 | write_list.append("bitrate=2000000") 140 | write_list.append("rtsp-port=8554") 141 | write_list.append("udp-port=5400") 142 | write_list.append("profile=0") 143 | write_list.append("output-file=out.mp4") 144 | write_list.append("source-id=0") 145 | 146 | write_file = os.path.join(os.path.dirname(sys.argv[2]),'run.txt') 147 | with open(write_file,"w") as file: 148 | for line in write_list: 149 | file.write(line) 150 | file.write("\n") 151 | file.close() 152 | print(write_file) 153 | os.system("{} -c {}".format(sys.argv[1],write_file)) 154 | 155 | 156 | if __name__ == '__main__': 157 | main() 158 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/config/play.html: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | Ant Media Server 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | Stream will start playing automatically
when it is live 31 |
32 | 33 | 34 |
35 | 45 |
46 | 47 | 48 | 49 | 51 | 53 | 54 | 55 | 348 | 349 | 350 | 351 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | 1. Get the RTSP URL by running these commands: 2 | {{- if .Values.ingress.enabled }} 3 | {{- range $host := .Values.ingress.hosts }} 4 | {{- range .paths }} 5 | http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} 6 | {{- end }} 7 | {{- end }} 8 | {{- else if contains "NodePort" .Values.service.type }} 9 | export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "video-analytics-demo.fullname" . }}) 10 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") 11 | echo rtsp://$NODE_IP:$NODE_PORT/ds-test 12 | {{- else if contains "LoadBalancer" .Values.service.type }} 13 | NOTE: It may take a few minutes for the LoadBalancer IP to be available. 14 | You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "video-analytics-demo.fullname" . }}' 15 | export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "video-analytics-demo.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') 16 | echo http://$SERVICE_IP:{{ .Values.service.port }} 17 | {{- else if contains "ClusterIP" .Values.service.type }} 18 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "video-analytics-demo.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") 19 | echo "Visit http://127.0.0.1:8080 to use your application" 20 | kubectl port-forward $POD_NAME 8080:80 21 | {{- end }} 22 | 23 | 2.Get the WebUI URL by running these commands: 24 | export ANT_NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "video-analytics-demo.fullname" . }}-webui) 25 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") 26 | echo http://$NODE_IP:$ANT_NODE_PORT/WebRTCApp/play.html?name=videoanalytics 27 | Disclaimer: 28 | Note: Due to the output from DeepStream being real-time via RTSP, you may experience occasional hiccups in the video stream depending on network conditions. 29 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* vim: set filetype=mustache: */}} 2 | {{/* 3 | Expand the name of the chart. 4 | */}} 5 | {{- define "video-analytics-demo.name" -}} 6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 7 | {{- end -}} 8 | 9 | {{/* 10 | Create a default fully qualified app name. 11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 12 | If release name contains chart name it will be used as a full name. 13 | */}} 14 | {{- define "video-analytics-demo.fullname" -}} 15 | {{- if .Values.fullnameOverride -}} 16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} 17 | {{- else -}} 18 | {{- $name := default .Chart.Name .Values.nameOverride -}} 19 | {{- if contains $name .Release.Name -}} 20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} 21 | {{- else -}} 22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 23 | {{- end -}} 24 | {{- end -}} 25 | {{- end -}} 26 | 27 | {{/* 28 | Create chart name and version as used by the chart label. 29 | */}} 30 | {{- define "video-analytics-demo.chart" -}} 31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 32 | {{- end -}} 33 | 34 | {{/* 35 | Common labels 36 | */}} 37 | {{- define "video-analytics-demo.labels" -}} 38 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 39 | helm.sh/chart: {{ include "video-analytics-demo.chart" . }} 40 | app.kubernetes.io/instance: {{ .Release.Name }} 41 | {{- if .Chart.AppVersion }} 42 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} 43 | {{- end }} 44 | app.kubernetes.io/managed-by: {{ .Release.Service }} 45 | {{- end -}} 46 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/templates/configmap.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: {{ include "video-analytics-demo.fullname" . }}-configmap 5 | labels: 6 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 7 | app.kubernetes.io/instance: {{ .Release.Name }} 8 | data: 9 | {{- range $key, $val := .Values.cameras}} 10 | {{$key }}: {{$val | quote }} 11 | {{- end}} 12 | --- 13 | apiVersion: v1 14 | kind: ConfigMap 15 | metadata: 16 | name: {{ include "video-analytics-demo.fullname" . }}-webui-configmap 17 | data: 18 | {{ (.Files.Glob "config/play.html").AsConfig | indent 4 }} 19 | --- 20 | apiVersion: v1 21 | kind: ConfigMap 22 | metadata: 23 | name: {{ include "video-analytics-demo.fullname" . }}-create-config 24 | data: 25 | {{ (.Files.Glob "config/create_config.py").AsConfig | indent 4 }} 26 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/templates/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: {{ include "video-analytics-demo.fullname" . }} 5 | labels: 6 | {{ include "video-analytics-demo.labels" . | indent 4 }} 7 | spec: 8 | replicas: {{ .Values.replicaCount }} 9 | selector: 10 | matchLabels: 11 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 12 | app.kubernetes.io/instance: {{ .Release.Name }} 13 | template: 14 | metadata: 15 | labels: 16 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 17 | app.kubernetes.io/instance: {{ .Release.Name }} 18 | annotations: 19 | rollme: {{ randAlphaNum 5 | quote }} 20 | spec: 21 | {{- with .Values.imagePullSecrets }} 22 | imagePullSecrets: 23 | {{- toYaml . | nindent 8 }} 24 | {{- end }} 25 | containers: 26 | - name: "{{ .Chart.Name }}-1" 27 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" 28 | command: 29 | - sh 30 | - -c 31 | {{- if .Values.ngcModel }} 32 | - apt update; 33 | apt install wget unzip -y; 34 | {{ .Values.ngcModel.getModel }}; 35 | unzip *.zip; 36 | cp -r {{ .Values.ngcModel.fileName }} {{ .Values.ngcModel.putModel }}; 37 | sed -ie "s/..\/..\/models\/tlt_pretrained_models\/{{ .Values.ngcModel.name}}\/{{ .Values.ngcModel.fileName }}/\/opt\/nvidia\/deepstream\/deepstream-5.0\/samples\/configs\/tlt_pretrained_models\/{{ .Values.ngcModel.fileName }}/g" {{ .Values.ngcModel.modelConfig }}; 38 | {{ .Values.command.apprunnercmd}} {{ .Values.command.apprunnername}} {{ .Values.command.appname}} {{ .Values.command.apparg}} >> /home/deepstream.log 39 | {{- else }} 40 | - {{ .Values.command.apprunnercmd}} {{ .Values.command.apprunnername}} {{ .Values.command.appname}} {{ .Values.command.apparg}} 41 | {{- end }} 42 | imagePullPolicy: {{ .Values.image.pullPolicy }} 43 | resources: 44 | {{- toYaml .Values.resources | nindent 12 }} 45 | ports: 46 | - name: http 47 | containerPort: 8554 48 | protocol: TCP 49 | - name: http1 50 | containerPort: {{ .Values.service.webuiPort }} 51 | protocol: TCP 52 | volumeMounts: 53 | - name: ipmount 54 | mountPath: /etc/config 55 | - name: create-config 56 | mountPath: /opt/nvidia/deepstream/create_config.py 57 | subPath: create_config.py 58 | - name: logs-mount 59 | mountPath: /home 60 | - name: "{{ .Chart.Name }}-azure" 61 | image: anguda/azure-iot:send-message 62 | env: 63 | - name: IOTHUB_DEVICE_CONNECTION_STRING 64 | value: {{ .Values.iotdeviceconnectionstring }} 65 | volumeMounts: 66 | - name: logs-mount 67 | mountPath: /home 68 | volumes: 69 | - name: ipmount 70 | configMap: 71 | name: {{ include "video-analytics-demo.fullname" . }}-configmap 72 | - name: logs-mount 73 | emptyDir: {} 74 | - name: create-config 75 | configMap: 76 | name: {{ include "video-analytics-demo.fullname" . }}-create-config 77 | {{- with .Values.nodeSelector }} 78 | nodeSelector: 79 | {{- toYaml . | nindent 8 }} 80 | {{- end }} 81 | {{- with .Values.affinity }} 82 | affinity: 83 | {{- toYaml . | nindent 8 }} 84 | {{- end }} 85 | {{- with .Values.tolerations }} 86 | tolerations: 87 | {{- toYaml . | nindent 8 }} 88 | {{- end }} 89 | --- 90 | apiVersion: apps/v1 91 | kind: Deployment 92 | metadata: 93 | name: {{ include "video-analytics-demo.fullname" . }}-webui 94 | labels: 95 | name: {{ include "video-analytics-demo.fullname" . }}-webui 96 | {{ include "video-analytics-demo.labels" . | indent 4 }} 97 | spec: 98 | replicas: {{ .Values.replicaCount }} 99 | selector: 100 | matchLabels: 101 | name: {{ include "video-analytics-demo.fullname" . }}-webui 102 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 103 | app.kubernetes.io/instance: {{ .Release.Name }} 104 | template: 105 | metadata: 106 | labels: 107 | name: {{ include "video-analytics-demo.fullname" . }}-webui 108 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 109 | app.kubernetes.io/instance: {{ .Release.Name }} 110 | spec: 111 | containers: 112 | - name: "{{ .Chart.Name }}-webui-1" 113 | image: {{ .Values.image.webui }} 114 | imagePullPolicy: {{ .Values.image.pullPolicy }} 115 | env: 116 | - name: NODE_IP 117 | valueFrom: 118 | fieldRef: 119 | fieldPath: status.hostIP 120 | - name: DS_PORT 121 | value: "{{ .Values.service.nodePort }}" 122 | lifecycle: 123 | postStart: 124 | exec: 125 | command: ["/bin/sh", "-c", "sleep 45; bash /tmp/serverstart.sh; cp -r /tmp/play.html /usr/local/antmedia/webapps/WebRTCApp/play.html"] 126 | resources: {} 127 | volumeMounts: 128 | - mountPath: /tmp/play.html 129 | name: play 130 | subPath: play.html 131 | ports: 132 | - name: http 133 | containerPort: {{ .Values.service.webuiPort }} 134 | protocol: TCP 135 | volumes: 136 | - configMap: 137 | defaultMode: 420 138 | name: {{ include "video-analytics-demo.fullname" . }}-webui-configmap 139 | name: play 140 | 141 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/templates/ingress.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.ingress.enabled -}} 2 | {{- $fullName := include "video-analytics-demo.fullname" . -}} 3 | apiVersion: extensions/v1beta1 4 | kind: Ingress 5 | metadata: 6 | name: {{ $fullName }} 7 | labels: 8 | {{ include "video-analytics-demo.labels" . | indent 4 }} 9 | {{- with .Values.ingress.annotations }} 10 | annotations: 11 | {{- toYaml . | nindent 4 }} 12 | {{- end }} 13 | spec: 14 | {{- if .Values.ingress.tls }} 15 | tls: 16 | {{- range .Values.ingress.tls }} 17 | - hosts: 18 | {{- range .hosts }} 19 | - {{ . | quote }} 20 | {{- end }} 21 | secretName: {{ .secretName }} 22 | {{- end }} 23 | {{- end }} 24 | rules: 25 | {{- range .Values.ingress.hosts }} 26 | - host: {{ .host | quote }} 27 | http: 28 | paths: 29 | {{- range .paths }} 30 | - path: {{ . }} 31 | backend: 32 | serviceName: {{ $fullName }} 33 | servicePort: http 34 | {{- end }} 35 | {{- end }} 36 | {{- end }} 37 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/templates/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ include "video-analytics-demo.fullname" . }} 5 | labels: 6 | {{ include "video-analytics-demo.labels" . | indent 4 }} 7 | spec: 8 | type: {{ .Values.service.type }} 9 | ports: 10 | - port: {{ .Values.service.port }} 11 | targetPort: http 12 | protocol: TCP 13 | name: http 14 | nodePort: {{ .Values.service.nodePort }} 15 | selector: 16 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 17 | app.kubernetes.io/instance: {{ .Release.Name }} 18 | --- 19 | apiVersion: v1 20 | kind: Service 21 | metadata: 22 | name: {{ include "video-analytics-demo.fullname" . }}-webui 23 | labels: 24 | name: {{ include "video-analytics-demo.fullname" . }}-webui 25 | spec: 26 | type: {{ .Values.service.type }} 27 | ports: 28 | - port: {{ .Values.service.webuiPort }} 29 | targetPort: http 30 | protocol: TCP 31 | name: http 32 | nodePort: {{ .Values.service.webuinodePort }} 33 | selector: 34 | name: {{ include "video-analytics-demo.fullname" . }}-webui 35 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/templates/tests/test-connection.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: "{{ include "video-analytics-demo.fullname" . }}-test-connection" 5 | labels: 6 | {{ include "video-analytics-demo.labels" . | indent 4 }} 7 | annotations: 8 | "helm.sh/hook": test-success 9 | spec: 10 | containers: 11 | - name: wget 12 | image: busybox 13 | command: ['wget'] 14 | args: ['{{ include "video-analytics-demo.fullname" . }}:{{ .Values.service.port }}'] 15 | restartPolicy: Never 16 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo-old/values.yaml: -------------------------------------------------------------------------------- 1 | # Default values for video-analytics-demo 2 | # This is a YAML-formatted file. 3 | # Declare variables to be passed into your templates. 4 | 5 | iotdeviceconnectionstring: "HostName=egx-iot.azure-devices.net;DeviceId=egx-iot-device;SharedAccessKey=F1/EOVGtm2b3fFzXa8DILX4atinfTQpuHPC5UnN/Tl4=" 6 | 7 | replicaCount: 1 8 | 9 | image: 10 | repository: nvcr.io/nvidia/deepstream 11 | tag: 5.0-20.07-samples 12 | pullPolicy: IfNotPresent 13 | webui: anguda/ant-media:1.0 14 | 15 | # Update the NGC Model to use in Deepstream 16 | ngcModel: 17 | #NGC Model Pruned URL from NGC 18 | getModel: wget --content-disposition https://api.ngc.nvidia.com/v2/models/nvidia/tlt_trafficcamnet/versions/pruned_v1.0/zip -O tlt_trafficcamnet_pruned_v1.0.zip 19 | #NGC model name 20 | name: trafficcamnet 21 | # Model File Name that will use in Deepstream 22 | fileName: resnet18_trafficcamnet_pruned.etlt 23 | # Model Config that needs to update 24 | modelConfig: /opt/nvidia/deepstream/deepstream-5.0/samples/configs/tlt_pretrained_models/config_infer_primary_trafficcamnet.txt 25 | #Do not update the Put Model 26 | putModel: /opt/nvidia/deepstream/deepstream-5.0/samples/configs/tlt_pretrained_models/ 27 | 28 | imagePullSecrets: 29 | - name: nvidia-registrykey-secret 30 | nameOverride: "" 31 | fullnameOverride: "" 32 | 33 | command: 34 | apprunnercmd: "python" 35 | apprunnername: "/opt/nvidia/deepstream/create_config.py" 36 | appname: "deepstream-app" 37 | apparg: "/opt/nvidia/deepstream/deepstream-5.0/samples/configs/deepstream-app/source4_1080p_dec_infer-resnet_tracker_sgie_tiled_display_int8.txt" 38 | 39 | service: 40 | type: NodePort 41 | port: 80 42 | nodePort: 31113 43 | webuiPort: 5080 44 | webuinodePort: 31115 45 | 46 | 47 | #specify camera IP as rtsp://username:password@ip 48 | #or rtsp://ip if it has no username and password 49 | 50 | cameras: 51 | #camera1: rtsp://192.168.0.24:8554/live.sdp 52 | 53 | ingress: 54 | enabled: false 55 | annotations: {} 56 | # kubernetes.io/ingress.class: nginx 57 | # kubernetes.io/tls-acme: "true" 58 | hosts: 59 | - host: chart-example.local 60 | paths: [] 61 | 62 | tls: [] 63 | # - secretName: chart-example-tls 64 | # hosts: 65 | # - chart-example.local 66 | 67 | resources: {} 68 | # We usually recommend not to specify default resources and to leave this as a conscious 69 | # choice for the user. This also increases chances charts run on environments with little 70 | # resources, such as Minikube. If you do want to specify resources, uncomment the following 71 | # lines, adjust them as necessary, and remove the curly braces after 'resources:'. 72 | # limits: 73 | # cpu: 100m 74 | # memory: 128Mi 75 | # requests: 76 | # cpu: 100m 77 | # memory: 128Mi 78 | 79 | 80 | nodeSelector: {} 81 | 82 | tolerations: [] 83 | 84 | affinity: {} 85 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | appVersion: "1.2" 3 | description: A Helm chart for Deepstream Intelligent Video Analytics 4 | name: video-analytics-demo 5 | version: 0.1.8 6 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/README.md: -------------------------------------------------------------------------------- 1 | ## What is the Intelligent Video Analytics ? 2 | 3 | - Easy to use demo to demonstrate GPU accelerated Inference 4 | 5 | - Based on the NGC Deepstream Container (https://ngc.nvidia.com/catalog/containers/nvidia:deepstream) 6 | 7 | - Leverages Kubernetes, Helm, NGC, DeepStream 8 | 9 | - Best deployed via Helm to deploy the application 10 | 11 | - Does not require a Video Management System (VMS) 12 | 13 | ## What is DeepStream? 14 | 15 | DeepStream SDK delivers a complete streaming analytics toolkit for real-time AI based video and image understanding and multi-sensor processing. DeepStream SDK features hardware-accelerated building blocks, called plugins that bring deep neural networks and other complex processing tasks into a stream processing pipeline. The SDK allows you to focus on building core deep learning networks and IP rather than designing end-to-end solutions from scratch. 16 | 17 | More information on the DeepStream container here: (https://ngc.nvidia.com/catalog/containers/nvidia:deepstream) 18 | 19 | ### Running the Video Analytics Demo 20 | 21 | #### Prerequisites 22 | - Kubernetes Cluster 23 | - Helm/Tiller 24 | - NVIDIA GPU Operator 25 | - Run the helm chart 26 | 27 | Execute the below commands to deploy the Intelligent Video Analytics Demo with built-in Video and WebUI 28 | 29 | ``` 30 | helm fetch https://helm.ngc.nvidia.com/nvidia/charts/video-analytics-demo-0.1.5.tgz 31 | 32 | helm install video-analytics-demo-0.1.5.tgz 33 | ``` 34 | 35 | If you want to use camera as input, Please follow the below steps to deploy Intelligent Video Analytics Demo. 36 | 37 | ``` 38 | 1. helm fetch https://helm.ngc.nvidia.com/nvidia/charts/video-analytics-demo-0.1.5.tgz --untar 39 | 40 | 2. cd into the folder video-analytics-demo and update the file values.yaml 41 | 42 | 3. Go to the section Cameras in the values.yaml file and add the address of your IP camera. Read the comments section on how it can be added. Single or multiple cameras can be added as shown below 43 | cameras: 44 | camera1: rtsp://XXXX 45 | camera2: rtsp://XXXX 46 | 47 | 4. helm install video-analytics-demo 48 | ``` 49 | 50 | View the infered RTSP feed 51 | 52 | 1. Use the below WebUI URL to access deepstream application from browser 53 | 54 | ``` 55 | http://IPAddress of Node:31115/WebRTCApp/play.html?name=videoanalytics 56 | ``` 57 | 58 | 2. Download VLC Player from: https://www.videolan.org/vlc/ on the client machine where the user intends to view the video stream.We can view the video stream by entering the following URL in the VLC player. 59 | ``` 60 | rtsp://IPAddress of Node:31113/ds-test 61 | ``` 62 | IPAddress of the node can be viewed by executing ifconfig on the server node 63 | 64 | 65 | ## License 66 | The DeepStream SDK license is available within the container at the location opt/nvidia/deepstream/deepstream-5.0/LicenseAgreement.pdf. By pulling and using the DeepStream SDK (deepstream) container in NGC, you accept the terms and conditions of this license. 67 | 68 | ## Suggested Reading 69 | For more information on DeepStream documentation containing Development guide, Plug-ins manual, API reference manual, migration guide, FAQ and release notes can be found here https://docs.nvidia.com/metropolis/index.html 70 | 71 | If you have any questions or feedback, please refer to the discussions on DeepStream SDK Forum. 72 | 73 | For more information, including blogs and webinars, see the DeepStream SDK website 74 | 75 | ## Technical Support 76 | Email: EGXSupport@nvidia.com 77 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/_helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *~ 18 | # Various IDEs 19 | .project 20 | .idea/ 21 | *.tmproj 22 | .vscode/ 23 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/config/create_config.py: -------------------------------------------------------------------------------- 1 | """ 2 | Author: Vinay Bagde 3 | Modifier: Anurag Guda 4 | Maintainer: Andrew Liu, Anurag Guda 5 | Copyright (c) 2018 NVIDIA Corporation. All rights reserved. 6 | """ 7 | import sys 8 | import os 9 | from collections import OrderedDict 10 | 11 | tile_map = {1:(1,1), 2: (1,2), 4:(2,2), 6:(2,3), 8:(2,4), 10:(2,5), 12:(3,4), 15:(3,5), 18:(3,6)} 12 | tile_map = OrderedDict(tile_map) 13 | 14 | def read_camera_file(): 15 | camera_path = '/etc/config' 16 | files = os.listdir(camera_path) 17 | camera_ips = [] 18 | for file in files: 19 | current_file = os.path.join(camera_path,file) 20 | if os.path.isfile(current_file): 21 | camera_file = open(current_file) 22 | camera_ip = camera_file.readline() 23 | camera_ip = camera_ip.strip("\n") 24 | camera_file.close() 25 | camera_ips.append(camera_ip) 26 | return camera_ips 27 | 28 | 29 | def main(): 30 | ips = read_camera_file() 31 | print(ips) 32 | print(len(ips)) 33 | n_rows = None 34 | n_columns = None 35 | for key,val in tile_map.items(): 36 | if len(ips) < key: 37 | break 38 | n_rows = val[0] 39 | n_columns = val[1] 40 | 41 | write_list = [] 42 | if len(ips) != 0: 43 | 44 | with open(sys.argv[2]) as fp: 45 | line = fp.readline() 46 | while line: 47 | pair = line.split("=") 48 | if pair[0] == "rows": 49 | pair[1] = str(n_rows) 50 | elif pair[0] == "columns": 51 | pair[1] = str(n_columns) 52 | elif pair[0] == "batch-size": 53 | pair[1] = str(len(ips)) 54 | output = line 55 | if len(pair) > 1: 56 | output = "=".join(pair) 57 | output = output.replace('\n','') 58 | write_list.append(output) 59 | line = fp.readline() 60 | fp.close() 61 | else: 62 | with open(sys.argv[2]) as fp: 63 | line = fp.readline() 64 | while line: 65 | pair = line.split("=") 66 | if pair[0] == "rows": 67 | pair[1] = str("1") 68 | elif pair[0] == "columns": 69 | pair[1] = str("1") 70 | elif pair[0] == "num-sources": 71 | pair[1] = str("1") 72 | elif pair[0] == "file-loop": 73 | pair[1] = str("1") 74 | elif pair[0] == "batch-size": 75 | pair[1] = str("1") 76 | output = line 77 | if len(pair) > 1: 78 | output = "=".join(pair) 79 | output = output.replace('\n','') 80 | write_list.append(output) 81 | line = fp.readline() 82 | fp.close() 83 | 84 | 85 | gpulist = os.popen('nvidia-smi -L').read() 86 | 87 | print(gpulist) 88 | 89 | if 'T4' in gpulist: 90 | if len(ips) != 0: 91 | for index,ip in enumerate(ips): 92 | write_list.append("\n") 93 | write_list.append("[source{}]".format(index)) 94 | write_list.append("enable=1") 95 | write_list.append("type=4") 96 | write_list.append("uri={}".format(ip)) 97 | write_list.append("num-sources=1") 98 | write_list.append("gpu-id=0") 99 | write_list.append("cudadec-memtype=0") 100 | write_list.append("\n") 101 | 102 | write_list.append("[sink0]") 103 | write_list.append("enable=1") 104 | write_list.append("type=4") 105 | write_list.append("container=1") 106 | write_list.append("codec=1") 107 | write_list.append("sync=0") 108 | write_list.append("bitrate=2000000") 109 | write_list.append("profile=0") 110 | write_list.append("output-file=out.mp4") 111 | write_list.append("source-id=0") 112 | 113 | 114 | if len(ips) == 0: 115 | write_list.append("\n") 116 | write_list.append("[sink0]") 117 | write_list.append("enable=1") 118 | write_list.append("type=1") 119 | write_list.append("sync=1") 120 | write_list.append("codec=1") 121 | write_list.append("bitrate=4000000") 122 | write_list.append("rtsp-port=8554") 123 | write_list.append("udp-port=5400") 124 | write_list.append("source-id=0") 125 | write_list.append("gpu-id=0") 126 | write_list.append("nvbuf-memory-type=0") 127 | write_list.append("\n") 128 | write_list.append("[sink2]") 129 | write_list.append("enable=1") 130 | write_list.append("type=4") 131 | write_list.append("container=1") 132 | write_list.append("codec=1") 133 | write_list.append("sync=1") 134 | write_list.append("bitrate=2000000") 135 | write_list.append("rtsp-port=8554") 136 | write_list.append("udp-port=5400") 137 | write_list.append("profile=0") 138 | write_list.append("output-file=out.mp4") 139 | write_list.append("source-id=0") 140 | else: 141 | if len(ips) != 0: 142 | for index,ip in enumerate(ips): 143 | write_list.append("\n") 144 | write_list.append("[source{}]".format(index)) 145 | write_list.append("enable=1") 146 | write_list.append("type=4") 147 | write_list.append("uri={}".format(ip)) 148 | write_list.append("num-sources=1") 149 | write_list.append("gpu-id=0") 150 | write_list.append("cudadec-memtype=0") 151 | write_list.append("\n") 152 | 153 | write_list.append("[sink0]") 154 | write_list.append("enable=1") 155 | write_list.append("type=4") 156 | write_list.append("container=1") 157 | write_list.append("codec=1") 158 | write_list.append("enc-type=1") 159 | write_list.append("sync=0") 160 | write_list.append("bitrate=2000000") 161 | write_list.append("profile=0") 162 | write_list.append("output-file=out.mp4") 163 | write_list.append("source-id=0") 164 | 165 | 166 | if len(ips) == 0: 167 | write_list.append("\n") 168 | write_list.append("[sink0]") 169 | write_list.append("enable=1") 170 | write_list.append("type=1") 171 | write_list.append("sync=1") 172 | write_list.append("codec=1") 173 | write_list.append("enc-type=1") 174 | write_list.append("bitrate=4000000") 175 | write_list.append("rtsp-port=8554") 176 | write_list.append("udp-port=5400") 177 | write_list.append("source-id=0") 178 | write_list.append("gpu-id=0") 179 | write_list.append("nvbuf-memory-type=0") 180 | write_list.append("\n") 181 | write_list.append("[sink2]") 182 | write_list.append("enable=1") 183 | write_list.append("type=4") 184 | write_list.append("container=1") 185 | write_list.append("codec=1") 186 | write_list.append("enc-type=1") 187 | write_list.append("sync=1") 188 | write_list.append("bitrate=2000000") 189 | write_list.append("rtsp-port=8554") 190 | write_list.append("udp-port=5400") 191 | write_list.append("profile=0") 192 | write_list.append("output-file=out.mp4") 193 | write_list.append("source-id=0") 194 | 195 | write_file = os.path.join(os.path.dirname(sys.argv[2]),'run.txt') 196 | with open(write_file,"w") as file: 197 | for line in write_list: 198 | file.write(line) 199 | file.write("\n") 200 | file.close() 201 | print(write_file) 202 | os.system("{} -c {}".format(sys.argv[1],write_file)) 203 | 204 | 205 | if __name__ == '__main__': 206 | main() 207 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/config/create_config_a100.py: -------------------------------------------------------------------------------- 1 | """ 2 | Author: Vinay Bagde 3 | Modifier: Anurag Guda 4 | Maintainer: Andrew Liu, Anurag Guda 5 | Copyright (c) 2018 NVIDIA Corporation. All rights reserved. 6 | """ 7 | import sys 8 | import os 9 | from collections import OrderedDict 10 | 11 | tile_map = {1:(1,1), 2: (1,2), 4:(2,2), 6:(2,3), 8:(2,4), 10:(2,5), 12:(3,4), 15:(3,5), 18:(3,6)} 12 | tile_map = OrderedDict(tile_map) 13 | 14 | def read_camera_file(): 15 | camera_path = '/etc/config' 16 | files = os.listdir(camera_path) 17 | camera_ips = [] 18 | for file in files: 19 | current_file = os.path.join(camera_path,file) 20 | if os.path.isfile(current_file): 21 | camera_file = open(current_file) 22 | camera_ip = camera_file.readline() 23 | camera_ip = camera_ip.strip("\n") 24 | camera_file.close() 25 | camera_ips.append(camera_ip) 26 | return camera_ips 27 | 28 | 29 | def main(): 30 | ips = read_camera_file() 31 | print(ips) 32 | print(len(ips)) 33 | n_rows = None 34 | n_columns = None 35 | for key,val in tile_map.items(): 36 | if len(ips) < key: 37 | break 38 | n_rows = val[0] 39 | n_columns = val[1] 40 | 41 | write_list = [] 42 | if len(ips) != 0: 43 | 44 | with open(sys.argv[2]) as fp: 45 | line = fp.readline() 46 | while line: 47 | pair = line.split("=") 48 | if pair[0] == "rows": 49 | pair[1] = str(n_rows) 50 | elif pair[0] == "columns": 51 | pair[1] = str(n_columns) 52 | elif pair[0] == "batch-size": 53 | pair[1] = str(len(ips)) 54 | output = line 55 | if len(pair) > 1: 56 | output = "=".join(pair) 57 | output = output.replace('\n','') 58 | write_list.append(output) 59 | line = fp.readline() 60 | fp.close() 61 | else: 62 | with open(sys.argv[2]) as fp: 63 | line = fp.readline() 64 | while line: 65 | pair = line.split("=") 66 | if pair[0] == "rows": 67 | pair[1] = str("1") 68 | elif pair[0] == "columns": 69 | pair[1] = str("1") 70 | elif pair[0] == "num-sources": 71 | pair[1] = str("1") 72 | elif pair[0] == "file-loop": 73 | pair[1] = str("1") 74 | elif pair[0] == "batch-size": 75 | pair[1] = str("1") 76 | output = line 77 | if len(pair) > 1: 78 | output = "=".join(pair) 79 | output = output.replace('\n','') 80 | write_list.append(output) 81 | line = fp.readline() 82 | fp.close() 83 | 84 | 85 | 86 | 87 | if len(ips) != 0: 88 | for index,ip in enumerate(ips): 89 | write_list.append("\n") 90 | write_list.append("[source{}]".format(index)) 91 | write_list.append("enable=1") 92 | write_list.append("type=4") 93 | write_list.append("uri={}".format(ip)) 94 | write_list.append("num-sources=1") 95 | write_list.append("gpu-id=0") 96 | write_list.append("cudadec-memtype=0") 97 | write_list.append("\n") 98 | 99 | write_list.append("[sink0]") 100 | write_list.append("enable=1") 101 | write_list.append("type=4") 102 | write_list.append("container=1") 103 | write_list.append("codec=1") 104 | write_list.append("enc-type=1") 105 | write_list.append("sync=0") 106 | write_list.append("bitrate=2000000") 107 | write_list.append("profile=0") 108 | write_list.append("output-file=out.mp4") 109 | write_list.append("source-id=0") 110 | 111 | 112 | if len(ips) == 0: 113 | write_list.append("\n") 114 | write_list.append("[sink0]") 115 | write_list.append("enable=1") 116 | write_list.append("type=1") 117 | write_list.append("sync=1") 118 | write_list.append("codec=1") 119 | write_list.append("enc-type=1") 120 | write_list.append("bitrate=4000000") 121 | write_list.append("rtsp-port=8554") 122 | write_list.append("udp-port=5400") 123 | write_list.append("source-id=0") 124 | write_list.append("gpu-id=0") 125 | write_list.append("nvbuf-memory-type=0") 126 | write_list.append("\n") 127 | write_list.append("[sink2]") 128 | write_list.append("enable=1") 129 | write_list.append("type=4") 130 | write_list.append("container=1") 131 | write_list.append("codec=1") 132 | write_list.append("enc-type=1") 133 | write_list.append("sync=1") 134 | write_list.append("bitrate=2000000") 135 | write_list.append("rtsp-port=8554") 136 | write_list.append("udp-port=5400") 137 | write_list.append("profile=0") 138 | write_list.append("output-file=out.mp4") 139 | write_list.append("source-id=0") 140 | 141 | write_file = os.path.join(os.path.dirname(sys.argv[2]),'run.txt') 142 | with open(write_file,"w") as file: 143 | for line in write_list: 144 | file.write(line) 145 | file.write("\n") 146 | file.close() 147 | print(write_file) 148 | os.system("{} -c {}".format(sys.argv[1],write_file)) 149 | 150 | 151 | if __name__ == '__main__': 152 | main() 153 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/config/create_config_backup.py: -------------------------------------------------------------------------------- 1 | """ 2 | Author: Vinay Bagde 3 | Modifier: Anurag Guda 4 | Maintainer: Andrew Liu, Anurag Guda 5 | Copyright (c) 2018 NVIDIA Corporation. All rights reserved. 6 | """ 7 | import sys 8 | import os 9 | from collections import OrderedDict 10 | 11 | tile_map = {1:(1,1), 2: (1,2), 4:(2,2), 6:(2,3), 8:(2,4), 10:(2,5), 12:(3,4), 15:(3,5), 18:(3,6)} 12 | tile_map = OrderedDict(tile_map) 13 | 14 | def read_camera_file(): 15 | camera_path = '/etc/config' 16 | files = os.listdir(camera_path) 17 | camera_ips = [] 18 | for file in files: 19 | current_file = os.path.join(camera_path,file) 20 | if os.path.isfile(current_file): 21 | camera_file = open(current_file) 22 | camera_ip = camera_file.readline() 23 | camera_ip = camera_ip.strip("\n") 24 | camera_file.close() 25 | camera_ips.append(camera_ip) 26 | return camera_ips 27 | 28 | 29 | def main(): 30 | ips = read_camera_file() 31 | print(ips) 32 | print(len(ips)) 33 | n_rows = None 34 | n_columns = None 35 | for key,val in tile_map.items(): 36 | if len(ips) < key: 37 | break 38 | n_rows = val[0] 39 | n_columns = val[1] 40 | 41 | write_list = [] 42 | if len(ips) != 0: 43 | 44 | with open(sys.argv[2]) as fp: 45 | line = fp.readline() 46 | while line: 47 | pair = line.split("=") 48 | if pair[0] == "rows": 49 | pair[1] = str(n_rows) 50 | elif pair[0] == "columns": 51 | pair[1] = str(n_columns) 52 | elif pair[0] == "batch-size": 53 | pair[1] = str(len(ips)) 54 | output = line 55 | if len(pair) > 1: 56 | output = "=".join(pair) 57 | output = output.replace('\n','') 58 | write_list.append(output) 59 | line = fp.readline() 60 | fp.close() 61 | else: 62 | with open(sys.argv[2]) as fp: 63 | line = fp.readline() 64 | while line: 65 | pair = line.split("=") 66 | if pair[0] == "rows": 67 | pair[1] = str("1") 68 | elif pair[0] == "columns": 69 | pair[1] = str("1") 70 | elif pair[0] == "num-sources": 71 | pair[1] = str("1") 72 | elif pair[0] == "file-loop": 73 | pair[1] = str("1") 74 | elif pair[0] == "batch-size": 75 | pair[1] = str("1") 76 | output = line 77 | if len(pair) > 1: 78 | output = "=".join(pair) 79 | output = output.replace('\n','') 80 | write_list.append(output) 81 | line = fp.readline() 82 | fp.close() 83 | 84 | 85 | 86 | 87 | if len(ips) != 0: 88 | for index,ip in enumerate(ips): 89 | write_list.append("\n") 90 | write_list.append("[source{}]".format(index)) 91 | write_list.append("enable=1") 92 | write_list.append("type=4") 93 | write_list.append("uri={}".format(ip)) 94 | write_list.append("num-sources=1") 95 | write_list.append("gpu-id=0") 96 | write_list.append("cudadec-memtype=0") 97 | write_list.append("\n") 98 | 99 | write_list.append("[sink0]") 100 | write_list.append("enable=1") 101 | write_list.append("type=4") 102 | write_list.append("container=1") 103 | write_list.append("codec=1") 104 | write_list.append("sync=0") 105 | write_list.append("bitrate=2000000") 106 | write_list.append("profile=0") 107 | write_list.append("output-file=out.mp4") 108 | write_list.append("source-id=0") 109 | 110 | 111 | if len(ips) == 0: 112 | write_list.append("\n") 113 | write_list.append("[sink0]") 114 | write_list.append("enable=1") 115 | write_list.append("type=1") 116 | write_list.append("sync=1") 117 | write_list.append("codec=1") 118 | write_list.append("bitrate=4000000") 119 | write_list.append("rtsp-port=8554") 120 | write_list.append("udp-port=5400") 121 | write_list.append("source-id=0") 122 | write_list.append("gpu-id=0") 123 | write_list.append("nvbuf-memory-type=0") 124 | write_list.append("\n") 125 | write_list.append("[sink2]") 126 | write_list.append("enable=1") 127 | write_list.append("type=4") 128 | write_list.append("container=1") 129 | write_list.append("codec=1") 130 | write_list.append("sync=1") 131 | write_list.append("bitrate=2000000") 132 | write_list.append("rtsp-port=8554") 133 | write_list.append("udp-port=5400") 134 | write_list.append("profile=0") 135 | write_list.append("output-file=out.mp4") 136 | write_list.append("source-id=0") 137 | 138 | write_file = os.path.join(os.path.dirname(sys.argv[2]),'run.txt') 139 | with open(write_file,"w") as file: 140 | for line in write_list: 141 | file.write(line) 142 | file.write("\n") 143 | file.close() 144 | print(write_file) 145 | os.system("{} -c {}".format(sys.argv[1],write_file)) 146 | 147 | 148 | if __name__ == '__main__': 149 | main() 150 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/config/play.html: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | Ant Media Server 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | Stream will start playing automatically
when it is live 31 |
32 | 33 | 34 |
35 | 45 |
46 | 47 | 48 | 49 | 51 | 53 | 54 | 55 | 348 | 349 | 350 | 351 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | 1. Get the RTSP URL by running these commands: 2 | {{- if .Values.ingress.enabled }} 3 | {{- range $host := .Values.ingress.hosts }} 4 | {{- range .paths }} 5 | http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} 6 | {{- end }} 7 | {{- end }} 8 | {{- else if contains "NodePort" .Values.service.type }} 9 | export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "video-analytics-demo.fullname" . }}) 10 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") 11 | echo rtsp://$NODE_IP:$NODE_PORT/ds-test 12 | {{- else if contains "LoadBalancer" .Values.service.type }} 13 | NOTE: It may take a few minutes for the LoadBalancer IP to be available. 14 | You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "video-analytics-demo.fullname" . }}' 15 | export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "video-analytics-demo.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') 16 | echo http://$SERVICE_IP:{{ .Values.service.port }} 17 | {{- else if contains "ClusterIP" .Values.service.type }} 18 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "video-analytics-demo.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") 19 | echo "Visit http://127.0.0.1:8080 to use your application" 20 | kubectl port-forward $POD_NAME 8080:80 21 | {{- end }} 22 | 23 | 2.Get the WebUI URL by running these commands: 24 | export ANT_NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "video-analytics-demo.fullname" . }}-webui) 25 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") 26 | echo http://$NODE_IP:$ANT_NODE_PORT 27 | Disclaimer: 28 | Note: Due to the output from DeepStream being real-time via RTSP, you may experience occasional hiccups in the video stream depending on network conditions. 29 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/templates/_helpers.tpl: -------------------------------------------------------------------------------- 1 | {{/* vim: set filetype=mustache: */}} 2 | {{/* 3 | Expand the name of the chart. 4 | */}} 5 | {{- define "video-analytics-demo.name" -}} 6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} 7 | {{- end -}} 8 | 9 | {{/* 10 | Create a default fully qualified app name. 11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). 12 | If release name contains chart name it will be used as a full name. 13 | */}} 14 | {{- define "video-analytics-demo.fullname" -}} 15 | {{- if .Values.fullnameOverride -}} 16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} 17 | {{- else -}} 18 | {{- $name := default .Chart.Name .Values.nameOverride -}} 19 | {{- if contains $name .Release.Name -}} 20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}} 21 | {{- else -}} 22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} 23 | {{- end -}} 24 | {{- end -}} 25 | {{- end -}} 26 | 27 | {{/* 28 | Create chart name and version as used by the chart label. 29 | */}} 30 | {{- define "video-analytics-demo.chart" -}} 31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} 32 | {{- end -}} 33 | 34 | {{/* 35 | Common labels 36 | */}} 37 | {{- define "video-analytics-demo.labels" -}} 38 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 39 | helm.sh/chart: {{ include "video-analytics-demo.chart" . }} 40 | app.kubernetes.io/instance: {{ .Release.Name }} 41 | {{- if .Chart.AppVersion }} 42 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} 43 | {{- end }} 44 | app.kubernetes.io/managed-by: {{ .Release.Service }} 45 | {{- end -}} 46 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/templates/configmap.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: {{ include "video-analytics-demo.fullname" . }}-configmap 5 | labels: 6 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 7 | app.kubernetes.io/instance: {{ .Release.Name }} 8 | data: 9 | {{- range $key, $val := .Values.cameras}} 10 | {{$key }}: {{$val | quote }} 11 | {{- end}} 12 | --- 13 | apiVersion: v1 14 | kind: ConfigMap 15 | metadata: 16 | name: {{ include "video-analytics-demo.fullname" . }}-webui-configmap 17 | labels: 18 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 19 | app.kubernetes.io/instance: {{ .Release.Name }} 20 | data: 21 | {{ (.Files.Glob "config/play.html").AsConfig | indent 4 }} 22 | --- 23 | apiVersion: v1 24 | kind: ConfigMap 25 | metadata: 26 | name: {{ include "video-analytics-demo.fullname" . }}-create-config 27 | labels: 28 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 29 | app.kubernetes.io/instance: {{ .Release.Name }} 30 | data: 31 | {{ if contains "5.0-20.08-devel-a100" .Values.image.tag }} 32 | {{ (.Files.Glob "config/create_config_a100.py").AsConfig | indent 4 }} 33 | {{ else }} 34 | {{ (.Files.Glob "config/create_config.py").AsConfig | indent 4 }} 35 | {{ end }} 36 | --- 37 | apiVersion: v1 38 | kind: ConfigMap 39 | metadata: 40 | name: {{ include "video-analytics-demo.fullname" . }}-create-config-a100 41 | labels: 42 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 43 | app.kubernetes.io/instance: {{ .Release.Name }} 44 | data: 45 | {{ (.Files.Glob "config/create_config_a100.py").AsConfig | indent 4 }} 46 | --- 47 | apiVersion: v1 48 | kind: ConfigMap 49 | metadata: 50 | name: {{ include "video-analytics-demo.fullname" . }}-nginx-config 51 | data: 52 | nginx.conf: | 53 | user nginx; 54 | worker_processes 1; 55 | events { 56 | worker_connections 10240; 57 | } 58 | http { 59 | sendfile on; 60 | tcp_nopush on; 61 | tcp_nodelay on; 62 | keepalive_timeout 65; 63 | types_hash_max_size 2048; 64 | include /etc/nginx/mime.types; 65 | fastcgi_buffers 8 16k; 66 | fastcgi_buffer_size 32k; 67 | 68 | client_max_body_size 24M; 69 | client_body_buffer_size 128k; 70 | 71 | client_header_buffer_size 5120k; 72 | large_client_header_buffers 16 5120k; 73 | server { 74 | listen 80 default_server; 75 | server_name localhost; 76 | root /var/www/html; 77 | location / { 78 | rewrite ^ $scheme://$http_host/demo/play.html?name=videoanalytics break; 79 | #return 301 $uri/demo/play.html?name=videoanalytics; 80 | #proxy_pass http://$server_name:80/demo/play.html?name=videoanalytics; 81 | proxy_buffering off; 82 | proxy_cache_bypass $http_upgrade; 83 | proxy_buffers 4 256k; 84 | proxy_buffer_size 128k; 85 | proxy_busy_buffers_size 256k; 86 | proxy_connect_timeout 4s; 87 | proxy_read_timeout 86400s; 88 | proxy_send_timeout 12s; 89 | proxy_http_version 1.1; 90 | proxy_set_header Host $http_host; 91 | proxy_set_header X-Real-IP $remote_addr; 92 | proxy_set_header Upgrade $http_upgrade; 93 | proxy_set_header Connection "upgrade"; 94 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 95 | } 96 | location /demo { 97 | proxy_pass http://{{ include "video-analytics-demo.fullname" . }}-web:5080/WebRTCApp; 98 | proxy_buffering off; 99 | proxy_cache_bypass $http_upgrade; 100 | proxy_buffers 4 256k; 101 | proxy_buffer_size 128k; 102 | proxy_busy_buffers_size 256k; 103 | proxy_connect_timeout 4s; 104 | proxy_read_timeout 86400s; 105 | proxy_send_timeout 12s; 106 | proxy_http_version 1.1; 107 | proxy_set_header Host $http_host; 108 | proxy_set_header X-Real-IP $remote_addr; 109 | proxy_set_header Upgrade $http_upgrade; 110 | proxy_set_header Connection "upgrade"; 111 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/templates/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: {{ include "video-analytics-demo.fullname" . }} 5 | labels: 6 | {{ include "video-analytics-demo.labels" . | indent 4 }} 7 | spec: 8 | replicas: {{ .Values.replicaCount }} 9 | strategy: 10 | type: {{ .Values.deployment.strategy }} 11 | selector: 12 | matchLabels: 13 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 14 | app.kubernetes.io/instance: {{ .Release.Name }} 15 | template: 16 | metadata: 17 | labels: 18 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 19 | app.kubernetes.io/instance: {{ .Release.Name }} 20 | annotations: 21 | rollme: {{ randAlphaNum 5 | quote }} 22 | spec: 23 | {{- with .Values.imagePullSecrets }} 24 | imagePullSecrets: 25 | {{- toYaml . | nindent 8 }} 26 | {{- end }} 27 | containers: 28 | - name: "{{ .Chart.Name }}-1" 29 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" 30 | command: 31 | - sh 32 | - -c 33 | {{- if .Values.ngcModel }} 34 | - apt update; 35 | apt install wget unzip git-svn -y; 36 | git svn clone https://github.com/NVIDIA-AI-IOT/deepstream_reference_apps/trunk/deepstream_app_tao_configs >/dev/null; 37 | cp deepstream_app_tao_configs/* /opt/nvidia/deepstream/deepstream-6.0/samples/configs/tao_pretrained_models/; 38 | rm -rf deepstream_app_tao_configs/; 39 | wget -qO ngccli_linux.zip https://ngc.nvidia.com/downloads/ngccli_linux.zip && unzip -o ngccli_linux.zip && chmod u+x ngc-cli/ngc; 40 | cp ngc-cli/ngc /usr/bin/; 41 | {{- if .Values.ngcConfig }} 42 | export NGC_CLI_API_KEY={{ .Values.ngcConfig.apikey }} && ngc config set --format_type=ascii --org={{ .Values.ngcConfig.ngcorg }} --team={{ .Values.ngcConfig.ngcteam }}; 43 | {{- else }} 44 | echo "No NGC Configuration Provided"; 45 | {{- end }} 46 | {{ .Values.ngcModel.getModel }}; 47 | ngc config clear; 48 | model_version=$(echo '{{ .Values.ngcModel.getModel }}' | awk -F':' '{print $NF}' | sed 's/"//g'); 49 | model_name=$(echo '{{ .Values.ngcModel.getModel }}' | awk -F':' '{print $1}' | awk -F'/' '{print $NF}'); 50 | model_dir_name="$model_name"_v"$model_version"; 51 | echo $model_dir_name; 52 | cp -r $model_dir_name/{{ .Values.ngcModel.fileName }} {{ .Values.ngcModel.putModel }}; 53 | sed -ie "s/..\/..\/models\/tao_pretrained_models\/{{ .Values.ngcModel.name}}\/{{ .Values.ngcModel.fileName }}/\/opt\/nvidia\/deepstream\/deepstream-6.1\/samples\/configs\/tao_pretrained_models\/{{ .Values.ngcModel.fileName }}/g" {{ .Values.ngcModel.putModel }}/{{ .Values.ngcModel.modelConfig }}; 54 | {{ .Values.command.apprunnercmd}} {{ .Values.command.apprunnername}} {{ .Values.command.appname}} {{ .Values.command.apparg}} 55 | {{- else }} 56 | - {{ .Values.command.apprunnercmd}} {{ .Values.command.apprunnername}} {{ .Values.command.appname}} {{ .Values.command.apparg}} 57 | {{- end }} 58 | imagePullPolicy: {{ .Values.image.pullPolicy }} 59 | resources: 60 | {{- toYaml .Values.resources | nindent 12 }} 61 | ports: 62 | - name: http 63 | containerPort: 8554 64 | protocol: TCP 65 | - name: http1 66 | containerPort: {{ .Values.service.webuiPort }} 67 | protocol: TCP 68 | volumeMounts: 69 | - name: ipmount 70 | mountPath: /etc/config 71 | - name: create-config-a100 72 | mountPath: /opt/nvidia/deepstream/create_config_a100.py 73 | subPath: create_config_a100.py 74 | - name: create-config 75 | mountPath: /opt/nvidia/deepstream/create_config.py 76 | subPath: create_config.py 77 | - name: logs-mount 78 | mountPath: /home 79 | - name: "{{ .Chart.Name }}-azure" 80 | image: anguda/azure-iot:send-message 81 | env: 82 | - name: IOTHUB_DEVICE_CONNECTION_STRING 83 | value: {{ .Values.iotdeviceconnectionstring }} 84 | volumeMounts: 85 | - name: logs-mount 86 | mountPath: /home 87 | volumes: 88 | - name: logs-mount 89 | emptyDir: {} 90 | - name: ipmount 91 | configMap: 92 | name: {{ include "video-analytics-demo.fullname" . }}-configmap 93 | - name: create-config 94 | configMap: 95 | name: {{ include "video-analytics-demo.fullname" . }}-create-config 96 | - name: create-config-a100 97 | configMap: 98 | name: {{ include "video-analytics-demo.fullname" . }}-create-config-a100 99 | {{- with .Values.nodeSelector }} 100 | nodeSelector: 101 | {{- toYaml . | nindent 8 }} 102 | {{- end }} 103 | {{- with .Values.affinity }} 104 | affinity: 105 | {{- toYaml . | nindent 8 }} 106 | {{- end }} 107 | {{- with .Values.tolerations }} 108 | tolerations: 109 | {{- toYaml . | nindent 8 }} 110 | {{- end }} 111 | --- 112 | apiVersion: apps/v1 113 | kind: Deployment 114 | metadata: 115 | name: {{ include "video-analytics-demo.fullname" . }}-webui 116 | labels: 117 | name: {{ include "video-analytics-demo.fullname" . }}-webui 118 | {{ include "video-analytics-demo.labels" . | indent 4 }} 119 | spec: 120 | replicas: {{ .Values.replicaCount }} 121 | selector: 122 | matchLabels: 123 | name: {{ include "video-analytics-demo.fullname" . }}-webui 124 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 125 | app.kubernetes.io/instance: {{ .Release.Name }} 126 | template: 127 | metadata: 128 | labels: 129 | name: {{ include "video-analytics-demo.fullname" . }}-webui 130 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 131 | app.kubernetes.io/instance: {{ .Release.Name }} 132 | spec: 133 | containers: 134 | - name: nginx 135 | image: nginx 136 | ports: 137 | - containerPort: 80 138 | name: http 139 | volumeMounts: 140 | - name: nginx-conf 141 | mountPath: /etc/nginx/nginx.conf 142 | subPath: nginx.conf 143 | readOnly: true 144 | - name: "{{ .Chart.Name }}-webui-1" 145 | image: {{ .Values.image.webui }} 146 | imagePullPolicy: {{ .Values.image.pullPolicy }} 147 | env: 148 | {{- if .Values.service.rtspnodePort }} 149 | - name: NODE_IP 150 | valueFrom: 151 | fieldRef: 152 | fieldPath: status.hostIP 153 | - name: DS_PORT 154 | value: "{{ .Values.service.rtspnodePort }}" 155 | {{- else }} 156 | - name: NODE_IP 157 | value: {{ include "video-analytics-demo.fullname" . }} 158 | - name: DS_PORT 159 | value: "{{ .Values.service.port }}" 160 | {{- end }} 161 | lifecycle: 162 | postStart: 163 | exec: 164 | command: ["/bin/sh", "-c", "sleep 45; bash /tmp/serverstart.sh; cp -r /tmp/play.html /usr/local/antmedia/webapps/WebRTCApp/play.html"] 165 | resources: {} 166 | volumeMounts: 167 | - mountPath: /tmp/play.html 168 | name: play 169 | subPath: play.html 170 | ports: 171 | - name: webui 172 | containerPort: {{ .Values.service.webuiPort }} 173 | protocol: TCP 174 | volumes: 175 | - configMap: 176 | defaultMode: 420 177 | name: {{ include "video-analytics-demo.fullname" . }}-webui-configmap 178 | name: play 179 | - name: nginx-conf 180 | configMap: 181 | name: {{ include "video-analytics-demo.fullname" . }}-nginx-config 182 | items: 183 | - key: nginx.conf 184 | path: nginx.conf 185 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/templates/ingress.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.ingress.enabled -}} 2 | {{- $fullName := include "video-analytics-demo.fullname" . -}} 3 | apiVersion: extensions/v1beta1 4 | kind: Ingress 5 | metadata: 6 | name: {{ $fullName }} 7 | labels: 8 | {{ include "video-analytics-demo.labels" . | indent 4 }} 9 | {{- with .Values.ingress.annotations }} 10 | annotations: 11 | {{- toYaml . | nindent 4 }} 12 | {{- end }} 13 | spec: 14 | {{- if .Values.ingress.tls }} 15 | tls: 16 | {{- range .Values.ingress.tls }} 17 | - hosts: 18 | {{- range .hosts }} 19 | - {{ . | quote }} 20 | {{- end }} 21 | secretName: {{ .secretName }} 22 | {{- end }} 23 | {{- end }} 24 | rules: 25 | {{- range .Values.ingress.hosts }} 26 | - host: {{ .host | quote }} 27 | http: 28 | paths: 29 | {{- range .paths }} 30 | - path: {{ . }} 31 | backend: 32 | serviceName: {{ $fullName }} 33 | servicePort: http 34 | {{- end }} 35 | {{- end }} 36 | {{- end }} 37 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/templates/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: {{ include "video-analytics-demo.fullname" . }} 5 | labels: 6 | {{ include "video-analytics-demo.labels" . | indent 4 }} 7 | spec: 8 | {{- if .Values.service.rtspnodePort }} 9 | type: {{ .Values.service.type }} 10 | {{- end }} 11 | ports: 12 | - port: {{ .Values.service.port }} 13 | targetPort: http 14 | protocol: TCP 15 | name: http 16 | {{- if .Values.service.rtspnodePort }} 17 | nodePort: {{ .Values.service.rtspnodePort }} 18 | {{- end }} 19 | selector: 20 | app.kubernetes.io/name: {{ include "video-analytics-demo.name" . }} 21 | app.kubernetes.io/instance: {{ .Release.Name }} 22 | --- 23 | apiVersion: v1 24 | kind: Service 25 | metadata: 26 | name: {{ include "video-analytics-demo.fullname" . }}-webui 27 | labels: 28 | name: {{ include "video-analytics-demo.fullname" . }}-webui 29 | spec: 30 | type: {{ .Values.service.type }} 31 | ports: 32 | - port: 80 33 | name: http 34 | protocol: TCP 35 | targetPort: 80 36 | nodePort: {{ .Values.service.webuinodePort }} 37 | selector: 38 | name: {{ include "video-analytics-demo.fullname" . }}-webui 39 | --- 40 | apiVersion: v1 41 | kind: Service 42 | metadata: 43 | name: {{ include "video-analytics-demo.fullname" . }}-web 44 | labels: 45 | name: {{ include "video-analytics-demo.fullname" . }}-webui 46 | spec: 47 | ports: 48 | - port: {{ .Values.service.webuiPort }} 49 | name: webui 50 | protocol: TCP 51 | targetPort: webui 52 | selector: 53 | name: {{ include "video-analytics-demo.fullname" . }}-webui 54 | 55 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/templates/tests/test-connection.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: "{{ include "video-analytics-demo.fullname" . }}-test-connection" 5 | labels: 6 | {{ include "video-analytics-demo.labels" . | indent 4 }} 7 | annotations: 8 | "helm.sh/hook": test-success 9 | spec: 10 | containers: 11 | - name: wget 12 | image: busybox 13 | command: ['wget'] 14 | args: ['{{ include "video-analytics-demo.fullname" . }}:{{ .Values.service.port }}'] 15 | restartPolicy: Never 16 | -------------------------------------------------------------------------------- /azure-iot/video-analytics-demo/values.yaml: -------------------------------------------------------------------------------- 1 | # Default values for video-analytics-demo 2 | # This is a YAML-formatted file. 3 | # Declare variables to be passed into your templates. 4 | 5 | iotdeviceconnectionstring: "HostName=egx-iot.azure-devices.net;DeviceId=egx-iot-device;SharedAccessKey=F1/EOVGtm2b3fFzXa8DILX4atinfTQpuHPC5UnN/Tl4=" 6 | 7 | replicaCount: 1 8 | 9 | image: 10 | repository: nvcr.io/nvidia/deepstream 11 | tag: 6.1-samples 12 | pullPolicy: IfNotPresent 13 | webui: anguda/ant-media:1.0 14 | 15 | ngcModel: 16 | #NGC Model Pruned URL from NGC 17 | getModel: ngc registry model download-version "nvidia/tao/trafficcamnet:pruned_v1.0.1" 18 | #NGC model name 19 | name: trafficcamnet 20 | # Model File Name that will use in Deepstream 21 | fileName: resnet18_trafficcamnet_pruned.etlt 22 | # Model Config that needs to update 23 | modelConfig: config_infer_primary_trafficcamnet.txt 24 | #Do not update the Put Model 25 | putModel: /opt/nvidia/deepstream/deepstream-6.1/samples/configs/tao_pretrained_models/ 26 | 27 | ngcConfig: 28 | apikey: "" 29 | ngcorg: "nvidian" 30 | ngcteam: "no-team" 31 | 32 | imagePullSecrets: 33 | - name: nvidia-registrykey-secret 34 | nameOverride: "" 35 | fullnameOverride: "" 36 | 37 | command: 38 | apprunnercmd: "python" 39 | apprunnername: "/opt/nvidia/deepstream/create_config.py" 40 | appname: "deepstream-app" 41 | apparg: "/opt/nvidia/deepstream/deepstream-6.1/samples/configs/deepstream-app/source4_1080p_dec_infer-resnet_tracker_sgie_tiled_display_int8.txt" 42 | 43 | service: 44 | type: NodePort 45 | port: 80 46 | webuiPort: 5080 47 | webuinodePort: 31115 48 | 49 | 50 | #specify camera IP as rtsp://username:password@ip 51 | #or rtsp://ip if it has no username and password 52 | 53 | cameras: 54 | #camera1: 55 | 56 | ingress: 57 | enabled: false 58 | annotations: {} 59 | # kubernetes.io/ingress.class: nginx 60 | # kubernetes.io/tls-acme: "true" 61 | hosts: 62 | - host: chart-example.local 63 | paths: [] 64 | 65 | tls: [] 66 | # - secretName: chart-example-tls 67 | # hosts: 68 | # - chart-example.local 69 | 70 | resources: 71 | # We usually recommend not to specify default resources and to leave this as a conscious 72 | # choice for the user. This also increases chances charts run on environments with little 73 | # resources, such as Minikube. If you do want to specify resources, uncomment the following 74 | # lines, adjust them as necessary, and remove the curly braces after 'resources:'. 75 | limits: 76 | nvidia.com/gpu: 1 77 | # cpu: 100m 78 | # memory: 128Mi 79 | #requests: 80 | # nvidia.com/gpu: 1 81 | # cpu: 100m 82 | # memory: 128Mi 83 | 84 | #gpuType: nvidia.com/gpu 85 | #numGPUs: 1 86 | # 87 | deployment: 88 | strategy: Recreate 89 | 90 | nodeSelector: {} 91 | 92 | tolerations: [] 93 | 94 | affinity: {} 95 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # NVIDIA Fleet Command 2 | 3 | ## Introduction 4 | NVIDIA Fleet Command is a hybrid-cloud platform for securely and remotely deploying, managing, and scaling AI across dozens or up to thousands of servers or edge devices. Instead of spending weeks planning and executing deployments, administrators can in minutes scale AI to retail stores, warehouses, hospitals, or city street intersections. With the capability of an entire IT division in a single control plane, administrators can manage the lifecycle of AI applications, update system software over the air, and remotely monitor and access systems. 5 | 6 | This repository contains different projects that are used by fleet command. Please find the below 7 | - [Azure IoT](https://github.com/NVIDIA/fleet-command/tree/master/azure-iot) 8 | --------------------------------------------------------------------------------