Skip to content

Commit

Permalink
Reviews and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
willie-yao committed Jan 11, 2024
1 parent ff898d7 commit 0b1ad6f
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 53 deletions.
4 changes: 2 additions & 2 deletions api/v1beta1/azuremanagedcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,15 @@ type MarketplaceExtension struct {
// +optional
ConfigurationSettings map[string]string `json:"configurationSettings,omitempty"`

// ExtensionType is the of the Extension, of which this resource is an instance of.
// ExtensionType is the type of the Extension of which this resource is an instance.
// It must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher.
ExtensionType *string `json:"extensionType"`

// Plan is the plan of the extension.
Plan *MarketplacePlan `json:"plan"`

// ReleaseTrain is the release train this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.)
// only if autoUpgradeMinorVersion is ‘true’.
// This is only used if autoUpgradeMinorVersion is ‘true’.
// +optional
ReleaseTrain *string `json:"releaseTrain,omitempty"`

Expand Down
24 changes: 12 additions & 12 deletions api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1093,42 +1093,42 @@ const (

// MarketplacePlan represents the plan for an AKS marketplace extension.
type MarketplacePlan struct {
// Name is the user defined name of the 3rd Party Artifact that is being procured.
// Name is the user-defined name of the 3rd Party Artifact that is being procured.
// +optional
Name string `json:"name,omitempty"`

// Product is the name of the 3rd Party artifact that is being procured.
Product string `json:"product"`

// PromotionCode is a publisher provided promotion code as provisioned in Data Market for the said product/artifact.
// PromotionCode is a publisher-provided promotion code as provisioned in Data Market for the said product/artifact.
// +optional
PromotionCode string `json:"promotionCode,omitempty"`

// Publisher is the name of the publisher of the 3rd Party Artifact that is being bought
// Publisher is the name of the publisher of the 3rd Party Artifact that is being bought.
Publisher string `json:"publisher"`

// Version is the version of the plan.
// +optional
Version string `json:"version,omitempty"`
}

// ExtensionScope defines the scope of the aks marketplace extension, if configured.
// ExtensionScope defines the scope of the AKS marketplace extension, if configured.
type ExtensionScope struct {
// ScopeType is the scope of the extension. It can be either Cluster or Namespace; but not both.
// ScopeType is the scope of the extension. It can be either Cluster or Namespace, but not both.
ScopeType ExtensionScopeType `json:"scopeType"`

// ReleaseNamespace is the namespace where the extension Release must be placed, for a Cluster scoped extension.
// Required for Cluster scoped extensions.
// ReleaseNamespace is the namespace where the extension Release must be placed, for a Cluster-scoped extension.
// Required for Cluster-scoped extensions.
// +optional
ReleaseNamespace string `json:"releaseNamespace,omitempty"`

// TargetNamespace is the namespace where the extension will be created for an Namespace scoped extension.
// Required for Namespace scoped extensions.
// TargetNamespace is the namespace where the extension will be created for a Namespace-scoped extension.
// Required for Namespace-scoped extensions.
// +optional
TargetNamespace string `json:"targetNamespace,omitempty"`
}

// ExtensionScopeType defines the scope type of the aks marketplace extension, if configured.
// ExtensionScopeType defines the scope type of the AKS marketplace extension, if configured.
// +kubebuilder:validation:Enum=Cluster;Namespace
type ExtensionScopeType string

Expand All @@ -1139,7 +1139,7 @@ const (
ExtensionScopeNamespace ExtensionScopeType = "Namespace"
)

// ExtensionIdentity defines the identity of the aks marketplace extension, if configured.
// ExtensionIdentity defines the identity of the AKS marketplace extension, if configured.
// +kubebuilder:validation:Enum=SystemAssigned
type ExtensionIdentity string

Expand All @@ -1148,7 +1148,7 @@ const (
ExtensionIdentitySystemAssigned ExtensionIdentity = "SystemAssigned"
)

// AKSAssignedIdentity defines the AKS assigned identity of the aks marketplace extension, if configured.
// AKSAssignedIdentity defines the AKS assigned-identity of the aks marketplace extension, if configured.
// +kubebuilder:validation:Enum=SystemAssigned;UserAssigned
type AKSAssignedIdentity string

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ spec:
for configuring this extension.
type: object
extensionType:
description: ExtensionType is the of the Extension, of which
this resource is an instance of. It must be one of the Extension
description: ExtensionType is the type of the Extension of which
this resource is an instance. It must be one of the Extension
Types registered with Microsoft.KubernetesConfiguration by
the Extension publisher.
type: string
Expand All @@ -431,20 +431,20 @@ spec:
description: Plan is the plan of the extension.
properties:
name:
description: Name is the user defined name of the 3rd Party
description: Name is the user-defined name of the 3rd Party
Artifact that is being procured.
type: string
product:
description: Product is the name of the 3rd Party artifact
that is being procured.
type: string
promotionCode:
description: PromotionCode is a publisher provided promotion
description: PromotionCode is a publisher-provided promotion
code as provisioned in Data Market for the said product/artifact.
type: string
publisher:
description: Publisher is the name of the publisher of the
3rd Party Artifact that is being bought
3rd Party Artifact that is being bought.
type: string
version:
description: Version is the version of the plan.
Expand All @@ -456,27 +456,27 @@ spec:
releaseTrain:
description: ReleaseTrain is the release train this extension
participates in for auto-upgrade (e.g. Stable, Preview, etc.)
only if autoUpgradeMinorVersion is ‘true’.
This is only used if autoUpgradeMinorVersion is ‘true’.
type: string
scope:
description: Scope is the scope at which this extension is enabled.
properties:
releaseNamespace:
description: ReleaseNamespace is the namespace where the
extension Release must be placed, for a Cluster scoped
extension. Required for Cluster scoped extensions.
extension Release must be placed, for a Cluster-scoped
extension. Required for Cluster-scoped extensions.
type: string
scopeType:
description: ScopeType is the scope of the extension. It
can be either Cluster or Namespace; but not both.
can be either Cluster or Namespace, but not both.
enum:
- Cluster
- Namespace
type: string
targetNamespace:
description: TargetNamespace is the namespace where the
extension will be created for an Namespace scoped extension.
Required for Namespace scoped extensions.
extension will be created for a Namespace-scoped extension.
Required for Namespace-scoped extensions.
type: string
required:
- scopeType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,9 @@ spec:
pairs for configuring this extension.
type: object
extensionType:
description: ExtensionType is the of the Extension,
of which this resource is an instance of. It must
be one of the Extension Types registered with Microsoft.KubernetesConfiguration
description: ExtensionType is the type of the Extension
of which this resource is an instance. It must be
one of the Extension Types registered with Microsoft.KubernetesConfiguration
by the Extension publisher.
type: string
identity:
Expand All @@ -440,21 +440,21 @@ spec:
description: Plan is the plan of the extension.
properties:
name:
description: Name is the user defined name of the
description: Name is the user-defined name of the
3rd Party Artifact that is being procured.
type: string
product:
description: Product is the name of the 3rd Party
artifact that is being procured.
type: string
promotionCode:
description: PromotionCode is a publisher provided
description: PromotionCode is a publisher-provided
promotion code as provisioned in Data Market for
the said product/artifact.
type: string
publisher:
description: Publisher is the name of the publisher
of the 3rd Party Artifact that is being bought
of the 3rd Party Artifact that is being bought.
type: string
version:
description: Version is the version of the plan.
Expand All @@ -466,32 +466,30 @@ spec:
releaseTrain:
description: ReleaseTrain is the release train this
extension participates in for auto-upgrade (e.g. Stable,
Preview, etc.) only if autoUpgradeMinorVersion is
‘true’.
Preview, etc.) This is only used if autoUpgradeMinorVersion
is ‘true’.
type: string
scope:
description: Scope is the scope at which this extension
is enabled.
properties:
releaseNamespace:
description: ReleaseNamespace is the namespace where
the extension Release must be placed, for a Cluster
scoped extension. Required for Cluster scoped
extensions.
the extension Release must be placed, for a Cluster-scoped
extension. Required for Cluster-scoped extensions.
type: string
scopeType:
description: ScopeType is the scope of the extension.
It can be either Cluster or Namespace; but not
It can be either Cluster or Namespace, but not
both.
enum:
- Cluster
- Namespace
type: string
targetNamespace:
description: TargetNamespace is the namespace where
the extension will be created for an Namespace
scoped extension. Required for Namespace scoped
extensions.
the extension will be created for a Namespace-scoped
extension. Required for Namespace-scoped extensions.
type: string
required:
- scopeType
Expand Down
18 changes: 9 additions & 9 deletions test/e2e/aks_marketplace.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ import (
)

type AKSMarketplaceExtensionSpecInput struct {
Cluster *clusterv1.Cluster
WaitIntervals []interface{}
WaitExtensionIntervals []interface{}
Cluster *clusterv1.Cluster
WaitIntervals []interface{}
}

const (
Expand Down Expand Up @@ -138,8 +137,9 @@ func AKSMarketplaceExtensionSpec(ctx context.Context, inputGetter func() AKSMark
g.Expect(err).NotTo(HaveOccurred())
infraControlPlane.Spec.MarketplaceExtensions = []infrav1.MarketplaceExtension{
{
Name: extensionName,
ExtensionType: ptr.To("TraefikLabs.TraefikProxy"),
Name: extensionName,
ExtensionType: ptr.To("TraefikLabs.TraefikProxy"),
AKSAssignedIdentityType: infrav1.AKSAssignedIdentitySystemAssigned,
Plan: &infrav1.MarketplacePlan{
Name: "traefik-proxy",
Product: "traefik-proxy",
Expand All @@ -148,14 +148,14 @@ func AKSMarketplaceExtensionSpec(ctx context.Context, inputGetter func() AKSMark
},
}
g.Expect(mgmtClient.Update(ctx, infraControlPlane)).To(Succeed())
}, input.WaitExtensionIntervals...).Should(Succeed())
}, input.WaitIntervals...).Should(Succeed())

By("Ensuring the AKS Marketplace Extension status is ready on the AzureManagedControlPlane")
Eventually(func(g Gomega) {
err = mgmtClient.Get(ctx, client.ObjectKey{Namespace: input.Cluster.Spec.ControlPlaneRef.Namespace, Name: input.Cluster.Spec.ControlPlaneRef.Name}, infraControlPlane)
g.Expect(err).NotTo(HaveOccurred())
g.Expect(conditions.IsTrue(infraControlPlane, infrav1.AKSExtensionsReadyCondition)).To(BeTrue())
}, input.WaitExtensionIntervals...).Should(Succeed())
}, input.WaitIntervals...).Should(Succeed())

