Skip to content

Instantly share code, notes, and snippets.

View darkowlzz's full-sized avatar

Sunny darkowlzz

  • ‏‏‏‏‎ ‎
View GitHub Profile
@darkowlzz
darkowlzz / results-of-reconciliation.md
Created February 10, 2022 15:05
Results of Reconciliation (draft)

Results of Reconciliation

In a controller, a reconciliation loop execution performs some domain specific operations to eliminate any drift in the declared configuration and the state of the world. Usually, the result of the core operations of the reconciliation is directly a change in the world based on the declared configuration. Other results of the reconciliation are the reported status on the object, ctrl.Result value and any error during the reconciliation. The ctrl.Result and error are runtime results, and the reported status is an API change result on the target object. Based on the controller-patterns(flux) document, the core

@darkowlzz
darkowlzz / controller-patterns.md
Last active March 24, 2023 20:19
controller-patterns (flux)

Controller Patterns

This document describes some controller patterns built on top of the controller-runtime/kubebuilder tooling to help simplify how the controller code is written and organized. It does that by creating some abstractions and patterns to reduce the cognitive load while reading and writing controller code. Some of these are inspired by the ideas from the cluster API (CAPI) controllers, modified to fit the needs of flux controllers because of the differences in the domain of operations. Familiarity with controller code structure created by the kubebuilder scaffold is assumed.

kstatus - conditions and generations check

This document describes how the checker tool (CLI and library) can perform Kubernetes object status conditions and generations check as per [kstatus][kstatus_doc].

Before running the tests, the checker is provided with some context about the controller:

  • The status conditions it supports with their polarity and priority of the conditions.

kstatus conditions

The [kstatus document][kstatus_doc] describes a few concepts related to the status conditions and a few standard conditions that controllers can implement. This document tries to provide more details about the status conditions with various examples to describe the mechanics of how the conditions work, what they mean and what we can expected from them.

Starting with an example of status conditions:

Keybase proof

I hereby claim:

  • I am darkowlzz on github.
  • I am darkowlzz (https://keybase.io/darkowlzz) on keybase.
  • I have a public key whose fingerprint is A11B 7A23 3C47 6999 2452 C961 4322 DE32 A726 C94E

To claim this, I am signing this object:

// main div which contains all contents except nav
var contentDiv = document.getElementById('content');
//Constructor for different views
function View(viewName){
var self = this;
console.log(this+ viewName);
//view name
this.viewName = viewName;
//file that has to be loaded
@darkowlzz
darkowlzz / gist:cca53999b5fee4e9fb2a
Created December 3, 2014 11:25
Callback based connectAll
Bot.prototype.connectAll = function (callback) {
var that = this;
that.client.connect(5, function (input) {
that.channels.forEach(function (channel, index, channels) {
that.client.join(channel, function (input) {
if (index === (channels.length - 1)) {
if (!! callback)
callback();
}
});
var Bot = require('mybot');
var config = {
nick: 'mfpoty',
channels: ['##til'],
server: 'irc.freenode.net'
};
var bot = new Bot(config);
bot.connectAll();
@darkowlzz
darkowlzz / gist:4cfb750ff6ae3602ffc3
Created November 24, 2014 23:05
simple mybot deployment on heroku
var http = require('http');
var request = require('request');
var port = process.env.PORT || 5000;
var Bot = require('mybot');
CHANNEL_NAME = '##til';
var config = {
nick: 'kurochanbot',
server: 'irc.freenode.net',
@darkowlzz
darkowlzz / gist:64f67361ac8a8417baa4
Created June 2, 2014 11:11
zest sample - example.com
{
"about": "This is a Zest script. For more details about Zest visit https://developer.mozilla.org/en-US/docs/Zest",
"zestVersion": "0.3",
"title": "sample title",
"description": "sample description",
"prefix": "",
"author": "anon",
"generatedBy": "zest-addon for firefox",
"parameters": "",
"statements": [