|
|
@@ -14,10 +14,7 @@ import org.slf4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static nju.seec.SEECdemo.util.Constants.PRETTY_FORMAT;
|
|
|
@@ -78,10 +75,12 @@ public class SecretApiImpl implements SecretApi {
|
|
|
public SecretVO createPrivateRegistrySecret(String namespace, String name, String server, String user, String password) throws K8sApiException {
|
|
|
Map<String, byte[]> data = new HashMap<>();
|
|
|
|
|
|
+ String authInfo = user + ":" + password;
|
|
|
+ String auth = Base64.getEncoder().encodeToString(authInfo.getBytes());
|
|
|
String dockerConfigJson =
|
|
|
"{\"auths\":{\"" + server + "\":{\"username\":\"" + user +
|
|
|
"\",\"password\":\"" + password +
|
|
|
- "\",\"auth\":\"" + user + ":" + password + "\"}}}";
|
|
|
+ "\",\"auth\":\"" + auth + "\"}}}";
|
|
|
data.put(".dockerconfigjson", dockerConfigJson.getBytes());
|
|
|
|
|
|
return createGenericSecret(namespace, name, data, SecretTypeEnum.REGISTRY);
|