Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meshsync config on Meshery Operator CRD #533

Merged
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
546a468
update to go version 1.21 and reaction to go
KiptoonKipkurui Oct 10, 2023
0de50cf
update env test version from kubernetes 1.24.2 to 1.26.0
KiptoonKipkurui Oct 10, 2023
80601d3
update golang image version to 1.21
KiptoonKipkurui Oct 10, 2023
5fb4c0c
update golang version to 1.21
KiptoonKipkurui Oct 10, 2023
89d4336
add meshsync config files for listeners and pipeline
KiptoonKipkurui Oct 10, 2023
0d044ed
add unit tests to cover meshsync config files
KiptoonKipkurui Oct 10, 2023
23c8bb8
updates due to additional configs to meshsync CRD
KiptoonKipkurui Oct 10, 2023
74223bf
update CRD definition due to updated meshync configs
KiptoonKipkurui Oct 10, 2023
06b04a4
make subscribe to and publish to optional fields
KiptoonKipkurui Oct 11, 2023
0ee99ea
update manifest to allow optional fields
KiptoonKipkurui Oct 11, 2023
82b973f
add sample config for listeners
KiptoonKipkurui Oct 11, 2023
6c8f7bd
Merge branch 'master' into feat/kiptoonkipkurui/crd_config
KiptoonKipkurui Oct 11, 2023
3127a88
use env test version 1.24.2
KiptoonKipkurui Oct 11, 2023
4b42d37
Merge branch 'master' into feat/kiptoonkipkurui/crd_config
KiptoonKipkurui Oct 24, 2023
c22a176
tidy dependencies
KiptoonKipkurui Oct 24, 2023
daf62b0
update variable names to more readable versions
KiptoonKipkurui Oct 26, 2023
ae16176
refactor unit tests to include local pipeline configs
KiptoonKipkurui Oct 26, 2023
62887e6
update kubernetes deepcopy object
KiptoonKipkurui Oct 26, 2023
755f03b
correct description spelling
KiptoonKipkurui Oct 26, 2023
b6ca361
use config map for watchlist feature
KiptoonKipkurui Oct 29, 2023
9da02fb
update unit tests to test presence of configmap
KiptoonKipkurui Oct 29, 2023
71bea27
update CRD to use configmap
KiptoonKipkurui Oct 29, 2023
51d419a
update sample custom resource to include watchlist configmap
KiptoonKipkurui Oct 29, 2023
48e251b
generate required kubernetes code
KiptoonKipkurui Oct 29, 2023
388ae67
update sample CR configuration
KiptoonKipkurui Oct 29, 2023
ea4c118
added the fulll list of resources for default configuration.
KiptoonKipkurui Nov 14, 2023
3cf9449
fix failing unit test, also making the unit
KiptoonKipkurui Nov 18, 2023
a9ca7f1
Merge remote-tracking branch 'upstream/master' into feat/kiptoonkipku…
KiptoonKipkurui Nov 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/approve-to-run-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-22.04]
go-version: [1.19.x]
go-version: [1.21]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@v4
Expand All @@ -36,7 +36,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19.x
go-version: 1.21
- name: Set up test-env
run: make test-env
- name: Run unit tests
Expand All @@ -60,6 +60,6 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19.x
go-version: 1.21
- name: Build
run: make build
2 changes: 1 addition & 1 deletion .github/workflows/error-ref-publisher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@master
with:
go-version: 1.19
go-version: 1.21

- name: Run utility
run: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.19 as builder
FROM golang:1.21 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
29 changes: 29 additions & 0 deletions api/v1alpha1/meshsync_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,39 @@ type MeshsyncBroker struct {
Native NativeMeshsyncBroker `json:"native,omitempty" yaml:"native,omitempty"`
}

// an array of resources that meshsync listes to and publishes their events
type PipelineConfigs []PipelineConfig

// resources that meshsync observes and publishes to a given subscriber via the broker
type PipelineConfig struct {
Name string `json:"name" yaml:"name"`
PublishTo string `json:"publish-to" yaml:"publish-to"`
KiptoonKipkurui marked this conversation as resolved.
Show resolved Hide resolved
}

// an array of resources that meshsync listens to
type ListenerConfigs []ListenerConfig

// configures resources the meshsync subsribes to
type ListenerConfig struct {
Name string `json:"name" yaml:"name"`
ConnectionName string `json:"connection-name" yaml:"connection-name"`
KiptoonKipkurui marked this conversation as resolved.
Show resolved Hide resolved
//+optional
PublishTo string `json:"publish-to" yaml:"publish-to"`
//+optional
SubscribeTo string `json:"subscribe-to" yaml:"subscribe-to"`
}

// Meshsync configuration controls the resources meshsync produces and consumes
type MeshsyncConfig struct {
PipelineConfigs map[string]PipelineConfigs `json:"pipeline-configs,omitempty" yaml:"pipeline-configs,omitempty"`
KiptoonKipkurui marked this conversation as resolved.
Show resolved Hide resolved
ListenerConfigs map[string]ListenerConfig `json:"listener-config,omitempty" yaml:"listener-config,omitempty"`
}

// MeshSyncSpec defines the desired state of MeshSync
type MeshSyncSpec struct {
Size int32 `json:"size,omitempty" yaml:"size,omitempty"`
Broker MeshsyncBroker `json:"broker,omitempty" yaml:"broker,omitempty"`
Config MeshsyncConfig `json:"config,omitempty" yaml:"config,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to add a new field to track the configuration of Meshsync. It should show in the MeshSyncStatus. We can set the configuration, but we cannot check it by checking the MeshSync status. It is not we what we want to.

}

// MeshSyncStatus defines the observed state of MeshSync
Expand Down
47 changes: 47 additions & 0 deletions api/v1alpha1/meshsync_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,28 @@ var _ = Describe("The test case for the meshsync CRDs", func() {
Name: "default",
},
},
Config: MeshsyncConfig{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the tests cases

ListenerConfigs: map[string]ListenerConfig{
"global": {
Name: "meshsync-logstream",
PublishTo: "meshery.meshsync.logs",
KiptoonKipkurui marked this conversation as resolved.
Show resolved Hide resolved
SubscribeTo: "meshery.meshsync.logs",
ConnectionName: "log-stream",
},
},
PipelineConfigs: map[string]PipelineConfigs{
"global": []PipelineConfig{
{
Name: "namespaces.v1.",
PublishTo: "meshery.meshsync.core",
},
{
Name: "configmaps.v1.",
PublishTo: "meshery.meshsync.core",
},
},
},
},
},
}

Expand All @@ -77,6 +99,31 @@ var _ = Describe("The test case for the meshsync CRDs", func() {
url := mesheSyncGet.Spec.Broker.Custom.URL
Expect(url == URL).Should(BeTrue())

By("Confirm the config matches the expected listener and pipeline configs")
config := mesheSyncGet.Spec.Config
Expect(len(config.ListenerConfigs) == 1).Should(BeTrue())
expectedListenerConfig := ListenerConfig{

Name: "meshsync-logstream",
PublishTo: "meshery.meshsync.logs",
SubscribeTo: "meshery.meshsync.logs",
ConnectionName: "log-stream",
}
Expect(config.ListenerConfigs["global"] == expectedListenerConfig).Should(BeTrue())

expectedPipelineConfigs := []PipelineConfig{
{
Name: "namespaces.v1.",
PublishTo: "meshery.meshsync.core",
},
{
Name: "configmaps.v1.",
PublishTo: "meshery.meshsync.core",
},
}
Expect(config.PipelineConfigs["global"][0] == expectedPipelineConfigs[0]).Should(BeTrue())
Expect(config.PipelineConfigs["global"][1] == expectedPipelineConfigs[1]).Should(BeTrue())

})

It("The meshsync CRDs update the spec of the resources", func() {
Expand Down
108 changes: 107 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions config/crd/bases/meshery.layer5.io_meshsyncs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,46 @@ spec:
type: string
type: object
type: object
config:
description: Meshsync configuration controls the resources meshsync
produces and consumes
properties:
listener-config:
additionalProperties:
description: configures resources the meshsync subsribes to
properties:
connection-name:
type: string
name:
type: string
publish-to:
type: string
subscribe-to:
type: string
required:
- connection-name
- name
type: object
type: object
pipeline-configs:
additionalProperties:
description: an array of resources that meshsync listes to and
publishes their events
items:
description: resources that meshsync observes and publishes
to a given subscriber via the broker
properties:
name:
type: string
publish-to:
type: string
required:
- name
- publish-to
type: object
type: array
type: object
type: object
size:
format: int32
type: integer
Expand Down
36 changes: 35 additions & 1 deletion config/samples/meshery_v1alpha1_meshsync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,38 @@ spec:
broker:
native:
name: meshery-broker
namespace: meshery
namespace: meshery
config:
listener-config:
log-stream:
connection-name: meshsync-logstream
name: log-stream
publish-to: "meshery.meshsync.logs"
exec-shell:
connection-name: meshsync-exec
name: exec-shell
publish-to: meshery.meshsync.exec
request-stream:
connection-name: meshsync-request-stream
name: request-stream
subscribe-to: meshery.meshsync.request

pipeline-configs:
KiptoonKipkurui marked this conversation as resolved.
Show resolved Hide resolved
local:
- name: "replicasets.v1.apps"
publish-to: "meshery.meshsync.core"
- name: "pods.v1."
publish-to: "meshery.meshsync.core"
- name: "services.v1."
publish-to: "meshery.meshsync.core"
- name: "deployments.v1.apps"
publish-to: "meshery.meshsync.core"
- name: "statefulsets.v1.apps"
publish-to: "meshery.meshsync.core"
global:
- name: "namespaces.v1."
publish-to: "meshery.meshsync.core"
- name: "configmaps.v1."
publish-to: "meshery.meshsync.core"
- name: "nodes.v1."
publish-to: "meshery.meshsync.core"
Loading
Loading