-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84e0ed6
commit 8c0d345
Showing
29 changed files
with
1,742 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package v1alpha1 | ||
|
||
type GenericInfisicalAuthentication struct { | ||
// +kubebuilder:validation:Optional | ||
UniversalAuth GenericUniversalAuth `json:"universalAuth,omitempty"` | ||
// +kubebuilder:validation:Optional | ||
KubernetesAuth GenericKubernetesAuth `json:"kubernetesAuth,omitempty"` | ||
// +kubebuilder:validation:Optional | ||
AwsIamAuth GenericAwsIamAuth `json:"awsIamAuth,omitempty"` | ||
// +kubebuilder:validation:Optional | ||
AzureAuth GenericAzureAuth `json:"azureAuth,omitempty"` | ||
// +kubebuilder:validation:Optional | ||
GcpIdTokenAuth GenericGcpIdTokenAuth `json:"gcpIdTokenAuth,omitempty"` | ||
// +kubebuilder:validation:Optional | ||
GcpIamAuth GenericGcpIamAuth `json:"gcpIamAuth,omitempty"` | ||
} | ||
|
||
type GenericUniversalAuth struct { | ||
// +kubebuilder:validation:Required | ||
CredentialsRef KubeSecretReference `json:"credentialsRef"` | ||
} | ||
|
||
type GenericAwsIamAuth struct { | ||
// +kubebuilder:validation:Required | ||
IdentityID string `json:"identityId"` | ||
} | ||
|
||
type GenericAzureAuth struct { | ||
// +kubebuilder:validation:Required | ||
IdentityID string `json:"identityId"` | ||
// +kubebuilder:validation:Optional | ||
Resource string `json:"resource,omitempty"` | ||
} | ||
|
||
type GenericGcpIdTokenAuth struct { | ||
// +kubebuilder:validation:Required | ||
IdentityID string `json:"identityId"` | ||
} | ||
|
||
type GenericGcpIamAuth struct { | ||
// +kubebuilder:validation:Required | ||
IdentityID string `json:"identityId"` | ||
// +kubebuilder:validation:Required | ||
ServiceAccountKeyFilePath string `json:"serviceAccountKeyFilePath"` | ||
} | ||
|
||
type GenericKubernetesAuth struct { | ||
// +kubebuilder:validation:Required | ||
IdentityID string `json:"identityId"` | ||
// +kubebuilder:validation:Required | ||
ServiceAccountRef KubernetesServiceAccountRef `json:"serviceAccountRef"` | ||
} | ||
|
||
type TLSConfig struct { | ||
// Reference to secret containing CA cert | ||
// +kubebuilder:validation:Optional | ||
CaRef CaReference `json:"caRef,omitempty"` | ||
} | ||
|
||
type CaReference struct { | ||
// The name of the Kubernetes Secret | ||
// +kubebuilder:validation:Required | ||
SecretName string `json:"secretName"` | ||
|
||
// The namespace where the Kubernetes Secret is located | ||
// +kubebuilder:validation:Required | ||
SecretNamespace string `json:"secretNamespace"` | ||
|
||
// +kubebuilder:validation:Required | ||
// The name of the secret property with the CA certificate value | ||
SecretKey string `json:"key"` | ||
} | ||
|
||
type KubeSecretReference struct { | ||
// The name of the Kubernetes Secret | ||
// +kubebuilder:validation:Required | ||
SecretName string `json:"secretName"` | ||
|
||
// The name space where the Kubernetes Secret is located | ||
// +kubebuilder:validation:Required | ||
SecretNamespace string `json:"secretNamespace"` | ||
} | ||
|
||
type ManagedKubeSecretConfig struct { | ||
// The name of the Kubernetes Secret | ||
// +kubebuilder:validation:Required | ||
SecretName string `json:"secretName"` | ||
|
||
// The name space where the Kubernetes Secret is located | ||
// +kubebuilder:validation:Required | ||
SecretNamespace string `json:"secretNamespace"` | ||
|
||
// The Kubernetes Secret type (experimental feature). More info: https://kubernetes.io/docs/concepts/configuration/secret/#secret-types | ||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:default:=Opaque | ||
SecretType string `json:"secretType"` | ||
|
||
// The Kubernetes Secret creation policy. | ||
// Enum with values: 'Owner', 'Orphan'. | ||
// Owner creates the secret and sets .metadata.ownerReferences of the InfisicalSecret CRD that created it. | ||
// Orphan will not set the secret owner. This will result in the secret being orphaned and not deleted when the resource is deleted. | ||
// +kubebuilder:validation:Optional | ||
// +kubebuilder:default:=Orphan | ||
CreationPolicy string `json:"creationPolicy"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
Copyright 2022. | ||
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 ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type InfisicalDynamicSecretLease struct { | ||
ID string `json:"id"` | ||
Version int64 `json:"version"` | ||
CreationTimestamp metav1.Time `json:"creationTimestamp"` | ||
ExpiresAt metav1.Time `json:"expiresAt"` | ||
} | ||
|
||
type DynamicSecretDetails struct { | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:Immutable | ||
SecretName string `json:"secretName"` | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:Immutable | ||
SecretPath string `json:"secretsPath"` | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:Immutable | ||
EnvironmentSlug string `json:"environmentSlug"` | ||
// +kubebuilder:validation:Required | ||
// +kubebuilder:validation:Immutable | ||
ProjectID string `json:"projectId"` | ||
} | ||
|
||
// InfisicalDynamicSecretSpec defines the desired state of InfisicalDynamicSecret. | ||
type InfisicalDynamicSecretSpec struct { | ||
// +kubebuilder:validation:Required | ||
ManagedSecretReference ManagedKubeSecretConfig `json:"managedSecretReference"` // The destination to store the lease in. | ||
|
||
// +kubebuilder:validation:Required | ||
Authentication GenericInfisicalAuthentication `json:"authentication"` // The authentication to use for authenticating with Infisical. | ||
|
||
// +kubebuilder:validation:Required | ||
DynamicSecret DynamicSecretDetails `json:"dynamicSecret"` // The dynamic secret to create the lease for. Required. | ||
|
||
LeaseRevocationPolicy string `json:"leaseRevocationPolicy"` // Revoke will revoke the lease when the resource is deleted. Optional, will default to no revocation. | ||
LeaseTTL string `json:"leaseTTL"` // The TTL of the lease in seconds. Optional, will default to the dynamic secret default TTL. | ||
|
||
// +kubebuilder:validation:Optional | ||
HostAPI string `json:"hostAPI"` | ||
|
||
// +kubebuilder:validation:Optional | ||
TLS TLSConfig `json:"tls"` | ||
} | ||
|
||
// InfisicalDynamicSecretStatus defines the observed state of InfisicalDynamicSecret. | ||
type InfisicalDynamicSecretStatus struct { | ||
Lease *InfisicalDynamicSecretLease `json:"lease,omitempty"` | ||
|
||
DynamicSecretID string `json:"dynamicSecretId,omitempty"` | ||
|
||
// The MaxTTL can be null, if it's null, there's no max TTL and we should never have to renew. | ||
MaxTTL string `json:"maxTTL,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
|
||
// InfisicalDynamicSecret is the Schema for the infisicaldynamicsecrets API. | ||
type InfisicalDynamicSecret struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec InfisicalDynamicSecretSpec `json:"spec,omitempty"` | ||
Status InfisicalDynamicSecretStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// InfisicalDynamicSecretList contains a list of InfisicalDynamicSecret. | ||
type InfisicalDynamicSecretList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []InfisicalDynamicSecret `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&InfisicalDynamicSecret{}, &InfisicalDynamicSecretList{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.