-
Notifications
You must be signed in to change notification settings - Fork 46
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
Support multi secret #242
Support multi secret #242
Conversation
pkg/common/utils/k8s/client.go
Outdated
@@ -229,6 +229,20 @@ func GetConfigMap(ctx context.Context, k8scient client.Client, namespace, name s | |||
return &configMap, nil | |||
} | |||
|
|||
// CheckSecretExist check if the secret is in the namespace. | |||
func CheckSecretExist(ctx context.Context, k8scient client.Client, namespace string, secrets []dorisv1.Secret) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This func is not necessary. After checking, it only prints the log and has no effect on subsequent operations. Checking whether it exists can be done later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…i_secret_0910 # Conflicts: # config/crd/bases/crds.yaml # config/crd/bases/disaggregated.cluster.doris.com_dorisdisaggregatedclusters.yaml # pkg/controller/sub_controller/disaggregated_cluster/computeclusters/controller.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
// Current Secret Mount Path, default is "/etc/doris" | ||
// If Secret belongs to the same Secrets, their MountPath cannot be repeated. | ||
// +optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mountPath can't be repeated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
# this yaml describe `secret` config in DorisCluster CRD. | ||
#Compareed to `doriscluster-sample.yaml`, It have `secret` config for fe | ||
apiVersion: doris.selectdb.com/v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add secrets that used in the example, in front of the yaml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pkg/common/utils/k8s/client.go
Outdated
@@ -229,6 +229,20 @@ func GetConfigMap(ctx context.Context, k8scient client.Client, namespace, name s | |||
return &configMap, nil | |||
} | |||
|
|||
// CheckSecretExist check if the secret is in the namespace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChecSecretExist, check the secret exist or not in specify namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, and I moved this method to sub_controller.go
pkg/common/utils/resource/pod.go
Outdated
defaultMountPath := "" | ||
switch componentType { | ||
case v1.Component_FE, v1.Component_BE, v1.Component_CN, v1.Component_Broker: | ||
defaultMountPath = config_env_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't use env_config_path,should use secret_config_path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pkg/common/utils/resource/pod.go
Outdated
var volumes []corev1.Volume | ||
var volumeMounts []corev1.VolumeMount | ||
|
||
if bSpec.Secrets == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check is not needed. for golang splice, iterate the nil splice is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -99,6 +100,11 @@ func (be *Controller) Sync(ctx context.Context, dcr *v1.DorisCluster) error { | |||
return err | |||
} | |||
|
|||
// check if the secret exists in the namespace | |||
if dcr.Spec.BeSpec.Secrets != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check should before "applystatefulset" and should output an event on dorislcuster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…i_secret_0910 # Conflicts: # pkg/common/utils/resource/pod.go # pkg/controller/sub_controller/events.go
issue: #237
Support multi secret: