Loading deploy.sh +24 −11 Original line number Diff line number Diff line Loading @@ -190,7 +190,17 @@ for EXTRA_MANIFEST in $TFS_EXTRA_MANIFESTS; do printf "\n" done # By now, leave this control here. Some component dependencies are not well handled # By now, leave these controls here. Some component dependencies are not well handled. if [[ "$TFS_COMPONENTS" == *"monitoring"* ]]; then echo "Waiting for 'MonitoringDB' component..." # Kubernetes does not implement --for='condition=available' for statefulsets. # By now, we assume a single replica of monitoringdb. To be updated in future releases. kubectl wait --namespace $TFS_K8S_NAMESPACE \ --for=jsonpath='{.status.readyReplicas}'=1 --timeout=300s statefulset/monitoringdb printf "\n" fi for COMPONENT in $TFS_COMPONENTS; do echo "Waiting for '$COMPONENT' component..." kubectl wait --namespace $TFS_K8S_NAMESPACE \ Loading Loading @@ -247,19 +257,22 @@ if [[ "$TFS_COMPONENTS" == *"webui"* ]] && [[ "$TFS_COMPONENTS" == *"monitoring" "url" : "monitoringservice:8812", "database" : "monitoring", "user" : "admin", "password" : "quest", "basicAuth": false, "isDefault": true, "jsonData" : { "sslmode" : "disable", "postgresVersion" : 1100, "maxOpenConns" : 0, "maxIdleConns" : 2, "connMaxLifetime" : 14400, "tlsAuth" : false, "tlsAuthWithCACert" : false, "timescaledb" : false, "tlsConfigurationMethod": "file-path", "tlsSkipVerify" : true }, "secureJsonFields" : { "password" : true "secureJsonData": { "password": "quest" } }' ${GRAFANA_URL_UPDATED}/api/datasources echo Loading @@ -267,7 +280,7 @@ if [[ "$TFS_COMPONENTS" == *"webui"* ]] && [[ "$TFS_COMPONENTS" == *"monitoring" # Create Monitoring Dashboard # Ref: https://grafana.com/docs/grafana/latest/http_api/dashboard/ curl -X POST -H "Content-Type: application/json" \ -d '@src/webui/grafana_dashboard.json' \ -d '@src/webui/grafana_dashboard_psql.json' \ ${GRAFANA_URL_UPDATED}/api/dashboards/db echo Loading manifests/monitoringservice.yaml +8 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ spec: apiVersion: apps/v1 kind: Deployment metadata: name: monitoringserver name: monitoringservice spec: selector: matchLabels: Loading Loading @@ -89,6 +89,13 @@ spec: livenessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:7070"] resources: requests: cpu: 250m memory: 512Mi limits: cpu: 700m memory: 1024Mi --- apiVersion: v1 kind: Service Loading my_deploy.sh +7 −0 Original line number Diff line number Diff line # Set the URL of your local Docker registry where the images will be uploaded to. export TFS_REGISTRY_IMAGE="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. Loading @@ -10,6 +11,12 @@ export TFS_COMPONENTS="context device automation pathcomp service slice compute # Set the tag you want to use for your images. export TFS_IMAGE_TAG="dev" # Set the name of the Kubernetes namespace to deploy to. export TFS_K8S_NAMESPACE="tfs" # Set additional manifest files to be applied after the deployment export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml" # Set the neew Grafana admin password export TFS_GRAFANA_PASSWORD="admin123+" proto/context_policy.proto +2 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import "policy.proto"; service ContextPolicyService { rpc ListPolicyRuleIds(context.Empty ) returns (policy.PolicyRuleIdList) {} rpc ListPolicyRules (context.Empty ) returns (policy.PolicyRuleList ) {} rpc GetPolicyRule (policy.PolicyRuleId ) returns (policy.PolicyRuleBasic ) {} rpc SetPolicyRule (policy.PolicyRuleBasic) returns (policy.PolicyRuleId ) {} rpc GetPolicyRule (policy.PolicyRuleId ) returns (policy.PolicyRule ) {} rpc SetPolicyRule (policy.PolicyRule ) returns (policy.PolicyRuleId ) {} rpc RemovePolicyRule (policy.PolicyRuleId ) returns (context.Empty ) {} } proto/policy.proto +11 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ service PolicyService { rpc GetPolicyByServiceId (context.ServiceId) returns (PolicyRuleServiceList) {} } enum RuleState { enum PolicyRuleStateEnum { POLICY_UNDEFINED = 0; // Undefined rule state POLICY_FAILED = 1; // Rule failed POLICY_INSERTED = 2; // Rule is just inserted Loading @@ -49,7 +49,8 @@ message PolicyRuleId { } message PolicyRuleState { RuleState policyRuleState = 1; PolicyRuleStateEnum policyRuleState = 1; string policyRuleStateMessage = 2; } // Basic policy rule attributes Loading Loading @@ -83,6 +84,14 @@ message PolicyRuleDevice { repeated context.DeviceId deviceList = 2; } // Wrapper policy rule object message PolicyRule { oneof policy_rule { PolicyRuleService service = 1; PolicyRuleDevice device = 2; } } // A list of policy rule IDs message PolicyRuleIdList { repeated PolicyRuleId policyRuleIdList = 1; Loading Loading
deploy.sh +24 −11 Original line number Diff line number Diff line Loading @@ -190,7 +190,17 @@ for EXTRA_MANIFEST in $TFS_EXTRA_MANIFESTS; do printf "\n" done # By now, leave this control here. Some component dependencies are not well handled # By now, leave these controls here. Some component dependencies are not well handled. if [[ "$TFS_COMPONENTS" == *"monitoring"* ]]; then echo "Waiting for 'MonitoringDB' component..." # Kubernetes does not implement --for='condition=available' for statefulsets. # By now, we assume a single replica of monitoringdb. To be updated in future releases. kubectl wait --namespace $TFS_K8S_NAMESPACE \ --for=jsonpath='{.status.readyReplicas}'=1 --timeout=300s statefulset/monitoringdb printf "\n" fi for COMPONENT in $TFS_COMPONENTS; do echo "Waiting for '$COMPONENT' component..." kubectl wait --namespace $TFS_K8S_NAMESPACE \ Loading Loading @@ -247,19 +257,22 @@ if [[ "$TFS_COMPONENTS" == *"webui"* ]] && [[ "$TFS_COMPONENTS" == *"monitoring" "url" : "monitoringservice:8812", "database" : "monitoring", "user" : "admin", "password" : "quest", "basicAuth": false, "isDefault": true, "jsonData" : { "sslmode" : "disable", "postgresVersion" : 1100, "maxOpenConns" : 0, "maxIdleConns" : 2, "connMaxLifetime" : 14400, "tlsAuth" : false, "tlsAuthWithCACert" : false, "timescaledb" : false, "tlsConfigurationMethod": "file-path", "tlsSkipVerify" : true }, "secureJsonFields" : { "password" : true "secureJsonData": { "password": "quest" } }' ${GRAFANA_URL_UPDATED}/api/datasources echo Loading @@ -267,7 +280,7 @@ if [[ "$TFS_COMPONENTS" == *"webui"* ]] && [[ "$TFS_COMPONENTS" == *"monitoring" # Create Monitoring Dashboard # Ref: https://grafana.com/docs/grafana/latest/http_api/dashboard/ curl -X POST -H "Content-Type: application/json" \ -d '@src/webui/grafana_dashboard.json' \ -d '@src/webui/grafana_dashboard_psql.json' \ ${GRAFANA_URL_UPDATED}/api/dashboards/db echo Loading
manifests/monitoringservice.yaml +8 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ spec: apiVersion: apps/v1 kind: Deployment metadata: name: monitoringserver name: monitoringservice spec: selector: matchLabels: Loading Loading @@ -89,6 +89,13 @@ spec: livenessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:7070"] resources: requests: cpu: 250m memory: 512Mi limits: cpu: 700m memory: 1024Mi --- apiVersion: v1 kind: Service Loading
my_deploy.sh +7 −0 Original line number Diff line number Diff line # Set the URL of your local Docker registry where the images will be uploaded to. export TFS_REGISTRY_IMAGE="http://localhost:32000/tfs/" # Set the list of components, separated by spaces, you want to build images for, and deploy. Loading @@ -10,6 +11,12 @@ export TFS_COMPONENTS="context device automation pathcomp service slice compute # Set the tag you want to use for your images. export TFS_IMAGE_TAG="dev" # Set the name of the Kubernetes namespace to deploy to. export TFS_K8S_NAMESPACE="tfs" # Set additional manifest files to be applied after the deployment export TFS_EXTRA_MANIFESTS="manifests/nginx_ingress_http.yaml" # Set the neew Grafana admin password export TFS_GRAFANA_PASSWORD="admin123+"
proto/context_policy.proto +2 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import "policy.proto"; service ContextPolicyService { rpc ListPolicyRuleIds(context.Empty ) returns (policy.PolicyRuleIdList) {} rpc ListPolicyRules (context.Empty ) returns (policy.PolicyRuleList ) {} rpc GetPolicyRule (policy.PolicyRuleId ) returns (policy.PolicyRuleBasic ) {} rpc SetPolicyRule (policy.PolicyRuleBasic) returns (policy.PolicyRuleId ) {} rpc GetPolicyRule (policy.PolicyRuleId ) returns (policy.PolicyRule ) {} rpc SetPolicyRule (policy.PolicyRule ) returns (policy.PolicyRuleId ) {} rpc RemovePolicyRule (policy.PolicyRuleId ) returns (context.Empty ) {} }
proto/policy.proto +11 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ service PolicyService { rpc GetPolicyByServiceId (context.ServiceId) returns (PolicyRuleServiceList) {} } enum RuleState { enum PolicyRuleStateEnum { POLICY_UNDEFINED = 0; // Undefined rule state POLICY_FAILED = 1; // Rule failed POLICY_INSERTED = 2; // Rule is just inserted Loading @@ -49,7 +49,8 @@ message PolicyRuleId { } message PolicyRuleState { RuleState policyRuleState = 1; PolicyRuleStateEnum policyRuleState = 1; string policyRuleStateMessage = 2; } // Basic policy rule attributes Loading Loading @@ -83,6 +84,14 @@ message PolicyRuleDevice { repeated context.DeviceId deviceList = 2; } // Wrapper policy rule object message PolicyRule { oneof policy_rule { PolicyRuleService service = 1; PolicyRuleDevice device = 2; } } // A list of policy rule IDs message PolicyRuleIdList { repeated PolicyRuleId policyRuleIdList = 1; Loading