Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap token #717

Merged
merged 54 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
9a45b92
wip
jswoods May 18, 2023
5955f8b
wip
jswoods Jun 26, 2023
c963de5
wip
jswoods Jun 26, 2023
8ab8bce
wip
jswoods Jun 29, 2023
bfd1e14
wip
jswoods Jul 12, 2023
30cf39f
WIP
jswoods Aug 23, 2023
c716b7d
WIP
jswoods Aug 30, 2023
aee0ee1
WIP
jswoods Sep 21, 2023
2a41d47
Fix client
jswoods Sep 22, 2023
5299760
Fix go dep
jswoods Sep 22, 2023
452c0b3
Fix helm
jswoods Sep 22, 2023
9f06ef7
some cleanup
jswoods Sep 28, 2023
243fc59
WIP
jswoods Sep 28, 2023
2239d6f
more cleanup
jswoods Oct 2, 2023
8917f40
more cleanup
jswoods Oct 4, 2023
fe44a4e
more cleanup
jswoods Oct 9, 2023
1421571
more cleanup
jswoods Oct 9, 2023
e9bf3da
more cleanup
jswoods Oct 10, 2023
009a9c1
fix allowsCreate mistake
jswoods Oct 10, 2023
a1e318a
refactor
jswoods Nov 17, 2023
115889e
fix version
jswoods Nov 17, 2023
dfa9fdb
refactor
jswoods Nov 17, 2023
e26572b
rename bootstrap token
jswoods Nov 17, 2023
776ac2f
rename bootstrap token
jswoods Nov 18, 2023
d98db23
fix bootstrap token pod
jswoods Nov 29, 2023
d05b782
fix tests
jswoods Nov 29, 2023
8b51ebd
fix tests
jswoods Nov 29, 2023
d5b6873
fix tests
jswoods Nov 30, 2023
89fa20d
fix tests
jswoods Nov 30, 2023
5fbdecc
fix tests
jswoods Nov 30, 2023
61b4172
fix tests
jswoods Nov 30, 2023
d6c6dae
fix tests
jswoods Nov 30, 2023
ce82388
Switch tests to multiv2
jswoods Nov 30, 2023
3b855d5
more cleanup
jswoods Dec 6, 2023
d922363
fix multi auth
jswoods Dec 6, 2023
d2e8c60
cleanup
jswoods Jun 3, 2024
22037c4
cleanup
jswoods Jun 3, 2024
3845754
cleanup
jswoods Jun 21, 2024
3d86375
deprecate AuthServiceAccountName
jswoods Jul 3, 2024
6bba1ba
update crds
jswoods Jul 3, 2024
28be699
update
jswoods Jul 9, 2024
2298899
rebase cleanup
jswoods Aug 5, 2024
667607a
rebase cleanup
jswoods Aug 5, 2024
244cd16
rebase cleanup
jswoods Aug 5, 2024
a9d3160
fix up manifests
jswoods Sep 3, 2024
4916d34
cleanup
jswoods Sep 3, 2024
87bdbd2
cleanup
jswoods Sep 3, 2024
93c70fc
cleanup
jswoods Sep 3, 2024
0736381
nosec // #nosec G101
jswoods Sep 3, 2024
bc744ba
fix up go deps
jswoods Sep 3, 2024
762466c
bump default version to 1.142.3" and fix bootstrap pod exec for lates…
jswoods Sep 5, 2024
d125db7
cleanup
jswoods Sep 6, 2024
41ce946
update test
jswoods Sep 6, 2024
0706d42
update test
jswoods Sep 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions api/v1alpha1/humiobootstraptoken_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
Copyright 2020 Humio https://humio.com

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 (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
// HumioBootstrapTokenStateNotReady is the NotReady state of the bootstrap token
HumioBootstrapTokenStateNotReady = "NotReady"
// HumioBootstrapTokenStateReady is the Ready state of the bootstrap token
HumioBootstrapTokenStateReady = "Ready"
)

