Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hetzner and Cloudflare storage credential #109

Merged
merged 2 commits into from
Oct 21, 2024
Merged
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
50 changes: 34 additions & 16 deletions apis/cloud/v1alpha1/credential_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,25 @@ const (
ResourceCredentials = "credentials"
)

// +kubebuilder:validation:Enum=Aws;Azure;AzureStorage;DigitalOcean;GoogleCloud;GoogleOAuth;Linode;Packet;Rancher;Scaleway;Vultr;Swift;Hetzner
// +kubebuilder:validation:Enum=Aws;Azure;AzureStorage;CloudflareStorage;DigitalOcean;GoogleCloud;GoogleOAuth;Hetzner;HetznerStorage;Linode;Packet;Rancher;Scaleway;Vultr;Swift;Hetzner
type CredentialType string

const (
CredentialTypeAWS CredentialType = "Aws"
CredentialTypeAzure CredentialType = "Azure"
CredentialTypeAzureStorage CredentialType = "AzureStorage"
CredentialTypeDigitalOcean CredentialType = "DigitalOcean"
CredentialTypeGoogleCloud CredentialType = "GoogleCloud"
CredentialTypeGoogleOAuth CredentialType = "GoogleOAuth"
CredentialTypeLinode CredentialType = "Linode"
CredentialTypePacket CredentialType = "Packet"
CredentialTypeRancher CredentialType = "Rancher"
CredentialTypeScaleway CredentialType = "Scaleway"
CredentialTypeVultr CredentialType = "Vultr"
CredentialTypeSwift CredentialType = "Swift"
CredentialTypeHetzner CredentialType = "Hetzner"
CredentialTypeAWS CredentialType = "Aws"
CredentialTypeAzure CredentialType = "Azure"
CredentialTypeAzureStorage CredentialType = "AzureStorage"
CredentialTypeCloudflareStorage CredentialType = "CloudflareStorage"
CredentialTypeDigitalOcean CredentialType = "DigitalOcean"
CredentialTypeGoogleCloud CredentialType = "GoogleCloud"
CredentialTypeGoogleOAuth CredentialType = "GoogleOAuth"
CredentialTypeHetzner CredentialType = "Hetzner"
CredentialTypeHetznerStorage CredentialType = "HetznerStorage"
CredentialTypeLinode CredentialType = "Linode"
CredentialTypePacket CredentialType = "Packet"
CredentialTypeRancher CredentialType = "Rancher"
CredentialTypeScaleway CredentialType = "Scaleway"
CredentialTypeVultr CredentialType = "Vultr"
CredentialTypeSwift CredentialType = "Swift"
)

// +genclient
Expand Down Expand Up @@ -72,12 +74,18 @@ type CredentialSpec struct {
//+optional
AzureStorage *AzureStorageCredential `json:"azureStorage,omitempty"`
//+optional
CloudflareStorage *CloudflareStorageCredential `json:"cloudflareStorage,omitempty"`
//+optional
DigitalOcean *DigitalOceanCredential `json:"digitalocean,omitempty"`
//+optional
GoogleCloud *GoogleCloudCredential `json:"googleCloud,omitempty"`
//+optional
GoogleOAuth *GoogleOAuthCredential `json:"googleOAuth,omitempty"`
//+optional
Hetzner *HetznerCredential `json:"hetzner,omitempty"`
//+optional
HetznerStorage *HetznerStorageCredential `json:"hetznerStorage,omitempty"`
//+optional
Linode *LinodeCredential `json:"linode,omitempty"`
//+optional
Packet *PacketCredential `json:"packet,omitempty"`
Expand All @@ -89,8 +97,6 @@ type CredentialSpec struct {
Swift *SwiftCredential `json:"swift,omitempty"`
//+optional
Vultr *VultrCredential `json:"vultr,omitempty"`
//+optional
Hetzner *HetznerCredential `json:"hetzner,omitempty"`
}

type GoogleOAuthCredential struct {
Expand Down Expand Up @@ -163,11 +169,23 @@ type SwiftCredential struct {
TenantId string `json:"tenantID,omitempty"`
TenantDomain string `json:"tenantDomain,omitempty"`
}

type HetznerCredential struct {
SSHKeyName string `json:"sshKeyName"`
Token string `json:"token"`
}

type HetznerStorageCredential struct {
AccessKeyID string `json:"accessKeyID"`
SecretAccessKey string `json:"secretAccessKey"`
}

type CloudflareStorageCredential struct {
AccountID string `json:"accountID"`
AccessKeyID string `json:"accessKeyID"`
SecretAccessKey string `json:"secretAccessKey"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
type CredentialList struct {
Expand Down
52 changes: 47 additions & 5 deletions apis/cloud/v1alpha1/zz_generated.deepcopy.go

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

26 changes: 26 additions & 0 deletions crds/cloud.appscode.com_credentials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,19 @@ spec:
- account
- key
type: object
cloudflareStorage:
properties:
accessKeyID:
type: string
accountID:
type: string
secretAccessKey:
type: string
required:
- accessKeyID
- accountID
- secretAccessKey
type: object
digitalocean:
properties:
token:
Expand Down Expand Up @@ -117,6 +130,16 @@ spec:
- sshKeyName
- token
type: object
hetznerStorage:
properties:
accessKeyID:
type: string
secretAccessKey:
type: string
required:
- accessKeyID
- secretAccessKey
type: object
linode:
properties:
token:
Expand Down Expand Up @@ -189,9 +212,12 @@ spec:
- Aws
- Azure
- AzureStorage
- CloudflareStorage
- DigitalOcean
- GoogleCloud
- GoogleOAuth
- Hetzner
- HetznerStorage
- Linode
- Packet
- Rancher
Expand Down
Loading