Skip to content

Commit

Permalink
Added AutomountServiceAccountToken to PodSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
hernanDatgDev authored and squakez committed Jun 3, 2024
1 parent 45b7a70 commit 81d9b26
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/modules/ROOT/partials/apis/camel-k-crds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4909,6 +4909,13 @@ PodSpec defines a group of Kubernetes resources.
|Field
|Description
|`automountServiceAccountToken` +
bool
|
AutomountServiceAccountToken
|`volumes` +
*https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#volume-v1-core[[\]Kubernetes core/v1.Volume]*
|
Expand Down
3 changes: 3 additions & 0 deletions helm/camel-k/crds/crd-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ spec:
description: ActiveDeadlineSeconds
format: int64
type: integer
automountServiceAccountToken:
description: AutomountServiceAccountToken
type: boolean
containers:
description: Containers
items:
Expand Down
3 changes: 3 additions & 0 deletions helm/camel-k/crds/crd-kamelet-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ spec:
description: ActiveDeadlineSeconds
format: int64
type: integer
automountServiceAccountToken:
description: AutomountServiceAccountToken
type: boolean
containers:
description: Containers
items:
Expand Down
3 changes: 3 additions & 0 deletions helm/camel-k/crds/crd-pipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ spec:
description: ActiveDeadlineSeconds
format: int64
type: integer
automountServiceAccountToken:
description: AutomountServiceAccountToken
type: boolean
containers:
description: Containers
items:
Expand Down
4 changes: 3 additions & 1 deletion pkg/apis/camel/v1/integration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// Important: Run "make generate-deepcopy" to regenerate code after modifying this file
// Important: Run "make generate" to regenerate code after modifying this file

// +genclient
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
Expand Down Expand Up @@ -284,6 +284,8 @@ type PodSpecTemplate struct {

// PodSpec defines a group of Kubernetes resources.
type PodSpec struct {
// AutomountServiceAccountToken
AutomountServiceAccountToken *bool `json:"automountServiceAccountToken,omitempty" protobuf:"varint,21,opt,name=automountServiceAccountToken"`
// Volumes
Volumes []corev1.Volume `json:"volumes,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,1,rep,name=volumes"`
// InitContainers
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/camel/v1/zz_generated.deepcopy.go

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

9 changes: 9 additions & 0 deletions pkg/client/camel/applyconfiguration/camel/v1/podspec.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ spec:
description: ActiveDeadlineSeconds
format: int64
type: integer
automountServiceAccountToken:
description: AutomountServiceAccountToken
type: boolean
containers:
description: Containers
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ spec:
description: ActiveDeadlineSeconds
format: int64
type: integer
automountServiceAccountToken:
description: AutomountServiceAccountToken
type: boolean
containers:
description: Containers
items:
Expand Down
3 changes: 3 additions & 0 deletions pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ spec:
description: ActiveDeadlineSeconds
format: int64
type: integer
automountServiceAccountToken:
description: AutomountServiceAccountToken
type: boolean
containers:
description: Containers
items:
Expand Down
8 changes: 8 additions & 0 deletions pkg/trait/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ func TestSupplementalGroup(t *testing.T) {
assert.Contains(t, templateSpec.Spec.SecurityContext.SupplementalGroups, int64(666))
}

func TestAutomountServiceAccountToken(t *testing.T) {
templateString := `automountServiceAccountToken: false`
templateSpec := testPodTemplateSpec(t, templateString)

assert.NotNil(t, templateSpec.Spec.AutomountServiceAccountToken)
assert.False(t, *templateSpec.Spec.AutomountServiceAccountToken)
}

// nolint: unparam
func createPodTest(podSpecTemplate string) (*podTrait, *Environment, *appsv1.Deployment) {
trait, _ := newPodTrait().(*podTrait)
Expand Down

0 comments on commit 81d9b26

Please sign in to comment.