Skip to content

Commit 2116812

Browse files
authored
Merge branch 'main' into gcp-auth-engine-config
2 parents 4116f3b + 19ed719 commit 2116812

File tree

52 files changed

+355
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+355
-103
lines changed

.github/workflows/pr.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ jobs:
1313
RUN_UNIT_TESTS: true
1414
RUN_INTEGRATION_TESTS: true
1515
RUN_HELMCHART_TEST: true
16-
GO_VERSION: ~1.19
16+
GO_VERSION: ~1.21
1717
OPERATOR_SDK_VERSION: v1.25.3

.github/workflows/push.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ jobs:
2020
RUN_UNIT_TESTS: true
2121
RUN_INTEGRATION_TESTS: true
2222
RUN_HELMCHART_TEST: true
23-
GO_VERSION: ~1.19
23+
GO_VERSION: ~1.21
2424
OPERATOR_SDK_VERSION: v1.25.3

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.19 as builder
2+
FROM golang:1.21 as builder
33

44
WORKDIR /workspace
55
# Copy the Go Modules manifests

api/v1alpha1/authenginemount_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ type AuthEngineMountSpec struct {
5353
Name string `json:"name,omitempty"`
5454
}
5555

56+
func (d *AuthEngineMount) IsDeletable() bool {
57+
return true
58+
}
59+
5660
func (d *AuthEngineMount) GetPath() string {
5761
if d.Spec.Name != "" {
5862
return vaultutils.CleansePath(d.GetEngineListPath() + "/" + string(d.Spec.Path) + "/" + d.Spec.Name)

api/v1alpha1/azureauthengineconfig_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ type AzureConfig struct {
130130
var _ vaultutils.VaultObject = &AzureAuthEngineConfig{}
131131
var _ vaultutils.ConditionsAware = &AzureAuthEngineConfig{}
132132

133+
func (d *AzureAuthEngineConfig) IsDeletable() bool {
134+
return true
135+
}
136+
133137
func (d *AzureAuthEngineConfig) GetVaultConnection() *vaultutils.VaultConnection {
134138
return d.Spec.Connection
135139
}

api/v1alpha1/azureauthenginerole_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ func init() {
188188
SchemeBuilder.Register(&AzureAuthEngineRole{}, &AzureAuthEngineRoleList{})
189189
}
190190

191+
func (d *AzureAuthEngineRole) IsDeletable() bool {
192+
return true
193+
}
194+
191195
func (r *AzureAuthEngineRole) GetConditions() []metav1.Condition {
192196
return r.Status.Conditions
193197
}

api/v1alpha1/azuresecretengineconfig_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ func init() {
128128
SchemeBuilder.Register(&AzureSecretEngineConfig{}, &AzureSecretEngineConfigList{})
129129
}
130130

131+
func (d *AzureSecretEngineConfig) IsDeletable() bool {
132+
return true
133+
}
134+
131135
func (r *AzureSecretEngineConfig) SetConditions(conditions []metav1.Condition) {
132136
r.Status.Conditions = conditions
133137
}

api/v1alpha1/databasesecretengineconfig_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ func (d *DatabaseSecretEngineConfig) GetVaultConnection() *vaultutils.VaultConne
6969
return d.Spec.Connection
7070
}
7171

72+
func (d *DatabaseSecretEngineConfig) IsDeletable() bool {
73+
return true
74+
}
75+
7276
func (d *DatabaseSecretEngineConfig) GetPath() string {
7377
if d.Spec.Name != "" {
7478
return vaultutils.CleansePath(string(d.Spec.Path) + "/" + "config" + "/" + d.Spec.Name)

api/v1alpha1/databasesecretenginerole_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ var _ vaultutils.VaultObject = &DatabaseSecretEngineRole{}
5959

6060
var _ vaultutils.ConditionsAware = &DatabaseSecretEngineRole{}
6161

62+
func (d *DatabaseSecretEngineRole) IsDeletable() bool {
63+
return true
64+
}
65+
6266
func (d *DatabaseSecretEngineRole) GetVaultConnection() *vaultutils.VaultConnection {
6367
return d.Spec.Connection
6468
}

api/v1alpha1/databasesecretenginestaticrole_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ func (d *DatabaseSecretEngineStaticRole) GetVaultConnection() *vaultutils.VaultC
144144
return d.Spec.Connection
145145
}
146146

147+
func (d *DatabaseSecretEngineStaticRole) IsDeletable() bool {
148+
return true
149+
}
150+
147151
func (d *DatabaseSecretEngineStaticRole) GetPath() string {
148152
if d.Spec.Name != "" {
149153
return vaultutils.CleansePath(string(d.Spec.Path) + "/" + "static-roles" + "/" + d.Spec.Name)

api/v1alpha1/gcpauthengineconfig_types.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,13 @@ type GCPAuthEngineConfigList struct {
8484

8585
type GCPConfig struct {
8686

87-
88-
// Service Account Name. A service account is a special kind of account typically used by an application or compute workload, such as a Compute Engine instance, rather than a person.
87+
// Service Account Name. A service account is a special kind of account typically used by an application or compute workload, such as a Compute Engine instance, rather than a person.
8988
// A service account is identified by its email address, which is unique to the account.
90-
// Applications use service accounts to make authorized API calls by authenticating as either the service account itself, or as Google Workspace or Cloud Identity users through domain-wide delegation.
89+
// Applications use service accounts to make authorized API calls by authenticating as either the service account itself, or as Google Workspace or Cloud Identity users through domain-wide delegation.
9190
// When an application authenticates as a service account, it has access to all resources that the service account has permission to access.
9291
// +kubebuilder:validation:Optional
9392
// +kubebuilder:default=""
94-
ServiceAccount string `json:"serviceAccount,omitempty"`
93+
ServiceAccount string `json:"serviceAccount,omitempty"`
9594

9695
// Must be either unique_id or role_id.
9796
// If unique_id is specified, the service account's unique ID will be used for alias names during login.
@@ -138,7 +137,7 @@ type GCPConfig struct {
138137
CustomEndpoint *apiextensionsv1.JSON `json:"customEndpoint,omitempty"`
139138

140139
retrievedServiceAccount string `json:"-"`
141-
retrievedCredentials string `json:"-"`
140+
retrievedCredentials string `json:"-"`
142141
}
143142

144143
var _ vaultutils.VaultObject = &GCPAuthEngineConfig{}
@@ -148,6 +147,10 @@ func (d *GCPAuthEngineConfig) GetVaultConnection() *vaultutils.VaultConnection {
148147
return d.Spec.Connection
149148
}
150149

150+
func (d *GCPAuthEngineConfig) IsDeletable() bool {
151+
return false
152+
}
153+
151154
func (r *GCPAuthEngineConfig) GetConditions() []metav1.Condition {
152155
return r.Status.Conditions
153156
}

api/v1alpha1/gcpauthenginerole_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ func init() {
215215
SchemeBuilder.Register(&GCPAuthEngineRole{}, &GCPAuthEngineRoleList{})
216216
}
217217

218+
func (d *GCPAuthEngineRole) IsDeletable() bool {
219+
return true
220+
}
221+
218222
func (r *GCPAuthEngineRole) GetConditions() []metav1.Condition {
219223
return r.Status.Conditions
220224
}

api/v1alpha1/githubsecretengineconfig_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ func (d *GitHubSecretEngineConfig) GetVaultConnection() *vaultutils.VaultConnect
9696
return d.Spec.Connection
9797
}
9898

99+
func (d *GitHubSecretEngineConfig) IsDeletable() bool {
100+
return false
101+
}
102+
99103
func (d *GitHubSecretEngineConfig) GetPath() string {
100104
return string(d.Spec.Path) + "/" + "config"
101105
}

api/v1alpha1/githubsecretenginerole_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ func (d *GitHubSecretEngineRole) IsInitialized() bool {
115115
return true
116116
}
117117

118+
func (d *GitHubSecretEngineRole) IsDeletable() bool {
119+
return true
120+
}
121+
118122
func (d *GitHubSecretEngineRole) PrepareInternalValues(context context.Context, object client.Object) error {
119123
return nil
120124
}

api/v1alpha1/group_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ func (m *Group) GetConditions() []metav1.Condition {
119119
return m.Status.Conditions
120120
}
121121

122+
func (d *Group) IsDeletable() bool {
123+
return true
124+
}
125+
122126
func (m *Group) SetConditions(conditions []metav1.Condition) {
123127
m.Status.Conditions = conditions
124128
}

api/v1alpha1/groupalias_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ func (m *GroupAlias) GetConditions() []metav1.Condition {
107107
return m.Status.Conditions
108108
}
109109

110+
func (d *GroupAlias) IsDeletable() bool {
111+
return true
112+
}
113+
110114
func (m *GroupAlias) SetConditions(conditions []metav1.Condition) {
111115
m.Status.Conditions = conditions
112116
}

api/v1alpha1/jwtoidcauthengineconfig_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ func (d *JWTOIDCAuthEngineConfig) GetVaultConnection() *vaultutils.VaultConnecti
174174
return d.Spec.Connection
175175
}
176176

177+
func (d *JWTOIDCAuthEngineConfig) IsDeletable() bool {
178+
return false
179+
}
180+
177181
func (r *JWTOIDCAuthEngineConfig) GetConditions() []metav1.Condition {
178182
return r.Status.Conditions
179183
}

api/v1alpha1/jwtoidcauthenginerole_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ func (d *JWTOIDCAuthEngineRole) GetVaultConnection() *vaultutils.VaultConnection
257257
return d.Spec.Connection
258258
}
259259

260+
func (d *JWTOIDCAuthEngineRole) IsDeletable() bool {
261+
return true
262+
}
263+
260264
func (r *JWTOIDCAuthEngineRole) GetKubeAuthConfiguration() *vaultutils.KubeAuthConfiguration {
261265
return &r.Spec.Authentication
262266
}

api/v1alpha1/kubernetesauthengineconfig_types.go

+17
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ func (d *KubernetesAuthEngineConfig) IsInitialized() bool {
8585
return true
8686
}
8787

88+
func (d *KubernetesAuthEngineConfig) IsDeletable() bool {
89+
return false
90+
}
91+
8892
func (d *KubernetesAuthEngineConfig) PrepareInternalValues(context context.Context, object client.Object) error {
8993
log := log.FromContext(context)
9094

@@ -144,6 +148,17 @@ type KAECConfig struct {
144148
// +kubebuilder:default=false
145149
DisableLocalCAJWT bool `json:"disableLocalCAJWT,omitempty"`
146150

151+
// UseOperatorPodCA . This field is considered only if `kubernetesCACert` is not set and `disableLocalCAJWT` is set to true.
152+
// In this case if this field is set to true the operator pod's CA is injected. This is the original behavior before the introduction of this field
153+
// If tis field is set to false, the os ca bundle of where vault is running will be used.
154+
// +kubebuilder:validation:Optional
155+
// +kubebuilder:default=true
156+
UseOperatorPodCA bool `json:"useOperatorPodCA,omitempty"`
157+
158+
// UseAnnotationsAsAliasMetadata Use annotations from the client token's associated service account as alias metadata for the Vault entity. Only annotations with the vault.hashicorp.com/alias-metadata- key prefix are targeted as alias metadata and your annotations must be 512 characters or less due to the Vault alias metadata value limit. For example, if you configure the annotation vault.hashicorp.com/alias-metadata-foo, Vault saves the string "foo" along with the annotation value to the alias metadata. To save alias metadata, Vault must have permission to read service accounts from the Kubernetes API.
159+
// +kubebuilder:validation:Optional
160+
UseAnnotationsAsAliasMetadata bool `json:"useAnnotationsAsAliasMetadata,omitempty"`
161+
147162
retrievedTokenReviewerJWT string `json:"-"`
148163
}
149164

@@ -199,6 +214,8 @@ func (i *KAECConfig) toMap() map[string]interface{} {
199214
payload["issuer"] = i.Issuer
200215
payload["disable_iss_validation"] = i.DisableISSValidation
201216
payload["disable_local_ca_jwt"] = i.DisableLocalCAJWT
217+
payload["use_annotations_as_alias_metadata"] = i.UseAnnotationsAsAliasMetadata
218+
202219
return payload
203220
}
204221

api/v1alpha1/kubernetesauthengineconfig_webhook.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var _ webhook.Defaulter = &KubernetesAuthEngineConfig{}
4545
// Default implements webhook.Defaulter so a webhook will be registered for the type
4646
func (r *KubernetesAuthEngineConfig) Default() {
4747
kubernetesauthengineconfiglog.Info("default", "name", r.Name)
48-
if r.Spec.KubernetesCACert == "" {
48+
if r.Spec.UseOperatorPodCA && r.Spec.KubernetesCACert == "" {
4949
b, err := os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/ca.crt")
5050
if err != nil {
5151
kubernetesauthengineconfiglog.Error(err, "unable to read file /var/run/secrets/kubernetes.io/serviceaccount/ca.crt")

api/v1alpha1/kubernetesauthenginerole_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ func (d *KubernetesAuthEngineRole) GetVaultConnection() *vaultutils.VaultConnect
6767
return d.Spec.Connection
6868
}
6969

70+
func (d *KubernetesAuthEngineRole) IsDeletable() bool {
71+
return true
72+
}
73+
7074
func (d *KubernetesAuthEngineRole) GetPath() string {
7175
if d.Spec.Name != "" {
7276
return vaultutils.CleansePath("auth/" + string(d.Spec.Path) + "/role/" + d.Spec.Name)

api/v1alpha1/kubernetessecretengineconfig_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ func (d *KubernetesSecretEngineConfig) GetVaultConnection() *vaultutils.VaultCon
106106
return d.Spec.Connection
107107
}
108108

109+
func (d *KubernetesSecretEngineConfig) IsDeletable() bool {
110+
return true
111+
}
112+
109113
func (d *KubernetesSecretEngineConfig) GetPath() string {
110114
return string(d.Spec.Path) + "/" + "config"
111115
}

api/v1alpha1/kubernetessecretenginerole_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ var _ vaultutils.VaultObject = &KubernetesSecretEngineRole{}
6161

6262
var _ vaultutils.ConditionsAware = &KubernetesSecretEngineRole{}
6363

64+
func (d *KubernetesSecretEngineRole) IsDeletable() bool {
65+
return true
66+
}
67+
6468
func (d *KubernetesSecretEngineRole) GetPath() string {
6569
if d.Spec.Name != "" {
6670
return vaultutils.CleansePath(string(d.Spec.Path) + "/" + "roles" + "/" + d.Spec.Name)

api/v1alpha1/ldapauthengineconfig_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ func (d *LDAPAuthEngineConfig) GetVaultConnection() *vaultutils.VaultConnection
6161
return d.Spec.Connection
6262
}
6363

64+
func (d *LDAPAuthEngineConfig) IsDeletable() bool {
65+
return false
66+
}
67+
6468
func (d *LDAPAuthEngineConfig) GetPath() string {
6569
return vaultutils.CleansePath("auth/" + string(d.Spec.Path) + "/config")
6670
}

api/v1alpha1/ldapauthenginegroup_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ func (d *LDAPAuthEngineGroup) GetPath() string {
6363
return vaultutils.CleansePath("auth/" + string(d.Spec.Path) + "/groups/" + string(d.Spec.Name))
6464
}
6565

66+
func (d *LDAPAuthEngineGroup) IsDeletable() bool {
67+
return true
68+
}
69+
6670
func (d *LDAPAuthEngineGroup) GetPayload() map[string]interface{} {
6771
return d.toMap()
6872
}

api/v1alpha1/passwordpolicy_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ func (d *PasswordPolicy) IsInitialized() bool {
5454
return true
5555
}
5656

57+
func (d *PasswordPolicy) IsDeletable() bool {
58+
return true
59+
}
60+
5761
func (d *PasswordPolicy) PrepareInternalValues(context context.Context, object client.Object) error {
5862
return nil
5963
}

api/v1alpha1/pkisecretengineconfig_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ func (d *PKISecretEngineConfig) GetVaultConnection() *vaultutils.VaultConnection
233233
return d.Spec.Connection
234234
}
235235

236+
func (d *PKISecretEngineConfig) IsDeletable() bool {
237+
return false
238+
}
239+
236240
func (p *PKISecretEngineConfig) GetPath() string {
237241
return string(p.Spec.Path)
238242
}

api/v1alpha1/pkisecretenginerole_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ func (r *PKISecretEngineRole) IsValid() (bool, error) {
9292
return true, nil
9393
}
9494

95+
func (d *PKISecretEngineRole) IsDeletable() bool {
96+
return true
97+
}
98+
9599
type PKIRole struct {
96100

97101
// Specifies the Time To Live value provided as a string duration with time suffix. Hour is the largest suffix. If not set, uses the system default value or the value of max_ttl, whichever is shorter.

api/v1alpha1/policy_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ func (d *Policy) IsInitialized() bool {
7171
return true
7272
}
7373

74+
func (d *Policy) IsDeletable() bool {
75+
return true
76+
}
77+
7478
func (d *Policy) PrepareInternalValues(context context.Context, object client.Object) error {
7579
// Fast path escape if no "${..}" placeholder is detected
7680
match, err := regexp.MatchString("\\${[^}]+}", d.Spec.Policy)

api/v1alpha1/quaysecretengineconfig_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ func (d *QuaySecretEngineConfig) GetVaultConnection() *vaultutils.VaultConnectio
5959
return d.Spec.Connection
6060
}
6161

62+
func (d *QuaySecretEngineConfig) IsDeletable() bool {
63+
return false
64+
}
65+
6266
func (q *QuaySecretEngineConfig) GetPath() string {
6367
return string(q.Spec.Path) + "/" + "config"
6468
}

api/v1alpha1/quaysecretenginerole_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ func (d *QuaySecretEngineRole) GetVaultConnection() *vaultutils.VaultConnection
7676
return d.Spec.Connection
7777
}
7878

79+
func (d *QuaySecretEngineRole) IsDeletable() bool {
80+
return true
81+
}
82+
7983
func (d *QuaySecretEngineRole) GetPath() string {
8084
if d.Spec.Name != "" {
8185
return vaultutils.CleansePath(string(d.Spec.Path) + "/" + "roles" + "/" + d.Spec.Name)

api/v1alpha1/quaysecretenginestaticrole_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ func (q *QuaySecretEngineStaticRole) IsInitialized() bool {
7474
return true
7575
}
7676

77+
func (d *QuaySecretEngineStaticRole) IsDeletable() bool {
78+
return true
79+
}
80+
7781
func (q *QuaySecretEngineStaticRole) PrepareInternalValues(context context.Context, object client.Object) error {
7882
return nil
7983
}

0 commit comments

Comments
 (0)