Skip to content

Commit

Permalink
Use resource metrics v0.30.5
Browse files Browse the repository at this point in the history
Signed-off-by: Arnob kumar saha <[email protected]>
  • Loading branch information
ArnobKumarSaha committed Nov 7, 2024
1 parent 31bd54e commit d90641b
Show file tree
Hide file tree
Showing 17 changed files with 577 additions and 10 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ require (
kmodules.xyz/go-containerregistry v0.0.12
kmodules.xyz/monitoring-agent-api v0.30.2
kmodules.xyz/offshoot-api v0.30.1
kmodules.xyz/resource-metadata v0.21.1-0.20241101060818-82302d83f0de
kmodules.xyz/resource-metrics v0.30.4
kmodules.xyz/resource-metadata v0.21.1-0.20241107112216-37fff326ac28
kmodules.xyz/resource-metrics v0.30.5
kmodules.xyz/resource-metrics/utils v0.30.4
kmodules.xyz/sets v0.29.0
kubeops.dev/falco-ui-server v0.0.4
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -934,10 +934,10 @@ kmodules.xyz/monitoring-agent-api v0.30.2 h1:sAgz5P5EXZqhlj1NzJ+QltAgeIx5bGSMj+a
kmodules.xyz/monitoring-agent-api v0.30.2/go.mod h1:BoZFPDDRB7J39CcUsSDlzgW8PQCwik4ILPleyUob+Mg=
kmodules.xyz/offshoot-api v0.30.1 h1:TrulAYO+oBsXe9sZZGTmNWIuI8qD2izMpgcTSPvgAmI=
kmodules.xyz/offshoot-api v0.30.1/go.mod h1:T3mpjR6fui0QzOcmQvIuANytW48fe9ytmy/1cgx6D4g=
kmodules.xyz/resource-metadata v0.21.1-0.20241101060818-82302d83f0de h1:VnyZFHRT4Rhb3HVFN5UrYxtFGUm2EA5pCnJkfWV8W2A=
kmodules.xyz/resource-metadata v0.21.1-0.20241101060818-82302d83f0de/go.mod h1:pdge27Crf30IeiBGhy1QIveRiUtJ/QnSSOaO2VxHAmI=
kmodules.xyz/resource-metrics v0.30.4 h1:8HBPtYmo9ETY91gsc55JE8Z986+3ZuRq57M0wZ9npqI=
kmodules.xyz/resource-metrics v0.30.4/go.mod h1:w9+rz7/s/kGP1GWzYSuRdCn+l7EwpesmESSEHkLBnIQ=
kmodules.xyz/resource-metadata v0.21.1-0.20241107112216-37fff326ac28 h1:EwAFAlB25Q8BgMU6Es7/pknJ5UHrdx3Le2p19u1f+sg=
kmodules.xyz/resource-metadata v0.21.1-0.20241107112216-37fff326ac28/go.mod h1:KNp1ScLwOt3D5G/cG0lypXmNjVKxyArlMem/abqenPs=
kmodules.xyz/resource-metrics v0.30.5 h1:ZhpGeR9DCz1HTrKUg/mWhr95wlFzCPRdgVAqwaggy1o=
kmodules.xyz/resource-metrics v0.30.5/go.mod h1:w9+rz7/s/kGP1GWzYSuRdCn+l7EwpesmESSEHkLBnIQ=
kmodules.xyz/resource-metrics/utils v0.30.4 h1:bJS/x0Qr7N1FFdxugFbzZ/Es6HVs4ptsFlhkmgj3jac=
kmodules.xyz/resource-metrics/utils v0.30.4/go.mod h1:EedHEDZu1iVfkpKsTsSTfHkG5MUf77TdjDmCYRY4UR0=
kmodules.xyz/sets v0.29.0 h1:ZX/qOECzUob95JhhRtngJElHSlJ1UNNdwK4hTEy+nl0=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ type FeatureSpec struct {
// FeatureBlock specifies the ui block name of this feature.
// +optional
FeatureBlock string `json:"featureBlock,omitempty"`
// FeatureExclusionGroup specifies the name of the exclusion group for features
// Only one feature in a feature exclusion group can be installed
// +optional
FeatureExclusionGroup string `json:"featureExclusionGroup,omitempty"`
// Required specifies whether this feature is mandatory or not for enabling the respecting FeatureSet.
// +optional
Recommended bool `json:"recommended,omitempty"`
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ spec:
featureBlock:
description: FeatureBlock specifies the ui block name of this feature.
type: string
featureExclusionGroup:
description: FeatureExclusionGroup specifies the name of the exclusion
group for features Only one feature in a feature exclusion group
can be installed
type: string
featureSet:
description: FeatureSet specifies the name of the FeatureSet where
this feature belong to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ spec:
kind: HelmRepository
name: appscode-charts-oci
version: v0.9.0
enforceQuota: true
enforceQuota: false
flow: standalone-create
icons:
- src: https://cdn.appscode.com/k8s/icons/action-icons/compute.svg
Expand All @@ -164,7 +164,7 @@ spec:
kind: HelmRepository
name: appscode-charts-oci
version: v0.9.0
enforceQuota: true
enforceQuota: false
flow: standalone-create
icons:
- src: https://cdn.appscode.com/k8s/icons/action-icons/storage.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func (r MSSQLServer) ResourceCalculator() api.ResourceCalculator {
AppRoles: []api.PodRole{api.PodRoleDefault},
RuntimeRoles: []api.PodRole{api.PodRoleDefault, api.PodRoleExporter},
RoleReplicasFn: r.roleReplicasFn,
ModeFn: r.modeFn,
UsesTLSFn: r.usesTLSFn,
RoleResourceLimitsFn: r.roleResourceFn(api.ResourceLimits),
RoleResourceRequestsFn: r.roleResourceFn(api.ResourceRequests),
Expand All @@ -58,6 +59,17 @@ func (r MSSQLServer) roleReplicasFn(obj map[string]interface{}) (api.ReplicaList
return api.ReplicaList{api.PodRoleDefault: replicas}, nil
}

func (r MSSQLServer) modeFn(obj map[string]interface{}) (string, error) {
mode, found, err := unstructured.NestedString(obj, "spec", "topology", "mode")
if err != nil {
return "", err
}
if found {
return mode, nil
}
return DBModeStandalone, nil
}

func (r MSSQLServer) usesTLSFn(obj map[string]interface{}) (bool, error) {
enabled, found, err := unstructured.NestedBool(obj, "spec", "tls", "clientTLS")
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
Copyright AppsCode Inc. and Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import "k8s.io/apimachinery/pkg/runtime/schema"

func init() {
RegisterOpsPathMapperToPlugins(&DruidOpsRequest{})
}

type DruidOpsRequest struct{}

var _ OpsPathMapper = (*DruidOpsRequest)(nil)

func (m *DruidOpsRequest) HorizontalPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{
"spec.horizontalScaling.topology.coordinators": "spec.topology.coordinators.replicas",
"spec.horizontalScaling.topology.overloads": "spec.topology.overloads.replicas",
"spec.horizontalScaling.topology.middleManagers": "spec.topology.middleManagers.replicas",
"spec.horizontalScaling.topology.historicals": "spec.topology.historicals.replicas",
"spec.horizontalScaling.topology.brokers": "spec.topology.brokers.replicas",
"spec.horizontalScaling.topology.routers": "spec.topology.routers.replicas",
}
}

func (m *DruidOpsRequest) VerticalPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{
"spec.verticalScaling.topology.coordinators": "spec.topology.coordinators.podTemplate.spec.resources",
"spec.verticalScaling.topology.overloads": "spec.topology.overloads.podTemplate.spec.resources",
"spec.verticalScaling.topology.middleManagers": "spec.topology.middleManagers.podTemplate.spec.resources",
"spec.verticalScaling.topology.historicals": "spec.topology.historicals.podTemplate.spec.resources",
"spec.verticalScaling.topology.brokers": "spec.topology.brokers.podTemplate.spec.resources",
"spec.verticalScaling.topology.routers": "spec.topology.routers.podTemplate.spec.resources",
}
}

func (m *DruidOpsRequest) VolumeExpansionPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{
"spec.volumeExpansion.topology.middleManagers": "spec.topology.middleManagers.podTemplate.spec.storage.resources.requests.storage",
"spec.volumeExpansion.topology.historicals": "spec.topology.historicals.podTemplate.spec.storage.resources.requests.storage",
}
}

