Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat(k8s): automatic service account token creation for k8s auth
Daniel Hougaard3d072c2f48b7
diff --git a/k8-operator/api/v1alpha1/zz_generated.deepcopy.go b/k8-operator/api/v1alpha1/zz_generated.deepcopy.goindex 2ad97108d4..4958e9c762 100644--- a/k8-operator/api/v1alpha1/zz_generated.deepcopy.go+++ b/k8-operator/api/v1alpha1/zz_generated.deepcopy.go@@ -48,7 +48,7 @@ func (in *Authentication) DeepCopyInto(out *Authentication) {out.ServiceAccount = in.ServiceAccountout.ServiceToken = in.ServiceTokenout.UniversalAuth = in.UniversalAuth- out.KubernetesAuth = in.KubernetesAuth+ in.KubernetesAuth.DeepCopyInto(&out.KubernetesAuth)out.AwsIamAuth = in.AwsIamAuthout.AzureAuth = in.AzureAuthout.GcpIdTokenAuth = in.GcpIdTokenAuth@@ -207,7 +207,7 @@ func (in *GenericGcpIdTokenAuth) DeepCopy() *GenericGcpIdTokenAuth {func (in *GenericInfisicalAuthentication) DeepCopyInto(out *GenericInfisicalAuthentication) {*out = *inout.UniversalAuth = in.UniversalAuth- out.KubernetesAuth = in.KubernetesAuth+ in.KubernetesAuth.DeepCopyInto(&out.KubernetesAuth)out.AwsIamAuth = in.AwsIamAuthout.AzureAuth = in.AzureAuthout.GcpIdTokenAuth = in.GcpIdTokenAuth@@ -228,6 +228,11 @@ func (in *GenericInfisicalAuthentication) DeepCopy() *GenericInfisicalAuthenticafunc (in *GenericKubernetesAuth) DeepCopyInto(out *GenericKubernetesAuth) {*out = *inout.ServiceAccountRef = in.ServiceAccountRef+ if in.ServiceAccountTokenAudiences != nil {+ in, out := &in.ServiceAccountTokenAudiences, &out.ServiceAccountTokenAudiences+ *out = make([]string, len(*in))+ copy(*out, *in)+ }}// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenericKubernetesAuth.@@ -336,7 +341,7 @@ func (in *InfisicalDynamicSecretList) DeepCopyObject() runtime.Object {func (in *InfisicalDynamicSecretSpec) DeepCopyInto(out *InfisicalDynamicSecretSpec) {*out = *inin.ManagedSecretReference.DeepCopyInto(&out.ManagedSecretReference)- out.Authentication = in.Authentication+ in.Authentication.DeepCopyInto(&out.Authentication)out.DynamicSecret = in.DynamicSecretout.TLS = in.TLS}@@ -476,7 +481,7 @@ func (in *InfisicalPushSecretSecretSource) DeepCopy() *InfisicalPushSecretSecretfunc (in *InfisicalPushSecretSpec) DeepCopyInto(out *InfisicalPushSecretSpec) {*out = *inout.Destination = in.Destination- out.Authentication = in.Authentication+ in.Authentication.DeepCopyInto(&out.Authentication)in.Push.DeepCopyInto(&out.Push)out.TLS = in.TLS}@@ -583,7 +588,7 @@ func (in *InfisicalSecretList) DeepCopyObject() runtime.Object {func (in *InfisicalSecretSpec) DeepCopyInto(out *InfisicalSecretSpec) {*out = *inout.TokenSecretReference = in.TokenSecretReference- out.Authentication = in.Authentication+ in.Authentication.DeepCopyInto(&out.Authentication)in.ManagedSecretReference.DeepCopyInto(&out.ManagedSecretReference)if in.ManagedKubeSecretReferences != nil {in, out := &in.ManagedKubeSecretReferences, &out.ManagedKubeSecretReferences@@ -654,6 +659,11 @@ func (in *KubernetesAuthDetails) DeepCopyInto(out *KubernetesAuthDetails) {*out = *inout.ServiceAccountRef = in.ServiceAccountRefout.SecretsScope = in.SecretsScope+ if in.ServiceAccountTokenAudiences != nil {+ in, out := &in.ServiceAccountTokenAudiences, &out.ServiceAccountTokenAudiences+ *out = make([]string, len(*in))+ copy(*out, *in)+ }}// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubernetesAuthDetails.diff --git a/k8-operator/config/crd/bases/secrets.infisical.com_infisicaldynamicsecrets.yaml b/k8-operator/config/crd/bases/secrets.infisical.com_infisicaldynamicsecrets.yamlindex c1cb7255d4..bcaf2b5405 100644--- a/k8-operator/config/crd/bases/secrets.infisical.com_infisicaldynamicsecrets.yaml+++ b/k8-operator/config/crd/bases/secrets.infisical.com_infisicaldynamicsecrets.yaml@@ -73,6 +73,12 @@ spec:type: objectkubernetesAuth:properties:+ autoCreateServiceAccountToken:+ description: Optionally automatically create a service account+ token for the configured service account. If this is set+ to `true`, the operator will automatically create a service+ account token for the configured service account.+ type: booleanidentityId:type: stringserviceAccountRef:@@ -85,6 +91,13 @@ spec:- name- namespacetype: object+ serviceAccountTokenAudiences:+ description: The audiences to use for the service account+ token. This is only relevant if `autoCreateServiceAccountToken`+ is true.+ items:+ type: string+ type: arrayrequired:- identityId- serviceAccountRefdiff --git a/k8-operator/config/crd/bases/secrets.infisical.com_infisicalpushsecrets.yaml b/k8-operator/config/crd/bases/secrets.infisical.com_infisicalpushsecrets.yamlindex 25fafd98a5..31779c2f23 100644--- a/k8-operator/config/crd/bases/secrets.infisical.com_infisicalpushsecrets.yaml+++ b/k8-operator/config/crd/bases/secrets.infisical.com_infisicalpushsecrets.yaml@@ -73,6 +73,12 @@ spec:type: objectkubernetesAuth:properties:+ autoCreateServiceAccountToken:+ description: Optionally automatically create a service account+ token for the configured service account. If this is set+ to `true`, the operator will automatically create a service+ account token for the configured service account.+ type: booleanidentityId:type: stringserviceAccountRef:@@ -85,6 +91,13 @@ spec:- name- namespacetype: object+ serviceAccountTokenAudiences:+ description: The audiences to use for the service account+ token. This is only relevant if `autoCreateServiceAccountToken`+ is true.+ items:+ type: string+ type: arrayrequired:- identityId- serviceAccountRefdiff --git a/k8-operator/config/crd/bases/secrets.infisical.com_infisicalsecrets.yaml b/k8-operator/config/crd/bases/secrets.infisical.com_infisicalsecrets.yamlindex 49ed43a770..8012521d96 100644--- a/k8-operator/config/crd/bases/secrets.infisical.com_infisicalsecrets.yaml+++ b/k8-operator/config/crd/bases/secrets.infisical.com_infisicalsecrets.yaml@@ -136,6 +136,12 @@ spec:type: objectkubernetesAuth:properties:+ autoCreateServiceAccountToken:+ description: Optionally automatically create a service account+ token for the configured service account. If this is set+ to `true`, the operator will automatically create a service+ account token for the configured service account.+ type: booleanidentityId:type: stringsecretsScope:@@ -163,6 +169,13 @@ spec:- name- namespacetype: object+ serviceAccountTokenAudiences:+ description: The audiences to use for the service account+ token. This is only relevant if `autoCreateServiceAccountToken`+ is true.+ items:+ type: string+ type: arrayrequired:- identityId- secretsScopediff --git a/k8-operator/config/rbac/role.yaml b/k8-operator/config/rbac/role.yamlindex ab0b4463ae..542face87a 100644--- a/k8-operator/config/rbac/role.yaml+++ b/k8-operator/config/rbac/role.yaml@@ -16,6 +16,13 @@ rules:- list- update- watch+- apiGroups:+ - ""+ resources:+ - pods+ verbs:+ - get+ - list- apiGroups:- ""resources:@@ -35,6 +42,12 @@ rules:- get- list- watch+- apiGroups:+ - ""+ resources:+ - serviceaccounts/token+ verbs:+ - create- apiGroups:- appsresources:@@ -55,6 +68,12 @@ rules:- list- update- watch+- apiGroups:+ - authentication.k8s.io+ resources:+ - tokenreviews+ verbs:+ - create- apiGroups:- secrets.infisical.comresources: