mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-16 22:37:16 +00:00
* Feat: support to manage the integrations by the CLI and the workflow Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: remove the xml Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: add the unit test for the nacos writer Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: add the integration API Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: make the provider commands to be deprecated Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: make the unit test work Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: rename the integration to the config Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: make the unit test cases work Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: refactor the config commands Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: add the distribution status for the config Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: sort the import packages Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: refine the code style Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: refine the code style Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: get the content format before render the content Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: add some examples Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: the command test cases Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Feat: add the definitions of the workflow step Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: add some tests Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: add some tests Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: change the name Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: retry the CI Signed-off-by: barnettZQG <barnett.zqg@gmail.com> * Fix: refine some words Signed-off-by: barnettZQG <barnett.zqg@gmail.com> Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
58 lines
1.7 KiB
Go
58 lines
1.7 KiB
Go
/*
|
|
Copyright 2022 The KubeVela Authors.
|
|
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 utils
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
|
|
v1 "k8s.io/api/core/v1"
|
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
|
|
|
"github.com/oam-dev/kubevela/apis/types"
|
|
|
|
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
|
|
)
|
|
|
|
// GetDexConnectors returns the dex connectors for Dex connector controller
|
|
func GetDexConnectors(ctx context.Context, k8sClient client.Client) ([]map[string]interface{}, error) {
|
|
secrets := &v1.SecretList{}
|
|
if err := k8sClient.List(ctx, secrets, client.InNamespace(types.DefaultKubeVelaNS),
|
|
client.MatchingLabels{types.LabelConfigType: types.DexConnector}); err != nil {
|
|
return nil, err
|
|
}
|
|
connectors := make([]map[string]interface{}, len(secrets.Items))
|
|
for i, s := range secrets.Items {
|
|
var data map[string]interface{}
|
|
key := s.Labels[types.LabelConfigSubType]
|
|
if _, ok := s.Data[key]; ok {
|
|
err := json.Unmarshal(s.Data[key], &data)
|
|
if err != nil {
|
|
log.Logger.Warnf("the dex connector %s is invalid", s.Name)
|
|
continue
|
|
}
|
|
connectors[i] = map[string]interface{}{
|
|
"type": s.Labels[types.LabelConfigSubType],
|
|
"id": s.Name,
|
|
"name": s.Name,
|
|
"config": data,
|
|
}
|
|
}
|
|
}
|
|
|
|
return connectors, nil
|
|
}
|