"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pilot/cmd/pilot-agent/status/ready/probe.go" between
istio-1.10.0.tar.gz and istio-1.10.1.tar.gz

About: Istio is a platform-independent service mesh that provides a uniform way to connect, secure, control, and observe microservices.

probe.go  (istio-1.10.0):probe.go  (istio-1.10.1)
skipping to change at line 18 skipping to change at line 18
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package ready package ready
import ( import (
"context"
"fmt" "fmt"
admin "github.com/envoyproxy/go-control-plane/envoy/admin/v3" admin "github.com/envoyproxy/go-control-plane/envoy/admin/v3"
"istio.io/istio/pilot/cmd/pilot-agent/metrics" "istio.io/istio/pilot/cmd/pilot-agent/metrics"
"istio.io/istio/pilot/cmd/pilot-agent/status/util" "istio.io/istio/pilot/cmd/pilot-agent/status/util"
) )
// Probe for readiness. // Probe for readiness.
type Probe struct { type Probe struct {
LocalHostAddr string LocalHostAddr string
AdminPort uint16 AdminPort uint16
receivedFirstUpdate bool receivedFirstUpdate bool
// Indicates that Envoy is ready atleast once so that we can cache and re use that probe. // Indicates that Envoy is ready atleast once so that we can cache and re use that probe.
atleastOnceReady bool atleastOnceReady bool
Context context.Context
} }
type Prober interface { type Prober interface {
// Check executes the probe and returns an error if the probe fails. // Check executes the probe and returns an error if the probe fails.
Check() error Check() error
} }
var _ Prober = &Probe{} var _ Prober = &Probe{}
// Check executes the probe and returns an error if the probe fails. // Check executes the probe and returns an error if the probe fails.
skipping to change at line 74 skipping to change at line 76
if CDSUpdated && LDSUpdated { if CDSUpdated && LDSUpdated {
p.receivedFirstUpdate = true p.receivedFirstUpdate = true
return nil return nil
} }
return fmt.Errorf("config not received from Pilot (is Pilot running?): %s ", s.String()) return fmt.Errorf("config not received from Pilot (is Pilot running?): %s ", s.String())
} }
// isEnvoyReady checks to ensure that Envoy is in the LIVE state and workers hav e started. // isEnvoyReady checks to ensure that Envoy is in the LIVE state and workers hav e started.
func (p *Probe) isEnvoyReady() error { func (p *Probe) isEnvoyReady() error {
if p.Context == nil {
return p.checkEnvoyReadiness()
}
select {
case <-p.Context.Done():
return fmt.Errorf("server is not live, current state is: %s", adm
in.ServerInfo_DRAINING.String())
default:
return p.checkEnvoyReadiness()
}
}
func (p *Probe) checkEnvoyReadiness() error {
// If Envoy is ready atleast once i.e. server state is LIVE and workers // If Envoy is ready atleast once i.e. server state is LIVE and workers
// have started, they will not go back in the life time of Envoy process. // have started, they will not go back in the life time of Envoy process.
// They will only change at hot restart or health check fails. Since Isti o // They will only change at hot restart or health check fails. Since Isti o
// does not use both of them, it is safe to cache this value. Since the // does not use both of them, it is safe to cache this value. Since the
// actual readiness probe goes via Envoy it ensures that Envoy is activel y // actual readiness probe goes via Envoy it ensures that Envoy is activel y
// serving traffic and we can rely on that. // serving traffic and we can rely on that.
if p.atleastOnceReady { if p.atleastOnceReady {
return nil return nil
} }
 End of changes. 3 change blocks. 
0 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)