Skip to content

Add installStrategy for addon and upgrade to v1beta1 #203

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ $(call add-crd-gen,workv1,./work/v1,./work/v1,./work/v1)
$(call add-crd-gen,workv1alpha1,./work/v1alpha1,./work/v1alpha1,./work/v1alpha1)
$(call add-crd-gen,operator,./operator/v1,./operator/v1,./operator/v1)
$(call add-crd-gen,addonv1alpha1,./addon/v1alpha1,./addon/v1alpha1,./addon/v1alpha1)
$(call add-crd-gen,addonv1beta1,./addon/v1alpha1 ./addon/v1beta1,./addon/v1beta1,./addon/v1beta1)

RUNTIME ?= podman
RUNTIME_IMAGE_NAME ?= openshift-api-generator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ spec:
description: RegistrationConfig defines the configuration of the addon agent to register to hub. The Klusterlet agent will create a csr for the addon agent with the registrationConfig.
type: object
properties:
registrationNamespace:
description: RegistrationNamespace is the namespace on the managed cluster to put the registration secret for the addon agent. If it is not set, open-cluster-management-agent-addon namespace is used to install the addon agent.
type: string
default: open-cluster-management-agent-addon
maxLength: 63
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
signerName:
description: signerName is the name of signer that addon agent will use to create csr.
type: string
Expand Down
8 changes: 8 additions & 0 deletions addon/v1alpha1/types_managedclusteraddon.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ type RegistrationConfig struct {
//
// +optional
Subject Subject `json:"subject,omitempty"`

// RegistrationNamespace is the namespace on the managed cluster to put the registration secret for the addon agent.
// If it is not set, open-cluster-management-agent-addon namespace is used to install the addon agent.
// +optional
// +kubebuilder:default=open-cluster-management-agent-addon
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
RegistrationNamespace string `json:"registrationNamespace,omitempty"`
}

