Skip to content

Instantly share code, notes, and snippets.

// default way:
"instancePoolId": "my-instance-pool-id-123"
// referencing key vault secret:
"instancePoolId": {
"type": "AzureKeyVaultSecret",
"store": {
"referenceName": "KeyVault_Service", <-- Existing linked service to key vault
"type": "LinkedServiceReference"
@PostMapping("/HttpTriggerWithOutputs")
public InvokeResponse HttpTriggerWithOutputs(){
InvokeResponse resp = new InvokeResponse();
resp.ReturnValue = "return val data here";
Map<String, Object> headers = new HashMap<String, Object>();
headers.put("header1", "header1Val");
headers.put("header2", "header2Val");
Map<String, Object> httpRes = new HashMap<String,Object>();
@PostMapping("/process-items")
public InvokeResponse processItems(@RequestBody InvokeRequest req) {
System.out.println("JAVA: Received items and sending... elsewhere...");
// we get a list of items, and do *something*
// ... then push them somewhere else...
InvokeResponse resp = new InvokeResponse();
resp.Outputs.put("output1", req.Data);
{
"bindings": [
{
"name": "items",
"type": "queueTrigger",
"direction": "in",
"queueName": "items",
"connection": "storageQueue"
},
{
public class InvokeResponse {
public Map<String, Object> Outputs;
public ArrayList<String> Logs;
public Object ReturnValue;
public InvokeResponse(){
Outputs = new HashMap<String,Object>();
Logs = new ArrayList<String>();
}
}
// InvokeRequest object
public class InvokeRequest {
public Map<String, Object> Data;
public Map<String, Object> Metadata;
public InvokeRequest(){
Data = new HashMap<String, Object>();
Metadata = new HashMap<String, Object>();
}
}
apiVersion: v1
kind: Service
metadata:
name: psc-webhook-service
namespace: psc-system
selfLink: /api/v1/namespaces/psc-system/services/psc-webhook-service
spec:
clusterIP: 10.98.155.51
ports:
- port: 443
apiVersion: v1
kind: Endpoints
metadata:
name: psc-webhook-service
namespace: psc-system
subsets:
- addresses:
- ip: 18.185.254.87 #0.tcp.eu.ngrok.io
ports:
- port:
@damoodamoo
damoodamoo / Makefile-local-debug
Created January 14, 2020 14:53
Makefile for local webhook debugging
copy-running-certs:
kubectl get secret webhook-server-cert -n psc-system -o json | sed 's/ca.crt/cacrt/; s/tls.crt/tlscrt/; s/tls.key/tlskey/' > secrets.json
mkdir -p ./.running-keys
jq -r .data.cacrt < secrets.json | base64 --decode > ./.running-keys/ca.crt
jq -r .data.tlscrt < secrets.json | base64 --decode > ./.running-keys/tls.crt
jq -r .data.tlskey < secrets.json | base64 --decode > ./.running-keys/tls.key
mkdir -p /tmp/k8s-webhook-server/serving-certs
cp ./.running-keys/* /tmp/k8s-webhook-server/serving-certs/
rm secrets.json