func (m *DruidOpsRequest) GetAppRefPath() []string {
return []string{"spec", "databaseRef"}
}

func (m *DruidOpsRequest) GroupVersionKind() schema.GroupVersionKind {
return schema.GroupVersionKind{
Group: "ops.kubedb.com",
Version: "v1alpha1",
Kind: "DruidOpsRequest",
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Copyright AppsCode Inc. and Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import "k8s.io/apimachinery/pkg/runtime/schema"

func init() {
RegisterOpsPathMapperToPlugins(&FerretDBOpsRequest{})
}

type FerretDBOpsRequest struct{}

var _ OpsPathMapper = (*FerretDBOpsRequest)(nil)

func (m *FerretDBOpsRequest) HorizontalPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{
"spec.horizontalScaling.node": "spec.replicas",
}
}

func (m *FerretDBOpsRequest) VerticalPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{
"spec.verticalScaling.node": "spec.podTemplate.spec.resources",
}
}

func (m *FerretDBOpsRequest) VolumeExpansionPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{}
}

func (m *FerretDBOpsRequest) GetAppRefPath() []string {
return []string{"spec", "databaseRef"}
}

func (m *FerretDBOpsRequest) GroupVersionKind() schema.GroupVersionKind {
return schema.GroupVersionKind{
Group: "ops.kubedb.com",
Version: "v1alpha1",
Kind: "FerretDBOpsRequest",
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
Copyright AppsCode Inc. and Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import "k8s.io/apimachinery/pkg/runtime/schema"

func init() {
RegisterOpsPathMapperToPlugins(&MSSQLServerOpsRequest{})
}

type MSSQLServerOpsRequest struct{}

var _ OpsPathMapper = (*MSSQLServerOpsRequest)(nil)

func (m *MSSQLServerOpsRequest) HorizontalPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{
"spec.horizontalScaling.replicas": "spec.replicas",
}
}

func (m *MSSQLServerOpsRequest) VerticalPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{
"spec.verticalScaling.mssqlserver": "spec.podTemplate.spec.resources",
"spec.verticalScaling.exporter": "spec.monitor.prometheus.exporter.resources",
"spec.verticalScaling.coordinator": "spec.coordinator.resources",
}
}