By("Ensuring the AKS Marketplace Extension is added to the AzureManagedControlPlane")
Eventually(func(g Gomega) {
Expand All @@ -164,11 +164,11 @@ func AKSMarketplaceExtensionSpec(ctx context.Context, inputGetter func() AKSMark
g.Expect(resp.Properties.ProvisioningState).To(Equal(ptr.To(armkubernetesconfiguration.ProvisioningStateSucceeded)))
extension := resp.Extension
g.Expect(extension.Properties).NotTo(BeNil())
g.Expect(extension.Name).To(Equal(extensionName))
g.Expect(extension.Name).To(Equal(ptr.To(extensionName)))
g.Expect(extension.Properties.AksAssignedIdentity).NotTo(BeNil())
g.Expect(extension.Properties.AksAssignedIdentity.Type).To(Equal(ptr.To(armkubernetesconfiguration.AKSIdentityTypeSystemAssigned)))
g.Expect(extension.Properties.AutoUpgradeMinorVersion).To(Equal(ptr.To(true)))
g.Expect(extension.Properties.ExtensionType).To(Equal(ptr.To("testtestindustryexperiencestest.azurecomps")))
g.Expect(extension.Properties.ExtensionType).To(Equal(ptr.To("TraefikLabs.TraefikProxy")))
}, input.WaitIntervals...).Should(Succeed())

By("Restoring initial taints for Windows machine pool")
Expand Down
5 changes: 2 additions & 3 deletions test/e2e/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -848,9 +848,8 @@ var _ = Describe("Workload cluster creation", func() {
By("adding a marketplace extension", func() {
AKSMarketplaceExtensionSpec(ctx, func() AKSMarketplaceExtensionSpecInput {
return AKSMarketplaceExtensionSpecInput{
Cluster: result.Cluster,
WaitIntervals: e2eConfig.GetIntervals(specName, "wait-machine-pool-nodes"),
WaitExtensionIntervals: e2eConfig.GetIntervals(specName, "wait-extension"),
Cluster: result.Cluster,
WaitIntervals: e2eConfig.GetIntervals(specName, "wait-machine-pool-nodes"),
}
})
})
Expand Down
1 change: 0 additions & 1 deletion test/e2e/config/azure-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ intervals:
default/wait-service: ["15m", "10s"]
default/wait-machine-pool-nodes: ["30m", "10s"]
default/wait-nsg-update: ["20m", "10s"]
default/wait-extension: ["60m", "10s"]
csi-migration/wait-controlplane-upgrade: ["60m", "10s"]
csi-migration/wait-worker-nodes: ["60m", "10s"]
csi-migration/wait-control-plane: ["60m", "10s"]
Expand Down

0 comments on commit 0b1ad6f

Please sign in to comment.