Henry Du Blog

think digital, act analog

Golang Pass Map Type Parameter

Golang Pass Map Type Parameter Observation When I read this blog section “But maps and channels are references, right?”, I realize that the following code should print true, because Golang pass the map by value, not map address. package main import "fmt" func fn(m map[int]int) { m = make(map[int]int) } func main() { var m map[int]int fn(m) fmt.Println(m == nil) } Analysis This is running result. When the program starts run main function, the active stack frame in memory belongs to main.

Kubernetes Creates Pods: Imperative vs Declarative

Kubernetes Creates Pods: Imperative vs Declarative Introduction Design and implementation microservices may have different approaches. During the design phase, we may need a quick proof of concept, or even multiple PoCs to compare. However, after we have a solid design, we may need to carefully plan how those microservices are working together in the cloud production. It demands us to specifically write Deployment, Service, ServiceAccount, ConfigMap etc. then, compile them to be a helm chart.

Local Postgres Container Setting Up

Local Postgres Container Setting Up This article has been done last couple of years, but it is still useful for developers who are during transition from old school services to the docker container world. For example, we want to implement a service to access local Postgres DB. We can actually apt-get install, yum install or brew install a postgres DB service. However, since we don’t want our local OS has heavy load to run Postgres all the time, using Docker to have a Postgres is a better choice.

Minikube Docker Image Management

Minikube manage docker images Minikube Minikube is a tool that make it easily to run Kubernetes locally. Installing minikube is very naturally for MacOS. After install minikube, we can check minikube status > minikube status minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured We also can list default minikube pods > kubectl get pods -n kube-system NAME READY STATUS RESTARTS AGE coredns-66bff467f8-lnt67 1/1 Running 0 10d etcd-minikube 1/1 Running 0 10d kube-apiserver-minikube 1/1 Running 0 10d kube-controller-manager-minikube 1/1 Running 0 10d kube-proxy-pqg98 1/1 Running 0 10d kube-scheduler-minikube 1/1 Running 0 10d storage-provisioner 1/1 Running 0 10d Create a nginx pod Let’s create a nginx service quickly

Linux Network Namespace

Linux Network Namespace This is study notes from Network Namespace Introduction Network namespace is using for container like docker to implement network isolation. When we create a container, we create a network namespace for it. So the container is not able to see host network such as routing table and arp table. The container has its own routing table and arp table in its namespace. Operation Commands To create a new network namespace, say red, using a command: