Skip to content

Commit

Permalink
feat: support kubevision field for tf provider (#240)
Browse files Browse the repository at this point in the history
Co-authored-by: Jiacheng Xu <xjcmaxwellcjx@gmail.com>
  • Loading branch information
hanxiaop and jiachengxu authored Sep 13, 2024
1 parent 2754349 commit 155f08d
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 108 deletions.
37 changes: 19 additions & 18 deletions akp/apis/v1alpha1/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,25 @@ type CrossplaneExtension struct {
}

type InstanceSpec struct {
IpAllowList []*IPAllowListEntry `json:"ipAllowList,omitempty"`
Subdomain string `json:"subdomain,omitempty"`
DeclarativeManagementEnabled *bool `json:"declarativeManagementEnabled,omitempty"`
Extensions []*ArgoCDExtensionInstallEntry `json:"extensions,omitempty"`
ClusterCustomizationDefaults *ClusterCustomization `json:"clusterCustomizationDefaults,omitempty"`
ImageUpdaterEnabled *bool `json:"imageUpdaterEnabled,omitempty"`
BackendIpAllowListEnabled *bool `json:"backendIpAllowListEnabled,omitempty"`
RepoServerDelegate *RepoServerDelegate `json:"repoServerDelegate,omitempty"`
AuditExtensionEnabled *bool `json:"auditExtensionEnabled,omitempty"`
SyncHistoryExtensionEnabled *bool `json:"syncHistoryExtensionEnabled,omitempty"`
CrossplaneExtension *CrossplaneExtension `json:"crossplaneExtension,omitempty"`
ImageUpdaterDelegate *ImageUpdaterDelegate `json:"imageUpdaterDelegate,omitempty"`
AppSetDelegate *AppSetDelegate `json:"appSetDelegate,omitempty"`
AssistantExtensionEnabled *bool `json:"assistantExtensionEnabled,omitempty"`
AppsetPolicy *AppsetPolicy `json:"appsetPolicy,omitempty"`
HostAliases []*HostAliases `json:"hostAliases,omitempty"`
AgentPermissionsRules []*AgentPermissionsRule `json:"agentPermissionsRules,omitempty"`
Fqdn *string `json:"fqdn,omitempty"`
IpAllowList []*IPAllowListEntry `json:"ipAllowList,omitempty"`
Subdomain string `json:"subdomain,omitempty"`
DeclarativeManagementEnabled *bool `json:"declarativeManagementEnabled,omitempty"`
Extensions []*ArgoCDExtensionInstallEntry `json:"extensions,omitempty"`
ClusterCustomizationDefaults *ClusterCustomization `json:"clusterCustomizationDefaults,omitempty"`
ImageUpdaterEnabled *bool `json:"imageUpdaterEnabled,omitempty"`
BackendIpAllowListEnabled *bool `json:"backendIpAllowListEnabled,omitempty"`
RepoServerDelegate *RepoServerDelegate `json:"repoServerDelegate,omitempty"`
AuditExtensionEnabled *bool `json:"auditExtensionEnabled,omitempty"`
SyncHistoryExtensionEnabled *bool `json:"syncHistoryExtensionEnabled,omitempty"`
CrossplaneExtension *CrossplaneExtension `json:"crossplaneExtension,omitempty"`
ImageUpdaterDelegate *ImageUpdaterDelegate `json:"imageUpdaterDelegate,omitempty"`
AppSetDelegate *AppSetDelegate `json:"appSetDelegate,omitempty"`
AssistantExtensionEnabled *bool `json:"assistantExtensionEnabled,omitempty"`
AppsetPolicy *AppsetPolicy `json:"appsetPolicy,omitempty"`
HostAliases []*HostAliases `json:"hostAliases,omitempty"`
AgentPermissionsRules []*AgentPermissionsRule `json:"agentPermissionsRules,omitempty"`
Fqdn *string `json:"fqdn,omitempty"`
MultiClusterK8SDashboardEnabled *bool `json:"multiClusterK8sDashboardEnabled,omitempty"`
}

type ManagedCluster struct {
Expand Down
19 changes: 10 additions & 9 deletions akp/apis/v1alpha1/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ type ManagedClusterConfig struct {
}

type ClusterData struct {
Size ClusterSize `json:"size,omitempty"`
AutoUpgradeDisabled *bool `json:"autoUpgradeDisabled,omitempty"`
Kustomization runtime.RawExtension `json:"kustomization,omitempty"`
AppReplication *bool `json:"appReplication,omitempty"`
TargetVersion string `json:"targetVersion,omitempty"`
RedisTunneling *bool `json:"redisTunneling,omitempty"`
DatadogAnnotationsEnabled *bool `json:"datadogAnnotationsEnabled,omitempty"`
EksAddonEnabled *bool `json:"eksAddonEnabled,omitempty"`
ManagedClusterConfig *ManagedClusterConfig `json:"managedClusterConfig,omitempty"`
Size ClusterSize `json:"size,omitempty"`
AutoUpgradeDisabled *bool `json:"autoUpgradeDisabled,omitempty"`
Kustomization runtime.RawExtension `json:"kustomization,omitempty"`
AppReplication *bool `json:"appReplication,omitempty"`
TargetVersion string `json:"targetVersion,omitempty"`
RedisTunneling *bool `json:"redisTunneling,omitempty"`
DatadogAnnotationsEnabled *bool `json:"datadogAnnotationsEnabled,omitempty"`
EksAddonEnabled *bool `json:"eksAddonEnabled,omitempty"`
ManagedClusterConfig *ManagedClusterConfig `json:"managedClusterConfig,omitempty"`
MultiClusterK8SDashboardEnabled *bool `json:"multiClusterK8sDashboardEnabled,omitempty"`
}
4 changes: 4 additions & 0 deletions akp/data_source_akp_cluster_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ func getClusterDataDataSourceAttributes() map[string]schema.Attribute {
Computed: true,
Attributes: getManagedClusterConfigDataSourceAttributes(),
},
"multi_cluster_k8s_dashboard_enabled": schema.BoolAttribute{
MarkdownDescription: "Enable the KubeVision feature on the managed cluster",
Computed: true,
},
}
}

