Skip to content

Commit

Permalink
Update resource metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Aug 16, 2024
1 parent fe883c4 commit 149a60b
Show file tree
Hide file tree
Showing 31 changed files with 208 additions and 24 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ require (
k8s.io/kube-state-metrics/v2 v2.12.0
kmodules.xyz/apiversion v0.2.0
kmodules.xyz/authorizer v0.29.1
kmodules.xyz/client-go v0.30.10
kmodules.xyz/client-go v0.30.11
kmodules.xyz/custom-resources v0.30.0
kmodules.xyz/go-containerregistry v0.0.12
kmodules.xyz/monitoring-agent-api v0.29.0
kmodules.xyz/resource-metadata v0.18.11-0.20240814043703-81f80582e37c
kmodules.xyz/resource-metadata v0.18.11-0.20240816034909-ac043a4eb443
kmodules.xyz/resource-metrics v0.30.2-0.20240809125122-4c04e13dfc80
kmodules.xyz/resource-metrics/utils v0.30.1
kmodules.xyz/sets v0.29.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -908,8 +908,8 @@ kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk=
kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80=
kmodules.xyz/authorizer v0.29.1 h1:uByGGoryKbZcfiEAhjcK/Y345I9mygNQP7DVpkMbNQQ=
kmodules.xyz/authorizer v0.29.1/go.mod h1:kZRhclL8twzyt2bQuJQJbpYww2sc+qFr8I5PPoq/sWY=
kmodules.xyz/client-go v0.30.10 h1:adcwugZgT6NNeawHxy2XDbkcd+KXVQD4d3ROaOu0TPU=
kmodules.xyz/client-go v0.30.10/go.mod h1:XL3PDQIXG4s3xNRL2SSxIvi8b2WyMGpn26dFnOBz0j4=
kmodules.xyz/client-go v0.30.11 h1:2UFIu18O5xwKyKbmAn+vs8CIcnfogu0IACurgR2HAmU=
kmodules.xyz/client-go v0.30.11/go.mod h1:XL3PDQIXG4s3xNRL2SSxIvi8b2WyMGpn26dFnOBz0j4=
kmodules.xyz/crd-schema-fuzz v0.29.1 h1:zJTlWYOrT5dsVVHW8HGcnR/vaWfxQfNh11QwTtkYpcs=
kmodules.xyz/crd-schema-fuzz v0.29.1/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE=
kmodules.xyz/custom-resources v0.30.0 h1:vR3CbseHMLwR4GvtcJJuRuwIV8voKqFqNii27rMcm1o=
Expand All @@ -920,8 +920,8 @@ kmodules.xyz/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9
kmodules.xyz/monitoring-agent-api v0.29.0/go.mod h1:iNbvaMTgVFOI5q2LJtGK91j4Dmjv4ZRiRdasGmWLKQI=
kmodules.xyz/offshoot-api v0.29.4 h1:WQV2BIUIoVKKiqZNmZ4gAy367jEdwBhEl3dFCLZM1qA=
kmodules.xyz/offshoot-api v0.29.4/go.mod h1:e+NQ0s4gW/YTPWBWEfdISZcmk+tlTq8IjvP5SLdqvko=
kmodules.xyz/resource-metadata v0.18.11-0.20240814043703-81f80582e37c h1:CTmtn9WfLL3810hJWCu3P2tswlqaIVCSFKH5nGYPzak=
kmodules.xyz/resource-metadata v0.18.11-0.20240814043703-81f80582e37c/go.mod h1:0TAz+nyr1PbxsXST/B4Hpq4Qu2TiKik5Q0drWInQnFA=
kmodules.xyz/resource-metadata v0.18.11-0.20240816034909-ac043a4eb443 h1:CRE6W/KNzifK9FJhLJUw+xmWWlVJwYy3AX/sExcT9AU=
kmodules.xyz/resource-metadata v0.18.11-0.20240816034909-ac043a4eb443/go.mod h1:SBVlPWE1ClOwu2usSUlhHFuK9YOCfA9NmCGBklofmNM=
kmodules.xyz/resource-metrics v0.30.2-0.20240809125122-4c04e13dfc80 h1:0fOJLpzMFZbk3PGAQdlZNvhpIBEyZMN1823U9wa/lG0=
kmodules.xyz/resource-metrics v0.30.2-0.20240809125122-4c04e13dfc80/go.mod h1:UYcQQLN+3o8rNPQJwJa2D9bt5ihJCeo5bCDuQ4O3MPY=
kmodules.xyz/resource-metrics/utils v0.30.1 h1:iRnAKNMMdAi7QYjMQrK9W3vNMhSC21RWNx9yS3qlpTA=
Expand Down
15 changes: 14 additions & 1 deletion vendor/kmodules.xyz/client-go/api/v1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ limitations under the License.

package v1

import "strings"
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"fmt"
"strings"
)

// +kubebuilder:validation:Enum=Aws;Azure;DigitalOcean;GoogleCloud;Linode;Packet;Scaleway;Vultr;BareMetal;KIND;Generic;Private
type HostingProvider string
Expand Down Expand Up @@ -56,6 +62,13 @@ type ClusterMetadata struct {
CABundle string `json:"caBundle,omitempty"`
}

func (md ClusterMetadata) State() string {
hasher := hmac.New(sha256.New, []byte(md.UID))
state := fmt.Sprintf("%s,%s", md.APIEndpoint, md.OwnerID)
hasher.Write([]byte(state))
return base64.URLEncoding.EncodeToString(hasher.Sum(nil))
}

/*
ENUM(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,22 @@ spec:
- src: https://cdn.appscode.com/k8s/icons/stash.appscode.com/backupconfigurations.png
type: image/png
items:
- layoutName: stash.appscode.com-v1beta1-backupsessions-kubedb
- layoutName: core.kubestash.com-v1alpha1-backupsessions
name: Recent Backups
required: true
type:
group: stash.appscode.com
group: core.kubestash.com
kind: BackupSession
- layoutName: stash.appscode.com-v1alpha1-repositories-kubedb
name: Repository
- layoutName: core.kubestash.com-v1alpha1-backupconfigurations
name: Backup Configuration
required: true
type:
group: stash.appscode.com
kind: Repository
- layoutName: stash.appscode.com-v1beta1-restoresessions-kubedb
group: core.kubestash.com
kind: BackupConfiguration
- layoutName: core.kubestash.com-v1alpha1-restoresessions
name: Recent Restores
required: true
type:
group: stash.appscode.com
group: core.kubestash.com
kind: RestoreSession
name: Backups
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,22 @@ spec:
- src: https://cdn.appscode.com/k8s/icons/stash.appscode.com/backupconfigurations.png
type: image/png
items:
- layoutName: stash.appscode.com-v1alpha1-repositories-kubedb
name: Repository
- layoutName: core.kubestash.com-v1alpha1-backupsessions
name: Recent Backups
required: true
type:
group: stash.appscode.com
kind: Repository
- layoutName: stash.appscode.com-v1beta1-restoresessions-kubedb
name: Restore
group: core.kubestash.com
kind: BackupSession
- layoutName: core.kubestash.com-v1alpha1-backupconfigurations
name: Backup Configuration
required: true
type:
group: stash.appscode.com
group: core.kubestash.com
kind: BackupConfiguration
- layoutName: core.kubestash.com-v1alpha1-restoresessions
name: Restores
required: true
type:
group: core.kubestash.com
kind: RestoreSession
name: Backups
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,13 @@ spec:
type: object
deletionPolicy:
enum:
- Halt
- Delete
- WipeOut
- DoNotTerminate
type: string
halted:
type: boolean
healthChecker:
default:
failureThreshold: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ spec:
- WipeOut
- DoNotTerminate
type: string
halted:
type: boolean
healthChecker:
default:
failureThreshold: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6355,6 +6355,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4158,6 +4158,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3976,6 +3976,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3488,6 +3488,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6607,6 +6607,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4249,6 +4249,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3773,6 +3773,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9678,6 +9678,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4723,6 +4723,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4358,6 +4358,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4190,6 +4190,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ spec:
- databaseName
- databaseRef
type: object
halted:
type: boolean
healthChecker:
default:
failureThreshold: 1
Expand Down Expand Up @@ -3070,6 +3072,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down Expand Up @@ -3143,6 +3146,7 @@ spec:
type: string
terminationPolicy:
enum:
- Halt
- Delete
- WipeOut
- DoNotTerminate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3495,6 +3495,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4400,6 +4400,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
halted:
type: boolean
healthChecker:
default:
failureThreshold: 1
Expand Down Expand Up @@ -3078,6 +3080,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ spec:
type: string
disableSecurity:
type: boolean
disabledProtocols:
items:
enum:
- http
- amqp
- mqtt
- stomp
- web_mqtt
- web_stomp
type: string
type: array
enableSSL:
type: boolean
halted:
Expand Down Expand Up @@ -3479,6 +3490,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4253,6 +4253,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2940,6 +2940,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4487,6 +4487,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3482,6 +3482,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3481,6 +3481,7 @@ spec:
- primary
- standby
- stats
- dashboard
type: string
metadata:
properties:
Expand Down
Loading

0 comments on commit 149a60b

Please sign in to comment.