type AddOnConfig struct {
Expand Down
7 changes: 4 additions & 3 deletions addon/v1alpha1/zz_generated.swagger_doc_generated.go

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clustermanagementaddons.addon.open-cluster-management.io
spec:
group: addon.open-cluster-management.io
names:
kind: ClusterManagementAddOn
listKind: ClusterManagementAddOnList
plural: clustermanagementaddons
singular: clustermanagementaddon
preserveUnknownFields: false
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .spec.addOnMeta.displayName
name: DISPLAY NAME
type: string
name: v1beta1
schema:
openAPIV3Schema:
description: ClusterManagementAddOn represents the registration of an add-on to the cluster manager. This resource allows the user to discover which add-on is available for the cluster manager and also provides metadata information about the add-on. This resource also provides a linkage to ManagedClusterAddOn, the name of the ClusterManagementAddOn resource will be used for the namespace-scoped ManagedClusterAddOn resource. ClusterManagementAddOn is a cluster-scoped resource.
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: spec represents a desired configuration for the agent on the cluster management add-on.
type: object
properties:
addOnMeta:
description: addOnMeta is a reference to the metadata information for the add-on.
type: object
properties:
description:
description: description represents the detailed description of the add-on.
type: string
displayName:
description: displayName represents the name of add-on that will be displayed.
type: string
defaultConfigs:
description: defaultConfigs represents a list of default add-on configurations. In scenario where all add-ons have the same configuration. User can override the default configuration by defining the configs in the install strategy for specific clusters.
type: array
items:
type: object
required:
- name
- resource
properties:
group:
description: group of the add-on configuration.
type: string
default: ""
name:
description: name of the add-on configuration.
type: string
minLength: 1
namespace:
description: namespace of the add-on configuration. If this field is not set, the configuration is in the cluster scope.
type: string
resource:
description: resource of the add-on configuration.
type: string
minLength: 1
installStrategy:
description: InstallStrategy represents that related ManagedClusterAddOns should be installed on certain clusters.
type: object
default:
type: Manual
properties:
placements:
description: Placements is a list of placement references honored when install strategy type is Placements. All clusters selected by these placements will install the addon If one cluster belongs to multiple placements, it will only apply the strategy defined later in the order. That is to say, The latter strategy overrides the previous one.
type: array
items:
type: object
required:
- name
- namespace
properties:
configs:
description: Configs is the configuration of managedClusterAddon during installation. User can override the configuration by updating the managedClusterAddon directly.
type: array
items:
type: object
required:
- name
- resource
properties:
group:
description: group of the add-on configuration.
type: string
default: ""
name:
description: name of the add-on configuration.
type: string
minLength: 1
namespace:
description: namespace of the add-on configuration. If this field is not set, the configuration is in the cluster scope.
type: string
resource:
description: resource of the add-on configuration.
type: string
minLength: 1
name:
description: Name is the name of the placement
type: string
minLength: 1
namespace:
description: Namespace is the namespace of the placement
type: string
minLength: 1
x-kubernetes-list-map-keys:
- namespace
- name
x-kubernetes-list-type: map
type:
description: 'Type is the type of the install strategy, it can be: - Manual: no automatic install - Placements: install to clusters selected by placements.'
type: string
default: Manual
enum:
- Manual
- Placements
status:
description: status represents the current status of cluster management add-on.
type: object
served: true
storage: true
subresources:
status: {}
- additionalPrinterColumns:
- jsonPath: .spec.addOnMeta.displayName
name: DISPLAY NAME
type: string
- jsonPath: .spec.addOnConfiguration.crdName
name: CRD NAME
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: ClusterManagementAddOn represents the registration of an add-on to the cluster manager. This resource allows the user to discover which add-on is available for the cluster manager and also provides metadata information about the add-on. This resource also provides a linkage to ManagedClusterAddOn, the name of the ClusterManagementAddOn resource will be used for the namespace-scoped ManagedClusterAddOn resource. ClusterManagementAddOn is a cluster-scoped resource.
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: spec represents a desired configuration for the agent on the cluster management add-on.
type: object
properties:
addOnConfiguration:
description: 'Deprecated: Use supportedConfigs filed instead addOnConfiguration is a reference to configuration information for the add-on. In scenario where a multiple add-ons share the same add-on CRD, multiple ClusterManagementAddOn resources need to be created and reference the same AddOnConfiguration.'
type: object
properties:
crName:
description: crName is the name of the CR used to configure instances of the managed add-on. This field should be configured if add-on CR have a consistent name across the all of the ManagedCluster instaces.
type: string
crdName:
description: crdName is the name of the CRD used to configure instances of the managed add-on. This field should be configured if the add-on have a CRD that controls the configuration of the add-on.
type: string
lastObservedGeneration:
description: lastObservedGeneration is the observed generation of the custom resource for the configuration of the addon.
type: integer
format: int64
addOnMeta:
description: addOnMeta is a reference to the metadata information for the add-on.
type: object
properties:
description:
description: description represents the detailed description of the add-on.
type: string
displayName:
description: displayName represents the name of add-on that will be displayed.
type: string
supportedConfigs:
description: supportedConfigs is a list of configuration types supported by add-on. An empty list means the add-on does not require configurations. The default is an empty list
type: array
items:
description: ConfigMeta represents a collection of metadata information for add-on configuration.
type: object
required:
- resource
properties:
defaultConfig:
description: defaultConfig represents the namespace and name of the default add-on configuration. In scenario where all add-ons have a same configuration.
type: object
required:
- name
properties:
name:
description: name of the add-on configuration.
type: string
minLength: 1
namespace:
description: namespace of the add-on configuration. If this field is not set, the configuration is in the cluster scope.
type: string
group:
description: group of the add-on configuration.
type: string
default: ""
resource:
description: resource of the add-on configuration.
type: string
minLength: 1
x-kubernetes-list-map-keys:
- group
- resource
x-kubernetes-list-type: map
status:
description: status represents the current status of cluster management add-on.
type: object
served: true
storage: false
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading