generator_gcr.go 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. */
  12. package v1alpha1
  13. import (
  14. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  15. esmeta "github.com/external-secrets/external-secrets/apis/meta/v1"
  16. )
  17. type GCRAccessTokenSpec struct {
  18. // Auth defines the means for authenticating with GCP
  19. Auth GCPSMAuth `json:"auth"`
  20. // ProjectID defines which project to use to authenticate with
  21. ProjectID string `json:"projectID"`
  22. }
  23. type GCPSMAuth struct {
  24. // +optional
  25. SecretRef *GCPSMAuthSecretRef `json:"secretRef,omitempty"`
  26. // +optional
  27. WorkloadIdentity *GCPWorkloadIdentity `json:"workloadIdentity,omitempty"`
  28. }
  29. type GCPSMAuthSecretRef struct {
  30. // The SecretAccessKey is used for authentication
  31. // +optional
  32. SecretAccessKey esmeta.SecretKeySelector `json:"secretAccessKeySecretRef,omitempty"`
  33. }
  34. type GCPWorkloadIdentity struct {
  35. ServiceAccountRef esmeta.ServiceAccountSelector `json:"serviceAccountRef"`
  36. ClusterLocation string `json:"clusterLocation"`
  37. ClusterName string `json:"clusterName"`
  38. ClusterProjectID string `json:"clusterProjectID,omitempty"`
  39. }
  40. // GCRAccessToken generates an GCP access token
  41. // that can be used to authenticate with GCR.
  42. // +kubebuilder:object:root=true
  43. // +kubebuilder:storageversion
  44. // +kubebuilder:subresource:status
  45. // +kubebuilder:metadata:labels="external-secrets.io/component=controller"
  46. // +kubebuilder:resource:scope=Namespaced,categories={gcraccesstoken},shortName=gcraccesstoken
  47. type GCRAccessToken struct {
  48. metav1.TypeMeta `json:",inline"`
  49. metav1.ObjectMeta `json:"metadata,omitempty"`
  50. Spec GCRAccessTokenSpec `json:"spec,omitempty"`
  51. }
  52. // +kubebuilder:object:root=true
  53. // GCRAccessTokenList contains a list of ExternalSecret resources.
  54. type GCRAccessTokenList struct {
  55. metav1.TypeMeta `json:",inline"`
  56. metav1.ListMeta `json:"metadata,omitempty"`
  57. Items []GCRAccessToken `json:"items"`
  58. }