func()

in operator/apis/operator/v1alpha1/satellite_webhook.go [49:74]


func (r *Satellite) Default(_ context.Context, o runtime.Object) error {
	satellite, ok := o.(*Satellite)
	if !ok {
		return apierrors.NewBadRequest("object is not a Satellite")
	}

	satellitelog.Info("default", "name", satellite.Name)

	image := satellite.Spec.Image
	if image == "" {
		satellite.Spec.Image = fmt.Sprintf("apache/skywalking-satellite:%s", satellite.Spec.Version)
	}

	oapServerName := satellite.Spec.OAPServerName
	if oapServerName == "" {
		satellite.Spec.OAPServerName = satellite.Name
	}

	if satellite.ObjectMeta.Annotations[annotationKeyIstioSetup] == "" {
		satellite.Annotations[annotationKeyIstioSetup] = fmt.Sprintf("istioctl install --set profile=demo "+
			"--set meshConfig.defaultConfig.envoyAccessLogService.address=%s.%s:11800 "+
			"--set meshConfig.enableEnvoyAccessLogService=true", satellite.Name, satellite.Namespace)
	}

	return nil
}