Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
49 changes: 49 additions & 0 deletions apis/config/v1alpha1/db2_hadr_config_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
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 (
core "k8s.io/api/core/v1"
ofst "kmodules.xyz/offshoot-api/api/v1"
)

type DB2HADRSpec struct {
Primary int `yaml:"primary,omitempty"`
Standby int `yaml:"standby,omitempty"`
//+optional
ConfigSecret core.LocalObjectReference `yaml:"configSecret,omitempty"`
// ServiceTemplates is an optional configuration for services used to expose database
// +optional
ServiceTemplates []NamedServiceTemplateSpec `yaml:"serviceTemplates,omitempty"`
}

// +kubebuilder:validation:Enum=primary;standby
type ServiceAlias string

const (
PrimaryServiceAlias ServiceAlias = "primary"
StandbyServiceAlias ServiceAlias = "standby"
)

type NamedServiceTemplateSpec struct {
// Alias represents the identifier of the service.
Alias ServiceAlias `yaml:"alias"`

// ServiceTemplate is an optional configuration for a service used to expose database
// +optional
ofst.ServiceTemplateSpec `yaml:",inline,omitempty"`
}
81 changes: 81 additions & 0 deletions apis/config/v1alpha1/openapi_generated.go

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

41 changes: 41 additions & 0 deletions apis/config/v1alpha1/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions apis/kubedb/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -2205,9 +2205,9 @@ const (
DB2DatabaseRoleKey = "db2.db/role"
DB2DatabaseRoleObserver = "observer"
DB2DatabaseRoleInstance = "instance"
DB2EnvUserName = "SYS_USER"
DB2EnvUserName = "db2inst1"
DB2EnvPassword = "DB2_PWD"
DB2EnvOracleSID = "DB2_SID"
DB2EnvSID = "DB2_SID"
DB2EnvDataDir = "DB2DATA"
)

Expand Down
4 changes: 4 additions & 0 deletions apis/kubedb/v1alpha2/db2_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ func (d *DB2) ResourceSingular() string {
return ResourceSingularDB2
}

func (d *DB2) ServiceAccountName() string {
return d.OffshootName()
}

func (d *DB2) SetDefaults(kc client.Client) {
if d.Spec.DeletionPolicy == "" {
d.Spec.DeletionPolicy = DeletionPolicyDelete
Expand Down
4 changes: 4 additions & 0 deletions apis/kubedb/v1alpha2/db2_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ type DB2Spec struct {
// +optional
// +kubebuilder:default={periodSeconds: 10, timeoutSeconds: 10, failureThreshold: 3}
HealthChecker kmapi.HealthCheckSpec `json:"healthChecker"`

// HADR configuration for DB2
// +optional
HADRConfig *core.LocalObjectReference `json:"hadrConfig,omitempty"`
}

// DB2Status defines the observed state of DB2.
Expand Down
8 changes: 7 additions & 1 deletion apis/kubedb/v1alpha2/openapi_generated.go

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

5 changes: 5 additions & 0 deletions apis/kubedb/v1alpha2/zz_generated.deepcopy.go

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

7 changes: 7 additions & 0 deletions crds/kubedb.com_db2s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ spec:
- WipeOut
- DoNotTerminate
type: string
hadrConfig:
properties:
name:
default: ""
type: string
type: object
x-kubernetes-map-type: atomic
healthChecker:
default:
failureThreshold: 3
Expand Down
Loading