Skip to content

Commit

Permalink
Renamed the CRD group (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
isala404 committed Sep 9, 2021
1 parent 42deca6 commit 1cbd2d8
Show file tree
Hide file tree
Showing 21 changed files with 102 additions and 102 deletions.
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resources:
namespaced: true
controller: true
domain: isala.me
group: loggingplumber
group: loggingpipelineplumber
kind: FlowTest
path: github.com/mrsupiri/logging-pipeline-plumber/api/v1alpha1
version: v1alpha1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: flowtests.loggingplumber.isala.me
name: flowtests.loggingpipelineplumber.isala.me
spec:
group: loggingplumber.isala.me
group: loggingpipelineplumber.isala.me
names:
kind: FlowTest
listKind: FlowTestList
Expand Down
6 changes: 3 additions & 3 deletions charts/logging-pipeline-plumber/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ rules:
- list
- watch
- apiGroups:
- loggingplumber.isala.me
- loggingpipelineplumber.isala.me
resources:
- flowtests
verbs:
Expand All @@ -57,13 +57,13 @@ rules:
- update
- watch
- apiGroups:
- loggingplumber.isala.me
- loggingpipelineplumber.isala.me
resources:
- flowtests/finalizers
verbs:
- update
- apiGroups:
- loggingplumber.isala.me
- loggingpipelineplumber.isala.me
resources:
- flowtests/status
verbs:
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/loggingplumber.isala.me_flowtests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
creationTimestamp: null
name: flowtests.loggingplumber.isala.me
name: flowtests.loggingpipelineplumber.isala.me
spec:
group: loggingplumber.isala.me
group: loggingpipelineplumber.isala.me
names:
kind: FlowTest
listKind: FlowTestList
Expand Down
2 changes: 1 addition & 1 deletion config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/loggingplumber.isala.me_flowtests.yaml
- bases/loggingpipelineplumber.isala.me_flowtests.yaml
#+kubebuilder:scaffold:crdkustomizeresource
4 changes: 2 additions & 2 deletions config/rbac/flowtest_editor_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: flowtest-editor-role
rules:
- apiGroups:
- loggingplumber.isala.me
- loggingpipelineplumber.isala.me
resources:
- flowtests
verbs:
Expand All @@ -17,7 +17,7 @@ rules:
- update
- watch
- apiGroups:
- loggingplumber.isala.me
- loggingpipelineplumber.isala.me
resources:
- flowtests/status
verbs:
Expand Down
4 changes: 2 additions & 2 deletions config/rbac/flowtest_viewer_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ metadata:
name: flowtest-viewer-role
rules:
- apiGroups:
- loggingplumber.isala.me
- loggingpipelineplumber.isala.me
resources:
- flowtests
verbs:
- get
- list
- watch
- apiGroups:
- loggingplumber.isala.me
- loggingpipelineplumber.isala.me
resources:
- flowtests/status
verbs:
Expand Down
6 changes: 3 additions & 3 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ rules:
- list
- watch
- apiGroups:
- loggingplumber.isala.me
- loggingpipelineplumber.isala.me
resources:
- flowtests
verbs:
Expand All @@ -59,13 +59,13 @@ rules:
- update
- watch
- apiGroups:
- loggingplumber.isala.me
- loggingpipelineplumber.isala.me
resources:
- flowtests/finalizers
verbs:
- update
- apiGroups:
- loggingplumber.isala.me
- loggingpipelineplumber.isala.me
resources:
- flowtests/status
verbs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: loggingplumber.isala.me/v1alpha1
apiVersion: loggingpipelineplumber.isala.me/v1alpha1
kind: FlowTest
metadata:
name: flowtest-sample
labels:
app.kubernetes.io/name: pod-simulation
app.kubernetes.io/managed-by: logging-pipeline-plumber
app.kubernetes.io/created-by: logging-plumber
loggingplumber.isala.me/flowtest: flowtest-sample
loggingpipelineplumber.isala.me/flowtest: flowtest-sample
spec:
referencePod:
kind: Pod
Expand All @@ -22,15 +22,15 @@ spec:
- "[2021-06-10T11:50:08Z] @INFO Amo ideoque die se at, caro aer, ad cor. 1375 ::0.263548"
- "[2021-06-10T11:50:09Z] @INFO Se contexo servis inpiis erogo, diligit ita significaret eosdem. 1376 ::0.405282"
---
apiVersion: loggingplumber.isala.me/v1alpha1
apiVersion: loggingpipelineplumber.isala.me/v1alpha1
kind: FlowTest
metadata:
name: clusterflowtest-sample
labels:
app.kubernetes.io/name: pod-simulation
app.kubernetes.io/managed-by: logging-pipeline-plumber
app.kubernetes.io/created-by: logging-plumber
loggingplumber.isala.me/flowtest: clusterflowtest-sample
loggingpipelineplumber.isala.me/flowtest: clusterflowtest-sample
spec:
referencePod:
kind: Pod
Expand Down
18 changes: 9 additions & 9 deletions config/samples/simulations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ kind: Flow
metadata:
name: busybox-echo
labels:
loggingplumber.isala.me/test: simulations
loggingpipelineplumber.isala.me/test: simulations
spec:
localOutputRefs:
- busybox-echo
match:
- select:
labels:
loggingplumber.isala.me/test: invalid
loggingpipelineplumber.isala.me/test: invalid
- select:
labels:
loggingplumber.isala.me/test: simulations
loggingpipelineplumber.isala.me/test: simulations
filters:
- grep:
regexp:
Expand All @@ -28,7 +28,7 @@ kind: Output
metadata:
name: busybox-echo
labels:
loggingplumber.isala.me/test: simulations
loggingpipelineplumber.isala.me/test: simulations
spec:
http:
endpoint: "http://logging-plumber-log-aggregator.default.svc/busybox-echo/"
Expand All @@ -42,17 +42,17 @@ metadata:
name: cluster-busybox-echo
namespace: cattle-logging-system
labels:
loggingplumber.isala.me/test: simulations
loggingpipelineplumber.isala.me/test: simulations
spec:
globalOutputRefs:
- cluster-busybox-echo
match:
- select:
labels:
loggingplumber.isala.me/test: invalid
loggingpipelineplumber.isala.me/test: invalid
- select:
labels:
loggingplumber.isala.me/test: simulations
loggingpipelineplumber.isala.me/test: simulations
filters:
- record_modifier:
records:
Expand All @@ -68,7 +68,7 @@ metadata:
name: cluster-busybox-echo
namespace: cattle-logging-system
labels:
loggingplumber.isala.me/test: simulations
loggingpipelineplumber.isala.me/test: simulations
spec:
http:
endpoint: "http://logging-plumber-log-aggregator.default.svc/cluster-busybox-echo/"
Expand All @@ -81,7 +81,7 @@ kind: Pod
metadata:
name: busybox-echo
labels:
loggingplumber.isala.me/test: simulations
loggingpipelineplumber.isala.me/test: simulations
spec:
containers:
- name: busybox
Expand Down
20 changes: 10 additions & 10 deletions controllers/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"
flowv1beta1 "github.com/banzaicloud/logging-operator/pkg/sdk/api/v1beta1"
loggingplumberv1alpha1 "github.com/mrsupiri/logging-pipeline-plumber/pkg/sdk/api/v1alpha1"
loggingpipelineplumberv1alpha1 "github.com/mrsupiri/logging-pipeline-plumber/pkg/sdk/api/v1alpha1"
v1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
Expand All @@ -14,7 +14,7 @@ import (
func (r *FlowTestReconciler) cleanUpResources(ctx context.Context, flowTestName string) error {
logger := log.FromContext(ctx)

matchingLabels := &client.MatchingLabels{"loggingplumber.isala.me/flowtest": flowTestName}
matchingLabels := &client.MatchingLabels{"loggingpipelineplumber.isala.me/flowtest": flowTestName}

var podList v1.PodList
if err := r.List(ctx, &podList, matchingLabels); client.IgnoreNotFound(err) != nil {
Expand Down Expand Up @@ -45,7 +45,7 @@ func (r *FlowTestReconciler) cleanUpResources(ctx context.Context, flowTestName
}

var flows flowv1beta1.FlowList
if err := r.List(ctx, &flows, &client.MatchingLabels{"loggingplumber.isala.me/flowtest": flowTestName}); client.IgnoreNotFound(err) != nil {
if err := r.List(ctx, &flows, &client.MatchingLabels{"loggingpipelineplumber.isala.me/flowtest": flowTestName}); client.IgnoreNotFound(err) != nil {
logger.Error(err, fmt.Sprintf("failed to get provisioned %s", flows.Kind))
//return err
}
Expand All @@ -59,7 +59,7 @@ func (r *FlowTestReconciler) cleanUpResources(ctx context.Context, flowTestName
}

var outputs flowv1beta1.OutputList
if err := r.List(ctx, &outputs, &client.MatchingLabels{"loggingplumber.isala.me/flowtest": flowTestName}); client.IgnoreNotFound(err) != nil {
if err := r.List(ctx, &outputs, &client.MatchingLabels{"loggingpipelineplumber.isala.me/flowtest": flowTestName}); client.IgnoreNotFound(err) != nil {
logger.Error(err, fmt.Sprintf("failed to get provisioned %s", outputs.Kind))
//return err
}
Expand All @@ -73,7 +73,7 @@ func (r *FlowTestReconciler) cleanUpResources(ctx context.Context, flowTestName
}

var clusterFlows flowv1beta1.ClusterFlowList
if err := r.List(ctx, &clusterFlows, &client.MatchingLabels{"loggingplumber.isala.me/flowtest": flowTestName}); client.IgnoreNotFound(err) != nil {
if err := r.List(ctx, &clusterFlows, &client.MatchingLabels{"loggingpipelineplumber.isala.me/flowtest": flowTestName}); client.IgnoreNotFound(err) != nil {
logger.Error(err, fmt.Sprintf("failed to get provisioned %s", clusterFlows.Kind))
//return err
}
Expand All @@ -87,7 +87,7 @@ func (r *FlowTestReconciler) cleanUpResources(ctx context.Context, flowTestName
}

var clusterOutputs flowv1beta1.ClusterOutputList
if err := r.List(ctx, &clusterOutputs, &client.MatchingLabels{"loggingplumber.isala.me/flowtest": flowTestName}); client.IgnoreNotFound(err) != nil {
if err := r.List(ctx, &clusterOutputs, &client.MatchingLabels{"loggingpipelineplumber.isala.me/flowtest": flowTestName}); client.IgnoreNotFound(err) != nil {
logger.Error(err, fmt.Sprintf("failed to get provisioned %s", clusterOutputs.Kind))
//return err
}
Expand All @@ -106,21 +106,21 @@ func (r *FlowTestReconciler) cleanUpResources(ctx context.Context, flowTestName
func (r *FlowTestReconciler) cleanUpOutputResources(ctx context.Context) error {
logger := log.FromContext(ctx)

var flowTests loggingplumberv1alpha1.FlowTestList
var flowTests loggingpipelineplumberv1alpha1.FlowTestList
if err := r.List(ctx, &flowTests); err != nil {
logger.Error(err, fmt.Sprintf("failed to get provisioned %s", flowTests.Kind))
return err
}
for _, flowTest := range flowTests.Items {
if flowTest.Status.Status != loggingplumberv1alpha1.Completed || !flowTest.ObjectMeta.DeletionTimestamp.IsZero() {
if flowTest.Status.Status != loggingpipelineplumberv1alpha1.Completed || !flowTest.ObjectMeta.DeletionTimestamp.IsZero() {
logger.V(1).Info("unfinished flowtest found, skipping cleanup of log-aggregator")
return nil
}
}

logger.V(1).Info("no running flowtest found, cleaning up log-aggregator")

matchingLabels := &client.MatchingLabels{"loggingplumber.isala.me/component": "log-aggregator"}
matchingLabels := &client.MatchingLabels{"loggingpipelineplumber.isala.me/component": "log-aggregator"}
var podList v1.PodList
if err := r.List(ctx, &podList, matchingLabels); client.IgnoreNotFound(err) != nil {
logger.Error(err, fmt.Sprintf("failed to get provisioned %s", podList.Kind))
Expand Down Expand Up @@ -153,7 +153,7 @@ func (r *FlowTestReconciler) cleanUpOutputResources(ctx context.Context) error {
}

func (r *FlowTestReconciler) deleteResources(ctx context.Context, finalizerName string) error {
flowTest := ctx.Value("flowTest").(loggingplumberv1alpha1.FlowTest)
flowTest := ctx.Value("flowTest").(loggingpipelineplumberv1alpha1.FlowTest)
logger := log.FromContext(ctx)

if err := r.cleanUpResources(ctx, flowTest.ObjectMeta.Name); client.IgnoreNotFound(err) != nil {
Expand Down
Loading

0 comments on commit 1cbd2d8

Please sign in to comment.