Skip to content

Commit

Permalink
chargedBack field added
Browse files Browse the repository at this point in the history
  • Loading branch information
akhandelwal committed Jan 22, 2024
1 parent 884dfc5 commit 4e97020
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/crd/bases/registry.ethos.adobe.com_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ spec:
chargebackBusinessUnit:
description: The BU responsible for paying for the cluster.
type: string
chargedBack:
description: Whether the cluster is charged back to the chargebackBusinessUnit
type: boolean
cloudProviderRegion:
description: The cloud provider standard region
type: string
Expand Down Expand Up @@ -321,6 +324,7 @@ spec:
- apiServer
- businessUnit
- chargebackBusinessUnit
- chargedBack
- cloudProviderRegion
- cloudType
- environment
Expand Down
1 change: 1 addition & 0 deletions local/client/dummy-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ spec:
type: Shared
businessUnit: BU1
chargebackBusinessUnit: BU1
chargedBack: true
offering:
- CaaS
- PaaS
Expand Down
1 change: 1 addition & 0 deletions local/database/dummy-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
type: Shared
businessUnit: BU1
chargebackBusinessUnit: BU1
chargedBack: true
offering:
- CaaS
- PaaS
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/registry/v1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ type ClusterSpec struct {
// +kubebuilder:validation:Required
ChargebackBusinessUnit string `json:"chargebackBusinessUnit"`

// Whether the cluster is charged back to the chargebackBusinessUnit
// +kubebuilder:validation:Required
ChargedBack bool `json:"chargedBack"`

// The Org that is responsible for the cluster operations
// +kubebuilder:validation:Required
ManagingOrg string `json:"managingOrg"`
Expand Down
4 changes: 4 additions & 0 deletions pkg/apiserver/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,10 @@ const docTemplate = `{
"description": "The BU responsible for paying for the cluster.\n+kubebuilder:validation:Required",
"type": "string"
},
"chargedBack": {
"description": "Whether the cluster is charged back to the chargebackBusinessUnit\n+kubebuilder:validation:Required",
"type": "boolean"
},
"cloudProviderRegion": {
"description": "The cloud provider standard region\n+kubebuilder:validation:Required",
"type": "string"
Expand Down
4 changes: 4 additions & 0 deletions pkg/apiserver/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,10 @@
"description": "The BU responsible for paying for the cluster.\n+kubebuilder:validation:Required",
"type": "string"
},
"chargedBack": {
"description": "Whether the cluster is charged back to the chargebackBusinessUnit\n+kubebuilder:validation:Required",
"type": "boolean"
},
"cloudProviderRegion": {
"description": "The cloud provider standard region\n+kubebuilder:validation:Required",
"type": "string"
Expand Down
5 changes: 5 additions & 0 deletions pkg/apiserver/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ definitions:
The BU responsible for paying for the cluster.
+kubebuilder:validation:Required
type: string
chargedBack:
description: |-
Whether the cluster is charged back to the chargebackBusinessUnit
+kubebuilder:validation:Required
type: boolean
cloudProviderRegion:
description: |-
The cloud provider standard region
Expand Down
1 change: 1 addition & 0 deletions pkg/client/controllers/cluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ var _ = Describe("Cluster Controller", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{},
AccountID: "",
Tiers: []registryv1.Tier{},
Expand Down
1 change: 1 addition & 0 deletions pkg/client/webhook/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ var _ = Describe("Webhook Server", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{},
AccountID: "",
Tiers: []registryv1.Tier{},
Expand Down
15 changes: 15 additions & 0 deletions pkg/database/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-555555555",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -435,6 +436,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-555555555",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -526,6 +528,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU2",
ChargebackBusinessUnit: "BU2",
ChargedBack: false,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-55555555",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -594,6 +597,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{"paas"},
AccountID: "12345678",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -688,6 +692,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-555555555",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -795,6 +800,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU2",
ChargebackBusinessUnit: "BU2",
ChargedBack: false,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-55555555",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -927,6 +933,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-555555555",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -1018,6 +1025,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU2",
ChargebackBusinessUnit: "BU2",
ChargedBack: false,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-55555555",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -1086,6 +1094,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{"paas"},
AccountID: "12345678",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -1160,6 +1169,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-555555555",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -1251,6 +1261,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU2",
ChargebackBusinessUnit: "BU2",
ChargedBack: false,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-55555555",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -1330,6 +1341,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-555555555",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -1421,6 +1433,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{"paas"},
AccountID: "12345678",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -1498,6 +1511,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU1",
ChargebackBusinessUnit: "BU1",
ChargedBack: true,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-555555555",
Tiers: []registryv1.Tier{
Expand Down Expand Up @@ -1589,6 +1603,7 @@ var _ = Describe("Database Suite", func() {
Environment: "Prod",
BusinessUnit: "BU2",
ChargebackBusinessUnit: "BU2",
ChargedBack: false,
Offering: []registryv1.Offering{"caas", "paas"},
AccountID: "11111-2222-3333-4444-55555555",
Tiers: []registryv1.Tier{
Expand Down
3 changes: 3 additions & 0 deletions pkg/database/testdata/clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
type: Shared
businessUnit: BU1
chargebackBusinessUnit: BU1
chargedBack: true
offering:
- caas
- paas
Expand Down Expand Up @@ -104,6 +105,7 @@
type: Dedicated
businessUnit: BU2
chargebackBusinessUnit: BU2
chargedBack: false
offering:
- caas
- paas
Expand Down Expand Up @@ -170,6 +172,7 @@
type: Dedicated
businessUnit: BU1
chargebackBusinessUnit: BU1
chargedBack: true
offering:
- paas
allowedTeams:
Expand Down
1 change: 1 addition & 0 deletions test/testdata/cluster05-prod-useast1-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"businessUnit": "BU1",
"chargebackBusinessUnit": "BU1",
"chargedBack": true,
"managingOrg": "Org1",
"cloudType": "azure",
"environment": "prod",
Expand Down
1 change: 1 addition & 0 deletions test/testdata/cluster05-prod-useast1.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"businessUnit": "BU1",
"chargebackBusinessUnit": "BU1",
"chargedBack": true,
"managingOrg": "Org1",
"cloudType": "azure",
"environment": "prod",
Expand Down

0 comments on commit 4e97020

Please sign in to comment.