func (m *MSSQLServerOpsRequest) VolumeExpansionPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{
"spec.volumeExpansion.mssqlserver": "spec.storage.resources.requests.storage",
}
}

func (m *MSSQLServerOpsRequest) GetAppRefPath() []string {
return []string{"spec", "databaseRef"}
}

func (m *MSSQLServerOpsRequest) GroupVersionKind() schema.GroupVersionKind {
return schema.GroupVersionKind{
Group: "ops.kubedb.com",
Version: "v1alpha1",
Kind: "MSSQLServerOpsRequest",
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
Copyright AppsCode Inc. and Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import "k8s.io/apimachinery/pkg/runtime/schema"

func init() {
RegisterOpsPathMapperToPlugins(&PerconaXtraDBOpsRequest{})
}

type PerconaXtraDBOpsRequest struct{}

var _ OpsPathMapper = (*PerconaXtraDBOpsRequest)(nil)

func (m *PerconaXtraDBOpsRequest) HorizontalPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{
"spec.horizontalScaling.member": "spec.replicas",
}
}

func (m *PerconaXtraDBOpsRequest) VerticalPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{
"spec.verticalScaling.perconaxtradb": "spec.podTemplate.spec.resources",
"spec.verticalScaling.exporter": "spec.monitor.prometheus.exporter.resources",
"spec.verticalScaling.coordinator": "spec.coordinator.resources",
}
}

func (m *PerconaXtraDBOpsRequest) VolumeExpansionPathMapping() map[OpsReqPath]ReferencedObjPath {
return map[OpsReqPath]ReferencedObjPath{
"spec.volumeExpansion.perconaxtradb": "spec.storage.resources.requests.storage",
}
}

func (m *PerconaXtraDBOpsRequest) GetAppRefPath() []string {
return []string{"spec", "databaseRef"}
}

func (m *PerconaXtraDBOpsRequest) GroupVersionKind() schema.GroupVersionKind {
return schema.GroupVersionKind{
Group: "ops.kubedb.com",
Version: "v1alpha1",
Kind: "PerconaXtraDBOpsRequest",
}
}
Loading

0 comments on commit d90641b

Please sign in to comment.