Skip to content

Commit

Permalink
Merge pull request #263 from 3scale-ops/feat/add-zync-console
Browse files Browse the repository at this point in the history
feat: Add zync-console statefulset
  • Loading branch information
3scale-robot authored Jun 15, 2023
2 parents 6e4d62b + f7909da commit 71f96bf
Show file tree
Hide file tree
Showing 16 changed files with 1,032 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.19.8
VERSION ?= 0.19.9-alpha.1

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
Expand Down
49 changes: 49 additions & 0 deletions api/v1alpha1/zync_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var (
SelectorKey: pointer.String("monitoring-key"),
SelectorValue: pointer.String("middleware"),
}
zyncDefaultRailsConsoleEnabled bool = false
zyncDefaultConfigRailsEnvironment string = "development"
zyncDefaultConfigRailsLogLevel string = "info"
zyncDefaultConfigRailsMaxThreads int32 = 10
Expand Down Expand Up @@ -107,6 +108,16 @@ var (
SuccessThreshold: pointer.Int32(1),
FailureThreshold: pointer.Int32(3),
}
zyncDefaultRailsConsoleResources defaultResourceRequirementsSpec = defaultResourceRequirementsSpec{
Requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("200m"),
corev1.ResourceMemory: resource.MustParse("1Gi"),
},
Limits: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("400m"),
corev1.ResourceMemory: resource.MustParse("2Gi"),
},
}
)

// ZyncSpec defines the desired state of Zync
Expand All @@ -130,6 +141,10 @@ type ZyncSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Que *QueSpec `json:"que,omitempty"`
// Console specific configuration options
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Console *ZyncRailsConsoleSpec `json:"console,omitempty"`
}

// Default implements defaulting for ZyncSpec
Expand All @@ -146,6 +161,11 @@ func (spec *ZyncSpec) Default() {
}
spec.Que.Default()
spec.GrafanaDashboard = InitializeGrafanaDashboardSpec(spec.GrafanaDashboard, zyncDefaultGrafanaDashboard)

if spec.Console == nil {
spec.Console = &ZyncRailsConsoleSpec{}
}
spec.Console.Default(spec.Image)
}

// APISpec is the configuration for main Zync api component
Expand Down Expand Up @@ -300,6 +320,35 @@ func (zrs *ZyncRailsSpec) Default() {
zrs.MaxThreads = intOrDefault(zrs.MaxThreads, pointer.Int32(zyncDefaultConfigRailsMaxThreads))
}

// ZyncRailsConsoleSpec configures the Console component of Zync
type ZyncRailsConsoleSpec struct {
// Enables or disables the Zync Console statefulset
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Enabled *bool `json:"enabled,omitempty"` // Image specification for the Console component.
// Defaults to zync image if not defined.
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Image *ImageSpec `json:"image,omitempty"`
// Resource requirements for the component
// +operator-sdk:csv:customresourcedefinitions:type=spec
// +optional
Resources *ResourceRequirementsSpec `json:"resources,omitempty"`
// Describes node affinity scheduling rules for the pod.
// +optional
NodeAffinity *corev1.NodeAffinity `json:"nodeAffinity,omitempty" protobuf:"bytes,1,opt,name=nodeAffinity"`
// If specified, the pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"`
}

// Default implements defaulting for the Zync console component
func (spec *ZyncRailsConsoleSpec) Default(zyncDefaultImage *ImageSpec) {
spec.Enabled = boolOrDefault(spec.Enabled, pointer.Bool(zyncDefaultRailsConsoleEnabled))
spec.Image = InitializeImageSpec(spec.Image, defaultImageSpec(*zyncDefaultImage))
spec.Resources = InitializeResourceRequirementsSpec(spec.Resources, zyncDefaultRailsConsoleResources)
}

// ZyncStatus defines the observed state of Zync
type ZyncStatus struct{}

Expand Down
47 changes: 47 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

3 changes: 1 addition & 2 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=saas-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha,stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.27.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
Expand Down
43 changes: 39 additions & 4 deletions bundle/manifests/saas-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -627,15 +627,15 @@ metadata:
capabilities: Basic Install
categories: Integration & Delivery
containerImage: quay.io/3scale/saas-operator
createdAt: "2023-05-22T14:34:40Z"
createdAt: "2023-06-14T11:40:44Z"
description: |-
The 3scale SaaS Operator creates and maintains a SaaS-ready deployment
of the Red Hat 3scale API Management on OpenShift.
operators.operatorframework.io/builder: operator-sdk-v1.27.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/3scale/saas-operator
support: Red Hat
name: saas-operator.v0.19.8
name: saas-operator.v0.19.9-alpha.1
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -4271,6 +4271,41 @@ spec:
- description: Override allows to directly specify a string value.
displayName: Override
path: config.zyncAuthToken.override
- description: Console specific configuration options
displayName: Console
path: console
- description: Enables or disables the Zync Console statefulset
displayName: Enabled
path: console.enabled
- description: Defaults to zync image if not defined.
displayName: Image
path: console.image
- description: Docker repository of the image
displayName: Name
path: console.image.name
- description: Pull policy for the image
displayName: Pull Policy
path: console.image.pullPolicy
- description: Name of the Secret that holds quay.io credentials to access the
image repository
displayName: Pull Secret Name
path: console.image.pullSecretName
- description: Image tag
displayName: Tag
path: console.image.tag
- description: Resource requirements for the component
displayName: Resources
path: console.resources
- description: 'Limits describes the maximum amount of compute resources allowed.
More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
displayName: Limits
path: console.resources.limits
- description: 'Requests describes the minimum amount of compute resources required.
If Requests is omitted for a container, it defaults to Limits if that is
explicitly specified, otherwise to an implementation-defined value. More
info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
displayName: Requests
path: console.resources.requests
- description: Configures the Grafana Dashboard for the component
displayName: Grafana Dashboard
path: grafanaDashboard
Expand Down Expand Up @@ -4456,7 +4491,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.annotations['olm.targetNamespaces']
image: quay.io/3scale/saas-operator:v0.19.8
image: quay.io/3scale/saas-operator:v0.19.9-alpha.1
livenessProbe:
httpGet:
path: /healthz
Expand Down Expand Up @@ -4970,4 +5005,4 @@ spec:
provider:
name: Red Hat
url: https://www.3scale.net/
version: 0.19.8
version: 0.19.9-alpha.1
Loading

0 comments on commit 71f96bf

Please sign in to comment.