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 all 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
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
6 changes: 4 additions & 2 deletions api/v1alpha1/meshsync_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -36,8 +37,9 @@ type MeshsyncBroker struct {

// 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"`
Size int32 `json:"size,omitempty" yaml:"size,omitempty"`
Broker MeshsyncBroker `json:"broker,omitempty" yaml:"broker,omitempty"`
WatchList corev1.ConfigMap `json:"watch-list,omitempty" yaml:"watch-list,omitempty"`
}

// MeshSyncStatus defines the observed state of MeshSync
Expand Down
33 changes: 33 additions & 0 deletions api/v1alpha1/meshsync_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -51,6 +52,20 @@ var _ = Describe("The test case for the meshsync CRDs", func() {
Name: "default",
},
},
WatchList: corev1.ConfigMap{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1apha1",
Kind: "ConfigMap",
},
ObjectMeta: metav1.ObjectMeta{
Name: "watch-list",
Namespace: "default",
},
Data: map[string]string{
"blacklist": "",
"whitelist": "[{\"Resource\":\"namespaces.v1.\",\"Events\":[\"ADDED\",\"DELETE\"]},{\"Resource\":\"replicasets.v1.apps\",\"Events\":[\"ADDED\",\"DELETE\"]},{\"Resource\":\"pods.v1.\",\"Events\":[\"MODIFIED\"]}]",
},
},
},
}

Expand All @@ -77,6 +92,24 @@ 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")
configMap := mesheSyncGet.Spec.WatchList
Expect(configMap).ShouldNot(BeNil())
expectedConfigMap := corev1.ConfigMap{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1apha1",
Kind: "ConfigMap",
},
ObjectMeta: metav1.ObjectMeta{
Name: "watch-list",
Namespace: "default",
},
Data: map[string]string{
"blacklist": "",
"whitelist": "[{\"Resource\":\"namespaces.v1.\",\"Events\":[\"ADDED\",\"DELETE\"]},{\"Resource\":\"replicasets.v1.apps\",\"Events\":[\"ADDED\",\"DELETE\"]},{\"Resource\":\"pods.v1.\",\"Events\":[\"MODIFIED\"]}]",
},
}
Expect(configMap).To(Equal(expectedConfigMap))
})

It("The meshsync CRDs update the spec of the resources", func() {
Expand Down
3 changes: 2 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.

45 changes: 45 additions & 0 deletions config/crd/bases/meshery.layer5.io_meshsyncs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,51 @@ spec:
size:
format: int32
type: integer
watch-list:
description: ConfigMap holds configuration data for pods to consume.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this
representation of an object. Servers should convert recognized
schemas to the latest internal value, and may reject unrecognized
values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
binaryData:
additionalProperties:
format: byte
type: string
description: BinaryData contains the binary data. Each key must
consist of alphanumeric characters, '-', '_' or '.'. BinaryData
can contain byte sequences that are not in the UTF-8 range.
The keys stored in BinaryData must not overlap with the ones
in the Data field, this is enforced during validation process.
Using this field will require 1.10+ apiserver and kubelet.
type: object
data:
additionalProperties:
type: string
description: Data contains the configuration data. Each key must
consist of alphanumeric characters, '-', '_' or '.'. Values
with non-UTF-8 byte sequences must use the BinaryData field.
The keys stored in Data must not overlap with the keys in the
BinaryData field, this is enforced during validation process.
type: object
immutable:
description: Immutable, if set to true, ensures that data stored
in the ConfigMap cannot be updated (only object metadata can
be modified). If not set to true, the field can be modified
at any time. Defaulted to nil.
type: boolean
kind:
description: 'Kind is a string value representing the REST resource
this object represents. Servers may infer this from the endpoint
the client submits requests to. Cannot be updated. In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
type: object
type: object
type: object
status:
description: MeshSyncStatus defines the observed state of MeshSync
Expand Down
8 changes: 7 additions & 1 deletion config/samples/meshery_v1alpha1_meshsync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ spec:
broker:
native:
name: meshery-broker
namespace: meshery
namespace: meshery
watch-list:
apiVersion: v1
data:
# Use either the blacklist or the whitelist for the moment
# blacklist: "[\"namespaces.v1.\",\"configmaps.v1.\",\"nodes.v1.\",\"secrets.v1.\",\"persistentvolumes.v1.\",\"persistentvolumeclaims.v1.\",\"replicasets.v1.apps\",\"pods.v1.\",\"services.v1.\",\"deployments.v1.apps\",\"statefulsets.v1.apps\",\"daemonsets.v1.apps\",\"ingresses.v1.networking.k8s.io\",\"endpoints.v1.\",\"endpointslices.v1.discovery.k8s.io\",\"cronjobs.v1.batch\",\"replicationcontrollers.v1.\",\"storageclasses.v1.storage.k8s.io\",\"clusterroles.v1.rbac.authorization.k8s.io\",\"volumeattachments.v1.storage.k8s.io\",\"apiservices.v1.apiregistration.k8s.io\"]"
whitelist: "[{\"Resource\":\"namespaces.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"configmaps.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"nodes.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"secrets.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"persistentvolumes.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"persistentvolumeclaims.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"replicasets.v1.apps\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"pods.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"services.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"deployments.v1.apps\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"statefulsets.v1.apps\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"daemonsets.v1.apps\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"ingresses.v1.networking.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"endpoints.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"endpointslices.v1.discovery.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"cronjobs.v1.batch\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"replicationcontrollers.v1.\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"storageclasses.v1.storage.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"clusterroles.v1.rbac.authorization.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"volumeattachments.v1.storage.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]},{\"Resource\":\"apiservices.v1.apiregistration.k8s.io\",\"Events\":[\"ADDED\",\"MODIFIED\",\"DELETED\"]}]"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ require (
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
Expand Down
Loading