Skip to content
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

CKS registry and state updates #154

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions cloudstack/resource_cloudstack_kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,25 @@ func resourceCloudStackKubernetesCluster() *schema.Resource {
Optional: true,
Default: 8,
},

"docker_registry_url": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"docker_registry_username": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},

"docker_registry_password": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Sensitive: true,
},
},
}
}
Expand Down Expand Up @@ -180,6 +199,15 @@ func resourceCloudStackKubernetesClusterCreate(d *schema.ResourceData, meta inte
if noderootdisksize, ok := d.GetOk("noderootdisksize"); ok {
p.SetNoderootdisksize(int64(noderootdisksize.(int)))
}
if dockerurl, ok := d.GetOk("docker_registry_url"); ok {
p.SetDockerregistryurl(dockerurl.(string))
}
if dockerusername, ok := d.GetOk("docker_registry_username"); ok {
p.SetDockerregistryusername(dockerusername.(string))
}
if dockerpassword, ok := d.GetOk("docker_registry_password"); ok {
p.SetDockerregistrypassword(dockerpassword.(string))
}

// If there is a project supplied, we retrieve and set the project id
if err := setProjectid(p, cs, d); err != nil {
Expand All @@ -189,6 +217,13 @@ func resourceCloudStackKubernetesClusterCreate(d *schema.ResourceData, meta inte
log.Printf("[DEBUG] Creating Kubernetes Cluster %s", name)
r, err := cs.Kubernetes.CreateKubernetesCluster(p)
if err != nil {
cluster, _, errg := cs.Kubernetes.GetKubernetesClusterByName(
name,
cloudstack.WithProject(d.Get("project").(string)),
)
if errg == nil {
d.SetId(cluster.Id)
}
return err
}

Expand Down