// HumioBootstrapTokenSpec defines the bootstrap token that Humio will use to bootstrap authentication
type HumioBootstrapTokenSpec struct {
// ManagedClusterName refers to the name of the HumioCluster which will use this bootstrap token
ManagedClusterName string `json:"managedClusterName,omitempty"`
// ExternalClusterName refers to the name of the HumioExternalCluster which will use this bootstrap token for authentication
// This conflicts with ManagedClusterName.
ExternalClusterName string `json:"externalClusterName,omitempty"`
// Image can be set to override the image used to run when generating a bootstrap token. This will default to the image
// that is used by either the HumioCluster resource or the first NodePool resource if ManagedClusterName is set on the HumioBootstrapTokenSpec
Image string `json:"bootstrapImage,omitempty"`
// ImagePullSecrets defines the imagepullsecrets for the bootstrap image onetime pod. These secrets are not created by the operator. This will default to the imagePullSecrets
// that are used by either the HumioCluster resource or the first NodePool resource if ManagedClusterName is set on the HumioBootstrapTokenSpec
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
// Resources is the kubernetes resource limits for the bootstrap onetime pod
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// TokenSecret is the secret reference that contains the token to use for this HumioBootstrapToken. This is used if one wants to use an existing
// token for the BootstrapToken rather than letting the operator create one by running a bootstrap token onetime pod
TokenSecret HumioTokenSecretSpec `json:"tokenSecret,omitempty"`
// HashedTokenSecret is the secret reference that contains the hashed token to use for this HumioBootstrapToken. This is used if one wants to use an existing
// hashed token for the BootstrapToken rather than letting the operator create one by running a bootstrap token onetime pod
HashedTokenSecret HumioHashedTokenSecretSpec `json:"hashedTokenSecret,omitempty"`
}

type HumioTokenSecretSpec struct {
// SecretKeyRef is the secret key reference to a kubernetes secret containing the bootstrap token secret
SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`
}

type HumioHashedTokenSecretSpec struct {
// SecretKeyRef is the secret key reference to a kubernetes secret containing the bootstrap hashed token secret
SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`
}

type HumioBootstrapTokenStatus struct {
// State can be "NotReady" or "Ready"
State string `json:"state,omitempty"`
// TokenSecretKeyRef contains the secret key reference to a kubernetes secret containing the bootstrap token secret. This is set regardless of whether it's defined
// in the spec or automatically created
TokenSecretKeyRef HumioTokenSecretStatus `json:"tokenSecretStatus,omitempty"`
// HashedTokenSecret is the secret reference that contains the hashed token to use for this HumioBootstrapToken. This is set regardless of whether it's defined
// in the spec or automatically created
HashedTokenSecretKeyRef HumioHashedTokenSecretStatus `json:"hashedTokenSecretStatus,omitempty"`
}

// HumioTokenSecretStatus contains the secret key reference to a kubernetes secret containing the bootstrap token secret. This is set regardless of whether it's defined
// in the spec or automatically created
type HumioTokenSecretStatus struct {
// SecretKeyRef contains the secret key reference to a kubernetes secret containing the bootstrap token secret. This is set regardless of whether it's defined
// in the spec or automatically created
SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`
}

// HumioTokenSecretStatus contains the secret key reference to a kubernetes secret containing the bootstrap token secret. This is set regardless of whether it's defined
// in the spec or automatically created
type HumioHashedTokenSecretStatus struct {
// SecretKeyRef is the secret reference that contains the hashed token to use for this HumioBootstrapToken. This is set regardless of whether it's defined
// in the spec or automatically created
SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:path=humiobootstraptokens,scope=Namespaced
//+kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state",description="The state of the bootstrap token"
//+operator-sdk:gen-csv:customresourcedefinitions.displayName="Humio Bootstrap Token"

// HumioBootstrapToken defines the bootstrap token that Humio will use to bootstrap authentication
type HumioBootstrapToken struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec HumioBootstrapTokenSpec `json:"spec,omitempty"`
Status HumioBootstrapTokenStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// HumioBootstrapTokenList contains a list of HumioBootstrapTokens
type HumioBootstrapTokenList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []HumioBootstrapToken `json:"items"`
}

func init() {
SchemeBuilder.Register(&HumioBootstrapToken{}, &HumioBootstrapTokenList{})
}
2 changes: 1 addition & 1 deletion api/v1alpha1/humiocluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ type HumioNodeSpec struct {
// DataVolumeSource is the volume that is mounted on the humio pods. This conflicts with DataVolumePersistentVolumeClaimSpecTemplate.
DataVolumeSource corev1.VolumeSource `json:"dataVolumeSource,omitempty"`

// AuthServiceAccountName is the name of the Kubernetes Service Account that will be attached to the auth container in the humio pod.
// *Deprecated: AuthServiceAccountName is no longer used as the auth sidecar container has been removed.*
AuthServiceAccountName string `json:"authServiceAccountName,omitempty"`

// DisableInitContainer is used to disable the init container completely which collects the availability zone from the Kubernetes worker node.
Expand Down
183 changes: 183 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Loading
Loading