Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit 5047a5f

Browse files
authored
v0.0.2 (#31)
1 parent 79bd988 commit 5047a5f

22 files changed

+43
-765
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
</div>
1919

20-
Parseable is a lightweight, cloud native log observability engine. Written in Rust, Parseable is built for high ingestion rates and low resource consumption. It is compatible with all major log agents and can be configured to collect logs from any source. Read more in [Parseable docs](https://www.parseable.io/docs).
20+
Parseable is a lightweight, cloud native log observability engine. Written in Rust, Parseable is built for high ingestion rates and low resource consumption. It is compatible with all major log agents and can be configured to collect logs from any source. Read more in [Parseable docs](https://www.parseable.io/docs). Parseable operator spec adhere's to [Dsoi-Spec](https://github.com/datainfrahq/dsoi-spec) and uses [Operator-Runtime](https://github.com/datainfrahq/operator-runtime).
2121

2222
## Parseable Operator
2323

cmd/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import (
3333
"sigs.k8s.io/controller-runtime/pkg/healthz"
3434
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3535

36-
parseableiov1beta1 "github.com/parseablehq/parseable-operator/api/v1beta1"
37-
parseabletenantcontroller "github.com/parseablehq/parseable-operator/internal/tenant_controller"
36+
parseableiov1beta1 "github.com/parseablehq/operator/api/v1beta1"
37+
parseabletenantcontroller "github.com/parseablehq/operator/internal/tenant_controller"
3838
//+kubebuilder:scaffold:imports
3939
)
4040

config/samples/parseable-persistent.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ spec:
1212
nodes:
1313
- name: parseable
1414
type: server
15-
kind: Deployment
15+
kind: Statefulset
1616
replicas: 1
1717
k8sConfig: parseable-server
1818
parseableConfig: parseable-server-config

go.mod

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
module github.com/parseablehq/parseable-operator
1+
module github.com/parseablehq/operator
22

33
go 1.19
44

55
require (
66
github.com/go-logr/logr v1.2.4
77
github.com/onsi/ginkgo/v2 v2.9.2
88
github.com/onsi/gomega v1.27.6
9+
github.com/datainfrahq/operator-runtime v0.0.0-20230416210109-3014824613c2
910
k8s.io/api v0.26.3
1011
k8s.io/apimachinery v0.26.3
1112
k8s.io/client-go v0.26.3

go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX
1717
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
1818
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
1919
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
20+
github.com/datainfrahq/operator-runtime v0.0.0-20230416210109-3014824613c2 h1:1PYNxv5hWSqapuou9LSDOlqO93X6iG4d9S7BESJTFr0=
21+
github.com/datainfrahq/operator-runtime v0.0.0-20230416210109-3014824613c2/go.mod h1:Pd4ny0zdmpQIBYtZnK1knh0DFqUQ6LIdi71DsAXDr3E=
2022
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2123
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2224
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -125,6 +127,8 @@ github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU=
125127
github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts=
126128
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
127129
github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg=
130+
github.com/parseablehq/parseable-operator v0.0.1 h1:prAkVOvsRyf5BAYX5BMcwJLdtziisaCs8vVZJBZZwxM=
131+
github.com/parseablehq/parseable-operator v0.0.1/go.mod h1:pl3uFTDnzSdOOej6ujklr5IYc7rVvCQ6T9yddPhxFxw=
128132
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
129133
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
130134
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=

internal/tenant_controller/constructors.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package parseabletenantcontroller
22

33
import (
4-
"github.com/parseablehq/parseable-operator/api/v1beta1"
4+
"github.com/parseablehq/operator/api/v1beta1"
55
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
66
"k8s.io/apimachinery/pkg/types"
77
)

internal/tenant_controller/internal_builder.go

+26-20
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package parseabletenantcontroller
33
import (
44
"fmt"
55

6-
"github.com/parseablehq/parseable-operator/api/v1beta1"
7-
"github.com/parseablehq/parseable-operator/pkg/operator-builder/builder"
8-
"github.com/parseablehq/parseable-operator/pkg/operator-builder/utils"
6+
"github.com/datainfrahq/operator-runtime/builder"
7+
"github.com/datainfrahq/operator-runtime/utils"
8+
"github.com/parseablehq/operator/api/v1beta1"
99
v1 "k8s.io/api/core/v1"
1010
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1111

@@ -84,21 +84,21 @@ func (ib *internalBuilder) makeParseableConfigMap(
8484

8585
func (ib *internalBuilder) makeStsOrDeploy(
8686
ptNode *v1beta1.NodeSpec,
87-
k8sConfigGroup *v1beta1.K8sConfigSpec,
87+
k8sConfigSpec *v1beta1.K8sConfigSpec,
8888
storageConfig *[]v1beta1.StorageConfig,
89-
parseableConfig *v1beta1.ParseableConfigSpec,
89+
parseableConfigSpec *v1beta1.ParseableConfigSpec,
9090
configHash []utils.ConfigMapHash,
9191
) *builder.BuilderDeploymentStatefulSet {
9292

9393
b := false
9494
args := []string{"parseable"}
95-
args = append(args, parseableConfig.CliArgs...)
95+
args = append(args, parseableConfigSpec.CliArgs...)
9696

9797
var envFrom []v1.EnvFromSource
9898
configCm := v1.EnvFromSource{
9999
ConfigMapRef: &v1.ConfigMapEnvSource{
100100
LocalObjectReference: v1.LocalObjectReference{
101-
Name: makeConfigMapName(ptNode.Name, parseableConfig.Name),
101+
Name: makeConfigMapName(ptNode.Name, parseableConfigSpec.Name),
102102
},
103103
},
104104
}
@@ -119,8 +119,8 @@ func (ib *internalBuilder) makeStsOrDeploy(
119119
fsPolicy := v1.FSGroupChangeAlways
120120

121121
podSpec := v1.PodSpec{
122-
NodeSelector: k8sConfigGroup.NodeSelector,
123-
Tolerations: getTolerations(k8sConfigGroup),
122+
NodeSelector: k8sConfigSpec.NodeSelector,
123+
Tolerations: getTolerations(k8sConfigSpec),
124124
SecurityContext: &v1.PodSecurityContext{
125125
RunAsUser: &runner,
126126
RunAsGroup: &runner,
@@ -130,9 +130,9 @@ func (ib *internalBuilder) makeStsOrDeploy(
130130
Containers: []v1.Container{
131131
{
132132
Name: ptNode.Name + "-" + ptNode.Type,
133-
Image: k8sConfigGroup.Image,
133+
Image: k8sConfigSpec.Image,
134134
Args: args,
135-
ImagePullPolicy: k8sConfigGroup.ImagePullPolicy,
135+
ImagePullPolicy: k8sConfigSpec.ImagePullPolicy,
136136
SecurityContext: &v1.SecurityContext{
137137
AllowPrivilegeEscalation: &b,
138138
},
@@ -141,14 +141,14 @@ func (ib *internalBuilder) makeStsOrDeploy(
141141
ContainerPort: 8000,
142142
},
143143
},
144-
Env: getEnv(*k8sConfigGroup, configHash),
144+
Env: getEnv(ib.parseableTenant, parseableConfigSpec, k8sConfigSpec, configHash),
145145
EnvFrom: envFrom,
146-
VolumeMounts: getVolumeMounts(k8sConfigGroup, storageConfig),
147-
Resources: k8sConfigGroup.Resources,
146+
VolumeMounts: getVolumeMounts(k8sConfigSpec, storageConfig),
147+
Resources: k8sConfigSpec.Resources,
148148
},
149149
},
150-
Volumes: getVolume(k8sConfigGroup, storageConfig, ptNode),
151-
ServiceAccountName: k8sConfigGroup.ServiceAccountName,
150+
Volumes: getVolume(k8sConfigSpec, storageConfig, ptNode),
151+
ServiceAccountName: k8sConfigSpec.ServiceAccountName,
152152
}
153153

154154
deployment := builder.BuilderDeploymentStatefulSet{
@@ -260,16 +260,22 @@ func getVolume(
260260
return volumeHolder
261261
}
262262

263-
func getEnv(k8sConfigGroup v1beta1.K8sConfigSpec, configHash []utils.ConfigMapHash) []v1.EnvVar {
263+
func getEnv(
264+
pt *v1beta1.ParseableTenant,
265+
parseableConfigSpec *v1beta1.ParseableConfigSpec,
266+
k8sConfigSpec *v1beta1.K8sConfigSpec,
267+
configHash []utils.ConfigMapHash,
268+
) []v1.EnvVar {
264269
var envs, hashHolder []v1.EnvVar
265-
envs = append(envs, k8sConfigGroup.Env...)
270+
envs = append(envs, k8sConfigSpec.Env...)
266271

267272
hashes, _ := utils.MakeConfigMapHash(configHash)
268273

269274
for _, cmhash := range hashes {
270-
hashHolder = append(hashHolder, v1.EnvVar{Name: cmhash.Name, Value: cmhash.HashVaule})
275+
if makeConfigMapName(pt.Name, parseableConfigSpec.Name) == cmhash.Name {
276+
hashHolder = append(hashHolder, v1.EnvVar{Name: cmhash.Name, Value: cmhash.HashVaule})
277+
}
271278
}
272-
273279
envs = append(envs, hashHolder...)
274280
return envs
275281
}

internal/tenant_controller/parseabletenant_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ import (
3131
"sigs.k8s.io/controller-runtime/pkg/log"
3232

3333
"github.com/go-logr/logr"
34-
"github.com/parseablehq/parseable-operator/api/v1beta1"
35-
parseableiov1beta1 "github.com/parseablehq/parseable-operator/api/v1beta1"
34+
"github.com/parseablehq/operator/api/v1beta1"
35+
parseableiov1beta1 "github.com/parseablehq/operator/api/v1beta1"
3636
)
3737

3838
// ParseableTenantReconciler reconciles a ParseableTenant object

internal/tenant_controller/reconciler.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55

66
v1 "k8s.io/api/core/v1"
77

8+
"github.com/datainfrahq/operator-runtime/builder"
9+
"github.com/datainfrahq/operator-runtime/utils"
810
"github.com/go-logr/logr"
9-
"github.com/parseablehq/parseable-operator/api/v1beta1"
10-
"github.com/parseablehq/parseable-operator/pkg/operator-builder/builder"
11-
"github.com/parseablehq/parseable-operator/pkg/operator-builder/utils"
11+
"github.com/parseablehq/operator/api/v1beta1"
1212
)
1313

1414
func (r *ParseableTenantReconciler) do(ctx context.Context, pt *v1beta1.ParseableTenant, log logr.Logger) error {

internal/tenant_controller/suite_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
logf "sigs.k8s.io/controller-runtime/pkg/log"
3333
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3434

35-
parseableiov1beta1 "github.com/parseablehq/parseable-operator/api/v1beta1"
35+
parseableiov1beta1 "github.com/parseablehq/operator/api/v1beta1"
3636
//+kubebuilder:scaffold:imports
3737
)
3838

pkg/operator-builder/builder/builder.go

-37
This file was deleted.

pkg/operator-builder/builder/builder_client.go

-54
This file was deleted.

pkg/operator-builder/builder/builder_configmap.go

-55
This file was deleted.

pkg/operator-builder/builder/builder_context.go

-13
This file was deleted.

0 commit comments

Comments
 (0)