Skip to content

Commit

Permalink
add repository adderss (#88)
Browse files Browse the repository at this point in the history
Signed-off-by: soulseen <sunzhu@yunify.com>
  • Loading branch information
Zhuxiaoyang authored and ks-ci-bot committed Jul 9, 2019
1 parent bee781b commit 401d495
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
1 change: 0 additions & 1 deletion api/api-rules/violation_exceptions.list
@@ -1,4 +1,3 @@
API rule violation: names_match,github.com/kubesphere/s2ioperator/pkg/apis/devops/v1alpha1,AuthConfig,ServerAddress
API rule violation: names_match,github.com/kubesphere/s2ioperator/pkg/apis/devops/v1alpha1,CGroupLimits,CPUPeriod
API rule violation: names_match,github.com/kubesphere/s2ioperator/pkg/apis/devops/v1alpha1,CGroupLimits,CPUQuota
API rule violation: names_match,github.com/kubesphere/s2ioperator/pkg/apis/devops/v1alpha1,CGroupLimits,CPUShares
Expand Down
8 changes: 8 additions & 0 deletions config/crds/devops_v1alpha1_s2ibuilder.yaml
Expand Up @@ -188,6 +188,8 @@ spec:
type: string
secretRef:
type: object
serverAddress:
type: string
username:
type: string
type: object
Expand Down Expand Up @@ -243,6 +245,8 @@ spec:
type: string
secretRef:
type: object
serverAddress:
type: string
username:
type: string
type: object
Expand All @@ -256,6 +260,8 @@ spec:
type: string
secretRef:
type: object
serverAddress:
type: string
username:
type: string
type: object
Expand Down Expand Up @@ -295,6 +301,8 @@ spec:
type: string
secretRef:
type: object
serverAddress:
type: string
username:
type: string
type: object
Expand Down
8 changes: 7 additions & 1 deletion pkg/apis/devops/v1alpha1/openapi_generated.go

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

9 changes: 5 additions & 4 deletions pkg/apis/devops/v1alpha1/s2ibuilder_types.go
Expand Up @@ -113,7 +113,7 @@ type AuthConfig struct {
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Email string `json:"email,omitempty"`
ServerAddress string `json:"server_address,omitempty"`
ServerAddress string `json:"serverAddress,omitempty"`
SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"`
}

Expand Down Expand Up @@ -483,9 +483,10 @@ type DockerConfigJson struct {
type DockerConfigMap map[string]DockerConfigEntry

type DockerConfigEntry struct {
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
Username string `json:"username"`
Password string `json:"password"`
Email string `json:"email"`
ServerAddress string `json:"serverAddress,omitempty"`
}

func init() {
Expand Down
7 changes: 6 additions & 1 deletion pkg/controller/s2irun/ksbuilder_jobs.go
Expand Up @@ -164,6 +164,7 @@ func (r *ReconcileS2iRun) setDockerSecret(instance *devopsv1alpha1.S2iRun, confi
if err != nil {
return err
}
config.PushAuthentication.ServerAddress = entry.ServerAddress
config.PushAuthentication.Username = entry.Username
config.PushAuthentication.Password = entry.Password
config.PushAuthentication.Email = entry.Email
Expand All @@ -181,6 +182,7 @@ func (r *ReconcileS2iRun) setDockerSecret(instance *devopsv1alpha1.S2iRun, confi
if err != nil {
return err
}
config.PushAuthentication.ServerAddress = entry.ServerAddress
config.PullAuthentication.Username = entry.Username
config.PullAuthentication.Password = entry.Password
config.PullAuthentication.Email = entry.Email
Expand All @@ -198,6 +200,7 @@ func (r *ReconcileS2iRun) setDockerSecret(instance *devopsv1alpha1.S2iRun, confi
if err != nil {
return err
}
config.PushAuthentication.ServerAddress = entry.ServerAddress
config.IncrementalAuthentication.Username = entry.Username
config.IncrementalAuthentication.Password = entry.Password
config.IncrementalAuthentication.Email = entry.Email
Expand All @@ -215,6 +218,7 @@ func (r *ReconcileS2iRun) setDockerSecret(instance *devopsv1alpha1.S2iRun, confi
if err != nil {
return err
}
config.PushAuthentication.ServerAddress = entry.ServerAddress
config.RuntimeAuthentication.Username = entry.Username
config.RuntimeAuthentication.Password = entry.Password
config.RuntimeAuthentication.Email = entry.Email
Expand Down Expand Up @@ -316,7 +320,8 @@ func getDockerEntryFromDockerSecret(instance *corev1.Secret) (dockerConfigEntry
if len(dockerConfig.Auths) == 0 {
return nil, fmt.Errorf("docker config auth len should not be 0")
}
for _, dockerConfigEntry := range dockerConfig.Auths {
for registryAddress, dockerConfigEntry := range dockerConfig.Auths {
dockerConfigEntry.ServerAddress = registryAddress
return dockerConfigEntry.DeepCopy(), nil
}
return nil, nil
Expand Down

0 comments on commit 401d495

Please sign in to comment.