Skip to content

Commit

Permalink
Merge pull request #98 from layer5io/kumarabd/feature/broker
Browse files Browse the repository at this point in the history
modified yaml files
  • Loading branch information
kumarabd committed Dec 29, 2020
2 parents 7bbb027 + 1d82c69 commit e99aad1
Show file tree
Hide file tree
Showing 18 changed files with 792 additions and 50 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)

# Image URL to use all building/pushing image targets
IMG ?= meshery-operator:latest
IMG ?= meshery-operator:stable-latest
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"

Expand Down Expand Up @@ -66,8 +66,11 @@ vet:
go vet ./...

# Generate code
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
generate: controller-gen kustomize
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."; \
$(KUSTOMIZE) build config/default > config/manifests/default.yaml; \
$(KUSTOMIZE) build config/rbac > config/manifests/rbac.yaml; \
$(KUSTOMIZE) build config/crd > config/manifests/crd.yaml

# Build the docker image
docker-build:
Expand Down
23 changes: 10 additions & 13 deletions api/v1alpha1/broker_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,35 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// BrokerSpec defines the desired state of Broker
type BrokerSpec struct {
Size int32 `json:"size,omitempty"`
Size int32 `json:"size,omitempty" yaml:"size,omitempty"`
}

// BrokerStatus defines the observed state of Broker
type BrokerStatus struct {
Endpoint string `json:"endpoint,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
Conditions []Condition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
}

// Broker is the Schema for the brokers API
// +kubebuilder:subresource:status
// +kubebuilder:object:root=true
type Broker struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`

Spec BrokerSpec `json:"spec,omitempty"`
Status BrokerStatus `json:"status,omitempty"`
Spec BrokerSpec `json:"spec,omitempty" yaml:"spec,omitempty"`
Status BrokerStatus `json:"status,omitempty" yaml:"status,omitempty"`
}

// +kubebuilder:object:root=true

// BrokerList contains a list of Broker
type BrokerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Broker `json:"items"`
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Items []Broker `json:"items" yaml:"items"`
}

func init() {
Expand Down
14 changes: 7 additions & 7 deletions api/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ type ConditionType string
type ConditionStatus string

type Condition struct {
Type ConditionType `json:"type"`
Status ConditionStatus `json:"status"`
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty"`
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
Reason string `json:"reason"`
Message string `json:"message"`
Type ConditionType `json:"type" yaml:"type"`
Status ConditionStatus `json:"status" yaml:"status"`
ObservedGeneration int64 `json:"observedGeneration,omitempty" yaml:"observedGeneration,omitempty"`
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty" yaml:"lastProbeTime,omitempty"`
LastTransitionTime metav1.Time `json:"lastTransitionTime" yaml:"lastTransitionTime"`
Reason string `json:"reason" yaml:"reason"`
Message string `json:"message" yaml:"message"`
}
32 changes: 16 additions & 16 deletions api/v1alpha1/meshsync_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,48 +21,48 @@ import (
)

type CustomMeshsyncBroker struct {
URL string `json:"url,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
}

type NativeMeshsyncBroker struct {
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
}

type MeshsyncBroker struct {
Custom CustomMeshsyncBroker `json:"custom,omitempty"`
Native NativeMeshsyncBroker `json:"native,omitempty"`
Custom CustomMeshsyncBroker `json:"custom,omitempty" yaml:"custom,omitempty"`
Native NativeMeshsyncBroker `json:"native,omitempty" yaml:"native,omitempty"`
}

// MeshSyncSpec defines the desired state of MeshSync
type MeshSyncSpec struct {
Size int32 `json:"size,omitempty"`
Broker MeshsyncBroker `json:"broker,omitempty"`
Size int32 `json:"size,omitempty" yaml:"size,omitempty"`
Broker MeshsyncBroker `json:"broker,omitempty" yaml:"broker,omitempty"`
}

// MeshSyncStatus defines the observed state of MeshSync
type MeshSyncStatus struct {
PublishingTo string `json:"publishing-to,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
PublishingTo string `json:"publishing-to,omitempty" yaml:"publishing-to,omitempty"`
Conditions []Condition `json:"conditions,omitempty" yaml:"conditions,omitempty"`
}

// MeshSync is the Schema for the meshsyncs API
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
type MeshSync struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`

Spec MeshSyncSpec `json:"spec,omitempty"`
Status MeshSyncStatus `json:"status,omitempty"`
Spec MeshSyncSpec `json:"spec,omitempty" yaml:"spec,omitempty"`
Status MeshSyncStatus `json:"status,omitempty" yaml:"status,omitempty"`
}

// MeshSyncList contains a list of MeshSync
// +kubebuilder:object:root=true
type MeshSyncList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MeshSync `json:"items"`
metav1.TypeMeta `json:",inline" yaml:",inline"`
metav1.ListMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Items []MeshSync `json:"items" yaml:"items"`
}

func init() {
Expand Down
1 change: 1 addition & 0 deletions config/certmanager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
namePrefix: meshery-
resources:
- certificate.yaml

Expand Down
4 changes: 2 additions & 2 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Adds namespace to all resources.
namespace: meshery-operator-system
namespace: meshery

# Value of this field is prepended to the
# names of all resources, e.g. a deployment named
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: meshery-operator-
namePrefix:

# Labels to add to all resources and selectors.
#commonLabels:
Expand Down
4 changes: 2 additions & 2 deletions config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
namespace: system
name: meshery-operator
namespace: meshery
spec:
template:
spec:
Expand Down
4 changes: 2 additions & 2 deletions config/default/manager_webhook_patch.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
namespace: system
name: meshery-operator
namespace: meshery
spec:
template:
spec:
Expand Down
6 changes: 6 additions & 0 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
resources:
- manager.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: meshery-operator
newTag: stable-latest
188 changes: 188 additions & 0 deletions config/manifests/crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
name: brokers.meshery.layer5.io
spec:
group: meshery.layer5.io
names:
kind: Broker
listKind: BrokerList
plural: brokers
singular: broker
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: Broker is the Schema for the brokers API
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
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:
type: object
spec:
description: BrokerSpec defines the desired state of Broker
properties:
size:
format: int32
type: integer
type: object
status:
description: BrokerStatus defines the observed state of Broker
properties:
conditions:
items:
properties:
lastProbeTime:
format: date-time
type: string
lastTransitionTime:
format: date-time
type: string
message:
type: string
observedGeneration:
format: int64
type: integer
reason:
type: string
status:
type: string
type:
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
endpoint:
type: string
type: object
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
name: meshsyncs.meshery.layer5.io
spec:
group: meshery.layer5.io
names:
kind: MeshSync
listKind: MeshSyncList
plural: meshsyncs
singular: meshsync
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: MeshSync is the Schema for the meshsyncs API
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
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:
type: object
spec:
description: MeshSyncSpec defines the desired state of MeshSync
properties:
broker:
properties:
custom:
properties:
url:
type: string
type: object
native:
properties:
name:
type: string
namespace:
type: string
type: object
type: object
size:
format: int32
type: integer
type: object
status:
description: MeshSyncStatus defines the observed state of MeshSync
properties:
conditions:
items:
properties:
lastProbeTime:
format: date-time
type: string
lastTransitionTime:
format: date-time
type: string
message:
type: string
observedGeneration:
format: int64
type: integer
reason:
type: string
status:
type: string
type:
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
publishing-to:
type: string
type: object
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading

0 comments on commit e99aad1

Please sign in to comment.