maintenance

pull/4881/head
Brett Jones 4 years ago
parent 9d7413aa22
commit 9583c49bb8
No known key found for this signature in database
GPG Key ID: C405583E64F8BBCB
  1. 2
      config/manager/kustomization.yaml
  2. 20
      controllers/lokistack_controller.go
  3. 15
      internal/manifests/build.go
  4. 2
      internal/manifests/config.go
  5. 2
      internal/manifests/distributor.go
  6. 2
      internal/manifests/ingester.go
  7. 0
      internal/manifests/internal/config/build.go
  8. 0
      internal/manifests/internal/config/loki-config.yaml
  9. 0
      internal/manifests/internal/config/options.go
  10. 9
      internal/manifests/options.go
  11. 2
      internal/manifests/querier.go
  12. 2
      internal/manifests/query-frontend.go

@ -13,4 +13,4 @@ kind: Kustomization
images:
- name: controller
newName: quay.io/blockloop/loki-operator
newTag: "1616076328"
newTag: "1616092265"

@ -28,6 +28,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/predicate"
apierrors "k8s.io/apimachinery/pkg/api/errors"
lokiv1beta1 "github.com/ViaQ/loki-operator/api/v1beta1"
)
@ -56,11 +57,26 @@ type LokiStackReconciler struct {
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.7.0/pkg/reconcile
func (r *LokiStackReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
ll := log.WithValues("lokistack", req.NamespacedName)
ll := log.WithValues("lokistack", req.NamespacedName, "event", "create")
var stack lokiv1beta1.LokiStack
if err := r.Get(ctx, req.NamespacedName, &stack); err != nil {
if apierrors.IsNotFound(err) {
// maybe the user deleted it before we could react? Either way this isn't an issue
ll.Error(err, "could not find the requested loki stack", "name", req.NamespacedName)
return ctrl.Result{}, nil
}
}
// here we will translate the
opts := manifests.Options{
Name: req.Name,
Namespace: req.Namespace,
}
ll.Info("begin building manifests")
objects, err := manifests.BuildAll(req.Name, req.Namespace)
objects, err := manifests.BuildAll(opts)
if err != nil {
ll.Error(err, "failed to build manifests")
return ctrl.Result{

@ -5,20 +5,19 @@ import (
)
// BuildAll builds all manifests required to run a Loki Stack
// TODO add options parameter to enable resource sizing, and other configurations
func BuildAll(stackName, namespace string) ([]client.Object, error) {
func BuildAll(opt Options) ([]client.Object, error) {
res := make([]client.Object, 0)
cm, err := LokiConfigMap(stackName, namespace)
cm, err := LokiConfigMap(opt.Name, opt.Namespace)
if err != nil {
return nil, err
}
res = append(res, cm)
res = append(res, BuildDistributor(stackName)...)
res = append(res, BuildIngester(stackName)...)
res = append(res, BuildQuerier(stackName)...)
res = append(res, BuildQueryFrontend(stackName)...)
res = append(res, LokiGossipRingService(stackName))
res = append(res, BuildDistributor(opt.Name)...)
res = append(res, BuildIngester(opt.Name)...)
res = append(res, BuildQuerier(opt.Name)...)
res = append(res, BuildQueryFrontend(opt.Name)...)
res = append(res, LokiGossipRingService(opt.Name))
return res, nil
}

@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"github.com/ViaQ/loki-operator/internal/manifests/config"
"github.com/ViaQ/loki-operator/internal/manifests/internal/config"
apps "k8s.io/api/apps/v1"
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

@ -4,7 +4,7 @@ import (
"fmt"
"path"
"github.com/ViaQ/loki-operator/internal/manifests/config"
"github.com/ViaQ/loki-operator/internal/manifests/internal/config"
apps "k8s.io/api/apps/v1"
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

@ -4,7 +4,7 @@ import (
"fmt"
"path"
"github.com/ViaQ/loki-operator/internal/manifests/config"
"github.com/ViaQ/loki-operator/internal/manifests/internal/config"
apps "k8s.io/api/apps/v1"
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

@ -0,0 +1,9 @@
package manifests
// Options is a set of options to use when building manifests such as resource sizes, etc.
// Most of this should be provided - either directly or indirectly - by the user. This will
// probably be converted from the CR.
type Options struct {
Name string
Namespace string
}

@ -4,7 +4,7 @@ import (
"fmt"
"path"
"github.com/ViaQ/loki-operator/internal/manifests/config"
"github.com/ViaQ/loki-operator/internal/manifests/internal/config"
apps "k8s.io/api/apps/v1"
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

@ -4,7 +4,7 @@ import (
"fmt"
"path"
"github.com/ViaQ/loki-operator/internal/manifests/config"
"github.com/ViaQ/loki-operator/internal/manifests/internal/config"
apps "k8s.io/api/apps/v1"
core "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

Loading…
Cancel
Save