what basic difference between convergence , idempotence in chef?
convergence , idempotence not chef-specific. they're attributed configuration management theory, though have use in other fields, notably mathematics.
let's start more basic, idempotent. we're going ignore mathematic use of idempotent, , focus instead on configuration management people mean when talk it. is: "multiple applications of same action not have side effects on system state." simple example of idempotent operation mkdir -p
:
mkdir -p /var/lib/statedir/myapp
no matter how many times run command, result in tree being created. way of stating idempotent operations is, "running tool on , on doesn't change system after first time."
now contrast convergence. generically, converge means bring [people or] things together. in configuration management, convergence means bring system state in line defined policy. is, changes made on system if need made. simple example of convergent operation is:
if [ ! -d /var/lib/statedir/myapp ]; mkdir -p /var/lib/statedir/myapp fi
this convergent because we're executing mkdir command if desired directory not exist. call "test , repair" operation. is, test current state of specific thing we're managing, , repair specific command or operation if not in state. chef behind scenes resource this:
directory '/var/lib/statedir/myapp' recursive true end
the way (chef) talk chef takes idempotent actions converge system state declared various resources. every resource in chef declarative, , performs test current state of resource, , repairs system match that.
to deeper weeds how chef works, has "compile" phase , "converge" phase in chef run. in "compile" phase, evaluates ruby recipes on node, , looking resource objects adds "resource collection." once has evaluated recipes, enters "converge" phase iterates on resource collection, taking appropriate action put resources desired state, whereby users created, files written, packages installed, , forth.
Comments
Post a Comment