Source generation in System.Text.Json, should I care?

Posted on

With the release of .NET 6 also came the option to use source generation in System.Text.Json. In short this means that instead of runtime reflection some of the work is now done compile time. This makes it more efficient. But how much? And should I care? Just measure it. I made a small project that you can use and adjust to measure the difference for your specific case. Let the results help you decide what's best for your application. Benchmarking codeThe code can be found here: netwatwezoeken/jsonbenchmark (github.com). It uses BenchmarkDotNet for measurements and Bogus to generate fake data.…

Read more »

Safer Jenkins pipelines on kubernetes

Jenkins and kubernetes are a great combination. I love the concept of leveraing container technology to provide any build tools that you might require. However in many cases the examples provided are not always the best or most secure. In Section 10.2.2 Building your image of Mannings Microservices in Action the following Jenkins Pipeline script is suggested: def withPod(body) { podTemplate(label: 'pod', serviceAccount: 'jenkins', containers: [ containerTemplate(name: 'docker', image: 'docker', command: 'cat', ttyEnabled: true), containerTemplate(name: 'kubectl', image: 'morga…

Read more »

Automated Kubernetes installation on Hyper-V

This artice describes how you can create a kubernetes custer using Vagrant, Hyper-V and Packer. Update (11-05-2020)I have updated the scripts to use contianerd in favor of docker. Don't worry using docker is still possible. In /packer/ubuntu-18.04-amd64.json replace containerd.sh woth docker.sh. Why? I found myself in the need of having a kubernetes test cluster. Instead of using minikube or enabling Kubernetes on Docker Desktop. I thought I could learn from setting up a cluster from scratch. This also allows me to easiliy simulate network failures or have nodes go down. Prerequisites Hyper-V…

Read more »

Static IPs with NAT on Hyper-V

Posted on

The goal is to have networking with static ip addresses for virtual machines on Hyper-V. The machine must also be able to access the internet. The easiest way is to start a Powershell session with elevated rights. Then use the follwing three commands. Feel free to change any names and ip address ranges. Create a new switch New-VMSwitch -SwitchName "NAT Switch 192.168.40.x" -SwitchType Internal Assign and IP address New-NetIPAddress -IPAddress 192.168.40.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NAT Switch 192.168.40.x)" Enable NAT New-NetNAT -Name "NATNetwork&qu…

Read more »