Readiness and liveness probes
- это то, как ваш кластер проверяет состояние одного модуля.
Вам необходимо определить их в вашем манифесте:
apiVersion: v1
kind: Pod
metadata:
name: goproxy
labels:
app: goproxy
spec:
containers:
- name: goproxy
image: k8s.gcr.io/goproxy:0.1
ports:
- containerPort: 8080
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 15
periodSeconds: 20
Когда ваш блок работает kubectl port-forward
будет работать немедленно.
Вы можете прочитать некоторую теорию по адресу:
https://kubernetes.io/docs/tasks/configure-pod-container/configure -liveness-готовности-зонды /
Вы можете просто переместить определение iterator
в vector
:
template <class T>
class vector {
public:
class iterator {
/* How you implement a iterator of type T */
};
iterator begin(); // for example
// other fantastic stuff
};
template <class T>
vector<T>::iterator vector<T>::begin()
{
// whatever
}
Если вы не хотите определять iterator
внутри, это может сделать:
template <class T>
class vector {
public:
class iterator; // only a declaration
iterator begin(); // same
// other fantastic stuff
};
template <class T>
class vector<T>::iterator {
// the actual definition goes here
};
template <class T>
vector<T>::iterator vector<T>::begin()
{
// same
}
[ 1110] Кроме того, вы также можете определить iterator
отдельно и сделать vector::iterator
псевдонимом:
template <class T>
class iterator { /* real definition */ };
template <class T>
class vector {
public:
using iterator = ::iterator<T>;
// or typedef ::iterator<T> iterator;
iterator begin(); // still the same
// same fantastic stuff
};
template <class T>
vector<T>::iterator vector<T>::begin()
{
// all the same
}
Надеюсь, это поможет.