Expand Down
4 changes: 4 additions & 0 deletions akp/data_source_akp_instance_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ func getInstanceSpecDataSourceAttributes() map[string]schema.Attribute {
MarkdownDescription: "Configures the FQDN for the argocd instance, for ingress URL, domain suffix, etc.",
Computed: true,
},
"multi_cluster_k8s_dashboard_enabled": schema.BoolAttribute{
MarkdownDescription: "Enable the KubeVision feature",
Computed: true,
},
}
}

Expand Down
8 changes: 8 additions & 0 deletions akp/resource_akp_cluster_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@ func getClusterDataAttributes() map[string]schema.Attribute {
Optional: true,
Attributes: getManagedClusterConfigAttributes(),
},
"multi_cluster_k8s_dashboard_enabled": schema.BoolAttribute{
MarkdownDescription: "Enable the KubeVision feature on the managed cluster",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{
boolplanmodifier.UseStateForUnknown(),
},
},
}
}

Expand Down
8 changes: 8 additions & 0 deletions akp/resource_akp_instance_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,14 @@ func getInstanceSpecAttributes() map[string]schema.Attribute {
stringplanmodifier.UseStateForUnknown(),
},
},
"multi_cluster_k8s_dashboard_enabled": schema.BoolAttribute{
MarkdownDescription: "Enable the KubeVision feature",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{
boolplanmodifier.UseStateForUnknown(),
},
},
}
}

Expand Down
37 changes: 19 additions & 18 deletions akp/types/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,25 @@ type CrossplaneExtension struct {
}

