generated from kedacore/github-template
/
app.go
55 lines (49 loc) · 1.31 KB
/
app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package http
import (
"context"
"github.com/go-logr/logr"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/kedacore/http-add-on/operator/apis/http/v1alpha1"
"github.com/kedacore/http-add-on/operator/controllers/http/config"
)
func (r *HTTPScaledObjectReconciler) createOrUpdateApplicationResources(
ctx context.Context,
logger logr.Logger,
cl client.Client,
baseConfig config.Base,
externalScalerConfig config.ExternalScaler,
httpso *v1alpha1.HTTPScaledObject,
) error {
defer SaveStatus(context.Background(), logger, cl, httpso)
logger = logger.WithValues(
"reconciler.appObjects",
"addObjects",
"HTTPScaledObject.name",
httpso.Name,
"HTTPScaledObject.namespace",
httpso.Namespace,
)
// set initial statuses
AddOrUpdateCondition(
httpso,
*SetMessage(
CreateCondition(
v1alpha1.Pending,
v1.ConditionUnknown,
v1alpha1.PendingCreation,
),
"Identified HTTPScaledObject creation signal"),
)
// create the KEDA core ScaledObjects (not the HTTP one) for
// the app deployment and the interceptor deployment.
// this needs to be submitted so that KEDA will scale both the app and
// interceptor
return r.createOrUpdateScaledObject(
ctx,
cl,
logger,
externalScalerConfig.HostName(baseConfig.CurrentNamespace),
httpso,
)
}