PRANAV SHARMA
PRANAV SHARMA

Reputation: 31

Operator Sdk query regarding fetching an instance from k8 cluster

memcached := &cachev1alpha1.Memcached{} 
err := r.Get(ctx, req.NamespacedName, memcached)

in the above code are we making an empty object of the struct Memcached then getting this instance from the kubernetes cluster.

if this is an empty instance then i saw an example where someone used this instance and assigned values like (scaler is the instance which as start,end , replicas as its struct members)

startTime := scaler.spec.start
endTime := scaler.spec.end
Replicas := scaler.spec.replicas

How can we fetch from empty instance , start ,end replicas by defualt will have some values like 0 or 1 or empty string.

i am a newbie kindly take this in consideration.

i was expecting that before .get we are creating an empty object then fetch that object from k8.

Upvotes: 3

Views: 35

Answers (0)

Related Questions