Skip to content

Commit

Permalink
fix: set defaults in the operator
Browse files Browse the repository at this point in the history
  • Loading branch information
waveywaves committed Jul 25, 2023
1 parent 283e244 commit 5cf4827
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 148 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.0.39
VERSION ?= 0.0.40

# 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
78 changes: 42 additions & 36 deletions api/v1alpha1/uffizzicluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,88 +72,94 @@ type UffizziClusterIngress struct {
// quota of resources a namespace has access to
type UffizziClusterResourceQuota struct {
//+kubebuilder:default:=true
Enabled bool `json:"enabled"`
Requests UffizziClusterRequestsQuota `json:"requests"`
Limits UffizziClusterResourceQuotaLimits `json:"limits"`
Services UffizziClusterServicesQuota `json:"services"`
Count UffizziClusterResourceCount `json:"count"`
Enabled bool `json:"enabled"`
//+kubebuilder:default:={}
Requests UffizziClusterRequestsQuota `json:"requests,omitempty"`
//+kubebuilder:default:={}
Limits UffizziClusterResourceQuotaLimits `json:"limits,omitempty"`
//+kubebuilder:default:={}
Services UffizziClusterServicesQuota `json:"services,omitempty"`
//+kubebuilder:default:={}
Count UffizziClusterResourceCount `json:"count,omitempty"`
}

type UffizziClusterLimitRange struct {
//+kubebuilder:default:=true
Enabled bool `json:"enabled"`
Default UffizziClusterLimitRangeDefault `json:"default"`
DefaultRequest UffizziClusterLimitRangeDefaultRequest `json:"defaultRequest"`
Enabled bool `json:"enabled"`
//+kubebuilder:default:={}
Default UffizziClusterLimitRangeDefault `json:"default,omitempty"`
//+kubebuilder:default:={}
DefaultRequest UffizziClusterLimitRangeDefaultRequest `json:"defaultRequest,omitempty"`
}

type UffizziClusterRequestsQuota struct {
//+kubebuilder:default:="0.5"
CPU string `json:"cpu"`
CPU string `json:"cpu,omitempty"`
//+kubebuilder:default:="1Gi"
Memory string `json:"memory"`
Memory string `json:"memory,omitempty"`
//+kubebuilder:default:="5Gi"
EphemeralStorage string `json:"ephemeralStorage"`
EphemeralStorage string `json:"ephemeralStorage,omitempty"`
//+kubebuilder:default:="5Gi"
Storage string `json:"storage"`
Storage string `json:"storage,omitempty"`
}

type UffizziClusterResourceQuotaLimits struct {
//+kubebuilder:default:="0.5"
CPU string `json:"cpu"`
CPU string `json:"cpu,omitempty"`
//+kubebuilder:default:="8Gi"
Memory string `json:"memory"`
Memory string `json:"memory,omitempty"`
//+kubebuilder:default:="5Gi"
EphemeralStorage string `json:"ephemeralStorage"`
EphemeralStorage string `json:"ephemeralStorage,omitempty"`
}

type UffizziClusterLimitRangeDefault struct {
//+kubebuilder:default:="0.5"
CPU string `json:"cpu"`
CPU string `json:"cpu,omitempty"`
//+kubebuilder:default:="1Gi"
Memory string `json:"memory"`
Memory string `json:"memory,omitempty"`
//+kubebuilder:default:="8Gi"
EphemeralStorage string `json:"ephemeralStorage"`
EphemeralStorage string `json:"ephemeralStorage,omitempty"`
}

type UffizziClusterLimitRangeDefaultRequest struct {
//+kubebuilder:default:="0.1"
CPU string `json:"cpu"`
CPU string `json:"cpu,omitempty"`
//+kubebuilder:default:="128Mi"
Memory string `json:"memory"`
Memory string `json:"memory,omitempty"`
//+kubebuilder:default:="1Gi"
EphemeralStorage string `json:"ephemeralStorage"`
EphemeralStorage string `json:"ephemeralStorage,omitempty"`
}

type UffizziClusterServicesQuota struct {
//+kubebuilder:default:=0
NodePorts int `json:"nodePorts"`
NodePorts int `json:"nodePorts,omitempty"`
//+kubebuilder:default:=3
LoadBalancers int `json:"loadBalancers"`
LoadBalancers int `json:"loadBalancers,omitempty"`
}

type UffizziClusterResourceCount struct {
//+kubebuilder:default:=20
Pods int `json:"pods"`
Pods int `json:"pods,omitempty"`
//+kubebuilder:default:=10
Services int `json:"services"`
//+kubebuilder:default:=4
ConfigMaps int `json:"configMaps"`
Services int `json:"services,omitempty"`
//+kubebuilder:default:=20
Secrets int `json:"secrets"`
ConfigMaps int `json:"configMaps,omitempty"`
//+kubebuilder:default:=20
Secrets int `json:"secrets,omitempty"`
//+kubebuilder:default:=10
PersistentVolumeClaims int `json:"persistentVolumeClaims"`
PersistentVolumeClaims int `json:"persistentVolumeClaims,omitempty"`
//+kubebuilder:default:=10
Endpoints int `json:"endpoints"`
Endpoints int `json:"endpoints,omitempty"`
}

// UffizziClusterSpec defines the desired state of UffizziCluster
type UffizziClusterSpec struct {
Ingress UffizziClusterIngress `json:"ingress,omitempty"`
TTL string `json:"ttl,omitempty"`
Helm []HelmChart `json:"helm,omitempty"`
Manifests *string `json:"manifests,omitempty"`
ResourceQuota UffizziClusterResourceQuota `json:"resourceQuota,omitempty"`
LimitRange UffizziClusterLimitRange `json:"limitRange,omitempty"`
Ingress UffizziClusterIngress `json:"ingress,omitempty"`
TTL string `json:"ttl,omitempty"`
Helm []HelmChart `json:"helm,omitempty"`
Manifests *string `json:"manifests,omitempty"`
ResourceQuota *UffizziClusterResourceQuota `json:"resourceQuota,omitempty"`
LimitRange *UffizziClusterLimitRange `json:"limitRange,omitempty"`
}

// UffizziClusterStatus defines the observed state of UffizziCluster
Expand Down
12 changes: 10 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version: 0.1.10
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v0.0.39"
appVersion: "v0.0.40"
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ spec:
memory:
default: 1Gi
type: string
required:
- cpu
- ephemeralStorage
- memory
type: object
defaultRequest:
properties:
Expand All @@ -144,17 +140,11 @@ spec:
memory:
default: 128Mi
type: string
required:
- cpu
- ephemeralStorage
- memory
type: object
enabled:
default: true
type: boolean
required:
- default
- defaultRequest
- enabled
type: object
manifests:
Expand All @@ -165,7 +155,7 @@ spec:
count:
properties:
configMaps:
default: 4
default: 20
type: integer
endpoints:
default: 10
Expand All @@ -182,13 +172,6 @@ spec:
services:
default: 10
type: integer
required:
- configMaps
- endpoints
- persistentVolumeClaims
- pods
- secrets
- services
type: object
enabled:
default: true
Expand All @@ -204,10 +187,6 @@ spec:
memory:
default: 8Gi
type: string
required:
- cpu
- ephemeralStorage
- memory
type: object
requests:
properties:
Expand All @@ -223,11 +202,6 @@ spec:
storage:
default: 5Gi
type: string
required:
- cpu
- ephemeralStorage
- memory
- storage
type: object
services:
properties:
Expand All @@ -237,16 +211,9 @@ spec:
nodePorts:
default: 0
type: integer
required:
- loadBalancers
- nodePorts
type: object
required:
- count
- enabled
- limits
- requests
- services
type: object
ttl:
type: string
Expand Down
2 changes: 1 addition & 1 deletion chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

image:
repository: docker.io/uffizzi/uffizzi-cluster-operator
tag: v0.0.39
tag: v0.0.40

# `flux` dependency values
flux:
Expand Down
35 changes: 1 addition & 34 deletions config/crd/bases/uffizzi.com_uffizziclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ spec:
memory:
default: 1Gi
type: string
required:
- cpu
- ephemeralStorage
- memory
type: object
defaultRequest:
properties:
Expand All @@ -149,17 +145,11 @@ spec:
memory:
default: 128Mi
type: string
required:
- cpu
- ephemeralStorage
- memory
type: object
enabled:
default: true
type: boolean
required:
- default
- defaultRequest
- enabled
type: object
manifests:
Expand All @@ -171,7 +161,7 @@ spec:
count:
properties:
configMaps:
default: 4
default: 20
type: integer
endpoints:
default: 10
Expand All @@ -188,13 +178,6 @@ spec:
services:
default: 10
type: integer
required:
- configMaps
- endpoints
- persistentVolumeClaims
- pods
- secrets
- services
type: object
enabled:
default: true
Expand All @@ -210,10 +193,6 @@ spec:
memory:
default: 8Gi
type: string
required:
- cpu
- ephemeralStorage
- memory
type: object
requests:
properties:
Expand All @@ -229,11 +208,6 @@ spec:
storage:
default: 5Gi
type: string
required:
- cpu
- ephemeralStorage
- memory
- storage
type: object
services:
properties:
Expand All @@ -243,16 +217,9 @@ spec:
nodePorts:
default: 0
type: integer
required:
- loadBalancers
- nodePorts
type: object
required:
- count
- enabled
- limits
- requests
- services
type: object
ttl:
type: string
Expand Down
Loading

0 comments on commit 5cf4827

Please sign in to comment.