-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support basic registry authentication (#7)
- Loading branch information
1 parent
c36229b
commit 6218876
Showing
14 changed files
with
569 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
132 changes: 66 additions & 66 deletions
132
src/main/java/com/epam/aidial/config/AppConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,66 @@ | ||
package com.epam.aidial.config; | ||
|
||
import com.epam.aidial.kubernetes.knative.V1Service; | ||
import io.kubernetes.client.openapi.models.V1Job; | ||
import io.kubernetes.client.openapi.models.V1Secret; | ||
import io.kubernetes.client.util.Yaml; | ||
import lombok.Data; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Map; | ||
|
||
@Component | ||
@ConfigurationProperties(prefix = "app") | ||
public class AppConfiguration { | ||
@Getter | ||
private V1Secret secretConfig; | ||
private String secretConfigString; | ||
|
||
@Getter | ||
private V1Job jobConfig; | ||
private String jobConfigString; | ||
|
||
@Getter | ||
private V1Service serviceConfig; | ||
private String serviceConfigString; | ||
|
||
@Getter | ||
@Setter | ||
private Map<String, RuntimeConfiguration> runtimes; | ||
|
||
public void setSecretConfig(V1Secret secretConfig) { | ||
this.secretConfig = secretConfig; | ||
this.secretConfigString = Yaml.dump(secretConfig); | ||
} | ||
|
||
public void setJobConfig(V1Job jobConfig) { | ||
this.jobConfig = jobConfig; | ||
this.jobConfigString = Yaml.dump(jobConfig); | ||
} | ||
|
||
public void setServiceConfig(V1Service serviceConfig) { | ||
this.serviceConfig = serviceConfig; | ||
this.serviceConfigString = Yaml.dump(serviceConfig); | ||
} | ||
|
||
public V1Secret cloneSecretConfig() { | ||
return Yaml.loadAs(secretConfigString, V1Secret.class); | ||
} | ||
|
||
public V1Job cloneJobConfig() { | ||
return Yaml.loadAs(jobConfigString, V1Job.class); | ||
} | ||
|
||
public V1Service cloneServiceConfig() { | ||
return Yaml.loadAs(serviceConfigString, V1Service.class); | ||
} | ||
|
||
@Data | ||
public static class RuntimeConfiguration { | ||
private String image; | ||
private String profile; | ||
} | ||
} | ||
package com.epam.aidial.config; | ||
|
||
import com.epam.aidial.kubernetes.knative.V1Service; | ||
import io.kubernetes.client.openapi.models.V1Job; | ||
import io.kubernetes.client.openapi.models.V1Secret; | ||
import io.kubernetes.client.util.Yaml; | ||
import lombok.Data; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Map; | ||
|
||
@Component | ||
@ConfigurationProperties(prefix = "app") | ||
public class AppConfiguration { | ||
@Getter | ||
private V1Secret secretConfig; | ||
private String secretConfigString; | ||
|
||
@Getter | ||
private V1Job jobConfig; | ||
private String jobConfigString; | ||
|
||
@Getter | ||
private V1Service serviceConfig; | ||
private String serviceConfigString; | ||
|
||
@Getter | ||
@Setter | ||
private Map<String, RuntimeConfiguration> runtimes; | ||
|
||
public void setSecretConfig(V1Secret secretConfig) { | ||
this.secretConfig = secretConfig; | ||
this.secretConfigString = Yaml.dump(secretConfig); | ||
} | ||
|
||
public void setJobConfig(V1Job jobConfig) { | ||
this.jobConfig = jobConfig; | ||
this.jobConfigString = Yaml.dump(jobConfig); | ||
} | ||
|
||
public void setServiceConfig(V1Service serviceConfig) { | ||
this.serviceConfig = serviceConfig; | ||
this.serviceConfigString = Yaml.dump(serviceConfig); | ||
} | ||
|
||
public V1Secret cloneSecretConfig() { | ||
return Yaml.loadAs(secretConfigString, V1Secret.class); | ||
} | ||
|
||
public V1Job cloneJobConfig() { | ||
return Yaml.loadAs(jobConfigString, V1Job.class); | ||
} | ||
|
||
public V1Service cloneServiceConfig() { | ||
return Yaml.loadAs(serviceConfigString, V1Service.class); | ||
} | ||
|
||
@Data | ||
public static class RuntimeConfiguration { | ||
private String image; | ||
private String profile; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.epam.aidial.config; | ||
|
||
public enum DockerAuthScheme { | ||
NONE, | ||
BASIC | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
package com.epam.aidial.config; | ||
|
||
import com.epam.aidial.util.KubernetesUtils; | ||
import io.kubernetes.client.openapi.ApiClient; | ||
import okhttp3.OkHttpClient; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import java.io.IOException; | ||
|
||
@Configuration | ||
public class WebFluxConfig { | ||
@Bean | ||
public ApiClient buildKubeClient( | ||
@Value("${app.kube-config}") String configPath, | ||
@Value("${app.build-context:#{null}}") String context) throws IOException { | ||
return KubernetesUtils.createClient(configPath, context); | ||
} | ||
|
||
@Bean | ||
public ApiClient deployKubeClient( | ||
@Value("${app.kube-config}") String configPath, | ||
@Value("${app.deploy-context:#{null}}") String context) throws IOException { | ||
return KubernetesUtils.createClient(configPath, context); | ||
} | ||
|
||
@Bean | ||
public OkHttpClient okHttpClient() { | ||
return new OkHttpClient.Builder() | ||
.build(); | ||
} | ||
} | ||
package com.epam.aidial.config; | ||
|
||
import com.epam.aidial.util.KubernetesUtils; | ||
import io.kubernetes.client.openapi.ApiClient; | ||
import okhttp3.OkHttpClient; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import java.io.IOException; | ||
|
||
@Configuration | ||
public class WebFluxConfig { | ||
@Bean | ||
public ApiClient buildKubeClient( | ||
@Value("${app.kube-config}") String configPath, | ||
@Value("${app.build-context:#{null}}") String context) throws IOException { | ||
return KubernetesUtils.createClient(configPath, context); | ||
} | ||
|
||
@Bean | ||
public ApiClient deployKubeClient( | ||
@Value("${app.kube-config}") String configPath, | ||
@Value("${app.deploy-context:#{null}}") String context) throws IOException { | ||
return KubernetesUtils.createClient(configPath, context); | ||
} | ||
|
||
@Bean | ||
public OkHttpClient okHttpClient() { | ||
return new OkHttpClient.Builder() | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.