What is an admission controller?

In a nutshell, Kubernetes admission controllers are plugins that govern and enforce how the cluster is used. They can be thought of as a gatekeeper that intercept (authenticated) API requests and may change the request object or deny the request altogether. The admission control process has two phases: the mutating phase is executed first, followed by the validating phase.

Kubernetes admission Controller Phases:

An admission controller is a piece of software that intercepts requests to the Kubernetes API server before the persistence of the object (the k8s resource such as Pod, Deployment, Service, etc…) in the etcd database, but after…


A few days ago, I was reading about the Kubernetes network model, especially about services and the kube-proxy component, and I discovered that kube-proxy has three modes, which are userspace, iptables and ipvs.

The userspace mode is too old and slow, nowaday nobody recommends to use it, the iptables mode is the default mode for kube-proxy with this mode kube-proxy use iptables rules to forward packets that are destined for services to a backend for that services, and the last one is ipvs I did not know what it was so I read about it.

What is IPVS?

IPVS (IP Virtual Server) is…


A few days ago, I read an article about BigCache and I was interested to know how they avoided these 2 problems:

  • concurrent access
  • expensive GC cycles

I went to their repository and read the code to understand how they achieved it. I think it’s amazing so I would like to share it with you.

‘Fast, concurrent, evicting in-memory cache written to keep big number of entries without impact on performance. BigCache keeps entries on heap but omits GC for them. …


What is Dijkstra?

MEGA SHORT DESCRIPTION: Dijkstra’s algorithm is used to find the shortest path between a and b. It picks the unvisited node with the lowest distance, calculates the distance through it to each unvisited neighbor, and updates the neighbor’s distance if smaller.

  • Mark all nodes unvisited. Create a set of all the unvisited nodes called the unvisited set, in our case we are going to use a set for visited nodes, not for unvisited nodes.
  • Assign to every node a tentative distance value: set it to zero for our initial node. Set the initial node as current.
  • For the current node…


In my company we have an ETL wrote in Golang to process the integrations with our partners, each integration is executed in an unique and isolate POD using cronjob k8s, each one print a bunch of data and metrics for each step executed using log the package in the standard library, all these logs are useful to monitor the integrations with different tools.

In my team now we want to receive an email when some integration is failed with the logs of the process, so for that, we use a feature of log to change the output destination for the…


According to the azure documentation in this excellent article, they state that.

“It’s a good practice, and often a business requirement, to monitor web applications and back-end services, to ensure they’re available and performing correctly. However, it’s more difficult to monitor services running in the cloud than it is to monitor on-premises services.”

“There are many factors that affect cloud-hosted applications such as network latency, the performance, and availability of the underlying compute and storage systems and the network bandwidth between them. The service can fail entirely or partially due to any of these factors. …


Do you remember my last article where I wrote a service to look for a driver like uber? If not, you can check here So now, we going to write the V2 of our service.

Check out the simple version 1 of our service here.

The current state of our service, when a user consumes the resource ‘search’, the user receives a response with the closer driver to him. But what would happen if there are no drivers close to the user?

We don’t want the service client doing a large number of requests to the same endpoint to look…


Part 2: Tracking Service With Go and Redis V2

Imagine that we work at a startup like Uber, and we need to create a new service that saves drivers locations every given time and processes it. This way, when someone requests a driver we can find out which drivers are closest to our pickup point.

This is the core of our service. Save the locations and search nearby drivers. For this service, we are using Go and Redis.

Redis

Redis is an open-source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. It supports data structures…


Authentication is the most common part in any application. You can implement your own authentication system or use one of the many alternatives that exist, but in this case we are going to use OAuth2.

OAuth is a specification that allows users to delegate access to their data without sharing their username and password with that service, if you want to read more about Oauth2 go here.

Config Google Project

First things first, we need to create our Google Project and create OAuth2 credentials.

  • Go to Google Cloud Platform
  • Create a new project or select one if you already have it.
  • Go to…


I needed to create a microservice for manage communications in my app, emails, SMS, and notifications with FCM.

So I decided to create a lib in for FCM for use en my app, Source.

Example:

package mainimport (
"log"
"github.com/douglasmakey/go-fcm"
)
func main() {
// init client
client := fcm.NewClient("ApiKey")

// You can use your HTTPClient
//client.SetHTTPClient(client)

data := map[string]interface{}{
"message": "From Go-FCM",
"details": map[string]string{
"name": "Name",
"user": "Admin",
"thing": "none",
},
}

// You can use PushMultiple or PushSingle
client.PushMultiple([]string{"token 1", "token 2"}, data)
//client.PushSingle("token 1", data)

// registrationIds remove and return map of invalid tokens
badRegistrations := client.CleanRegistrationIds()
log.Println(badRegistrations)

status, err := client.Send()
if err != nil {
log.Fatalf("error: %v", err)
}

log.Println(status.Results)
}

Douglas Mendez

Lifelong Learning. The only way to go fast, is to go well. I'm a kung fu developer 👨🏻‍💻

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store