Skip to content

Commit

Permalink
add k8s_hubble parameter to k8s resource
Browse files Browse the repository at this point in the history
  • Loading branch information
nvthongswansea committed Nov 11, 2024
1 parent b94e21b commit 8d28a58
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gridscale/resource_gridscale_k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ func (rgk8sm *ResourceGridscaleK8sModeler) buildInputSchema() map[string]*schema
Computed: true,
Optional: true,
},
"k8s_hubble": {
Type: schema.TypeBool,
Description: "Enables Hubble Integration.",
Computed: true,
Optional: true,
},
}
}

Expand Down Expand Up @@ -754,6 +760,13 @@ func resourceGridscaleK8sRead(d *schema.ResourceData, meta interface{}) error {
}
}

// Set hubble if it is set
if hubble, isHubbleSet := props.Parameters["k8s_hubble"].(bool); isHubbleSet {
if err = d.Set("k8s_hubble", hubble); err != nil {
return fmt.Errorf("%s error setting k8s_hubble: %v", errorPrefix, err)
}
}

//Get listen ports
listenPorts := make([]interface{}, 0)
for _, value := range props.ListenPorts {
Expand Down Expand Up @@ -1010,6 +1023,12 @@ func resourceGridscaleK8sCreate(d *schema.ResourceData, meta interface{}) error
if logDeliveryEndpoint, isLogDeliveryEndpointSet := d.GetOk("log_delivery_endpoint"); isLogDeliveryEndpointSet {
parameters["k8s_log_delivery_endpoint"] = logDeliveryEndpoint
}

// Set hubble if it is set
if hubble, isHubbleSet := d.GetOk("hubble"); isHubbleSet {
parameters["k8s_hubble"] = hubble.(bool)
}

requestBody.Parameters = parameters

ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutCreate))
Expand Down Expand Up @@ -1176,6 +1195,11 @@ func resourceGridscaleK8sUpdate(d *schema.ResourceData, meta interface{}) error
if logDeliveryEndpoint, isLogDeliveryEndpointSet := d.GetOk("log_delivery_endpoint"); isLogDeliveryEndpointSet {
parameters["k8s_log_delivery_endpoint"] = logDeliveryEndpoint
}

// Set hubble if it is set
if hubble, isHubbleSet := d.GetOk("hubble"); isHubbleSet {
parameters["k8s_hubble"] = hubble
}
requestBody.Parameters = parameters

ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutUpdate))
Expand Down

0 comments on commit 8d28a58

Please sign in to comment.