Skip to content
Draft
6 changes: 6 additions & 0 deletions apis/catalog/v1alpha1/db2_version_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ type DB2VersionSpec struct {
// Coordinator Image
// +optional
Coordinator DB2Coordinator `json:"coordinator,omitempty"`
// Init Docker Image
// +optional
Scripts initDocker `json:"scripts,omitempty"`
// Deprecated versions usable but regarded as obsolete and best avoided, typically due to having been superseded.
// +optional
Deprecated bool `json:"deprecated,omitempty"`
Expand All @@ -83,6 +86,9 @@ type DB2VersionDatabase struct {
type DB2Coordinator struct {
Image string `json:"image"`
}
type initDocker struct {
Image string `json:"image"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

Expand Down
30 changes: 29 additions & 1 deletion apis/catalog/v1alpha1/openapi_generated.go

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

1 change: 1 addition & 0 deletions apis/catalog/v1alpha1/zz_generated.deepcopy.go

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

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.

25 changes: 23 additions & 2 deletions apis/kubedb/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -2205,10 +2205,31 @@ 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"

// volume related constants
// volume related
DB2VolumeNameData = "database"
DB2VolumeMountPathData = "/var/opt/db2"
DB2VolumeNameConfig = "config"
DB2VolumeMountPathConfig = "/var/opt/db2/db2.conf"
DB2VolumeNameInitScript = "init-scripts"
DB2VolumeMountPathInitScript = "/scripts"
DB2VolumeNameInitDatabase = "init-database"
DB2VolumeMountPathInitDatabase = "/init-database"
DB2VolumeNameEndpointCert = "endpoint-cert"
DB2VolumeMountPathEndpointCert = "/var/opt/db2/endpoint-cert"
DB2VolumeNameCerts = "certs"
DB2VolumeMountPathCerts = "/var/opt/db2/certs"
DB2VolumeNameTLS = "tls"
DB2VolumeMountPathTLS = "/var/opt/db2/tls"
DB2VolumeNameSecurityCACertificates = "security-ca-certificates"
DB2VolumeMountPathSecurityCACertificates = "/var/opt/db2/security/ca-certificates"
DB2VolumeNameCACerts = "cacerts"
DB2VolumeMountPathCACerts = "/etc/ssl/certs"
)

// =========================== Qdrant Constants ============================
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/catalog.kubedb.com_db2versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ spec:
type: boolean
endOfLife:
type: boolean
scripts:
properties:
image:
type: string
required:
- image
type: object
securityContext:
properties:
runAsUser:
Expand Down
Loading
Loading