type InstanceSpec struct {
IpAllowList []*IPAllowListEntry `tfsdk:"ip_allow_list"`
Subdomain types.String `tfsdk:"subdomain"`
DeclarativeManagementEnabled types.Bool `tfsdk:"declarative_management_enabled"`
Extensions []*ArgoCDExtensionInstallEntry `tfsdk:"extensions"`
ClusterCustomizationDefaults types.Object `tfsdk:"cluster_customization_defaults"`
ImageUpdaterEnabled types.Bool `tfsdk:"image_updater_enabled"`
BackendIpAllowListEnabled types.Bool `tfsdk:"backend_ip_allow_list_enabled"`
RepoServerDelegate *RepoServerDelegate `tfsdk:"repo_server_delegate"`
AuditExtensionEnabled types.Bool `tfsdk:"audit_extension_enabled"`
SyncHistoryExtensionEnabled types.Bool `tfsdk:"sync_history_extension_enabled"`
CrossplaneExtension *CrossplaneExtension `tfsdk:"crossplane_extension"`
ImageUpdaterDelegate *ImageUpdaterDelegate `tfsdk:"image_updater_delegate"`
AppSetDelegate *AppSetDelegate `tfsdk:"app_set_delegate"`
AssistantExtensionEnabled types.Bool `tfsdk:"assistant_extension_enabled"`
AppsetPolicy types.Object `tfsdk:"appset_policy"`
HostAliases []*HostAliases `tfsdk:"host_aliases"`
AgentPermissionsRules []*AgentPermissionsRule `tfsdk:"agent_permissions_rules"`
Fqdn types.String `tfsdk:"fqdn"`
IpAllowList []*IPAllowListEntry `tfsdk:"ip_allow_list"`
Subdomain types.String `tfsdk:"subdomain"`
DeclarativeManagementEnabled types.Bool `tfsdk:"declarative_management_enabled"`
Extensions []*ArgoCDExtensionInstallEntry `tfsdk:"extensions"`
ClusterCustomizationDefaults types.Object `tfsdk:"cluster_customization_defaults"`
ImageUpdaterEnabled types.Bool `tfsdk:"image_updater_enabled"`
BackendIpAllowListEnabled types.Bool `tfsdk:"backend_ip_allow_list_enabled"`
RepoServerDelegate *RepoServerDelegate `tfsdk:"repo_server_delegate"`
AuditExtensionEnabled types.Bool `tfsdk:"audit_extension_enabled"`
SyncHistoryExtensionEnabled types.Bool `tfsdk:"sync_history_extension_enabled"`
CrossplaneExtension *CrossplaneExtension `tfsdk:"crossplane_extension"`
ImageUpdaterDelegate *ImageUpdaterDelegate `tfsdk:"image_updater_delegate"`
AppSetDelegate *AppSetDelegate `tfsdk:"app_set_delegate"`
AssistantExtensionEnabled types.Bool `tfsdk:"assistant_extension_enabled"`
AppsetPolicy types.Object `tfsdk:"appset_policy"`
HostAliases []*HostAliases `tfsdk:"host_aliases"`
AgentPermissionsRules []*AgentPermissionsRule `tfsdk:"agent_permissions_rules"`
Fqdn types.String `tfsdk:"fqdn"`
MultiClusterK8SDashboardEnabled types.Bool `tfsdk:"multi_cluster_k8s_dashboard_enabled"`
}

type ManagedCluster struct {
Expand Down
19 changes: 10 additions & 9 deletions akp/types/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ type ManagedClusterConfig struct {
}

type ClusterData struct {
Size types.String `tfsdk:"size"`
AutoUpgradeDisabled types.Bool `tfsdk:"auto_upgrade_disabled"`
Kustomization types.String `tfsdk:"kustomization"`
AppReplication types.Bool `tfsdk:"app_replication"`
TargetVersion types.String `tfsdk:"target_version"`
RedisTunneling types.Bool `tfsdk:"redis_tunneling"`
DatadogAnnotationsEnabled types.Bool `tfsdk:"datadog_annotations_enabled"`
EksAddonEnabled types.Bool `tfsdk:"eks_addon_enabled"`
ManagedClusterConfig *ManagedClusterConfig `tfsdk:"managed_cluster_config"`
Size types.String `tfsdk:"size"`
AutoUpgradeDisabled types.Bool `tfsdk:"auto_upgrade_disabled"`
Kustomization types.String `tfsdk:"kustomization"`
AppReplication types.Bool `tfsdk:"app_replication"`
TargetVersion types.String `tfsdk:"target_version"`
RedisTunneling types.Bool `tfsdk:"redis_tunneling"`
DatadogAnnotationsEnabled types.Bool `tfsdk:"datadog_annotations_enabled"`
EksAddonEnabled types.Bool `tfsdk:"eks_addon_enabled"`
ManagedClusterConfig *ManagedClusterConfig `tfsdk:"managed_cluster_config"`
MultiClusterK8SDashboardEnabled types.Bool `tfsdk:"multi_cluster_k8s_dashboard_enabled"`
}
Loading

0 comments on commit 155f08d

Please sign in to comment.