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

[ACM-10305] Updated DiscoveredCluster CRD spec to support enableAutoImport field #233

Merged
Merged
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
51 changes: 28 additions & 23 deletions api/v1/discoveredcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,23 @@ const (

// DiscoveredClusterSpec defines the desired state of DiscoveredCluster
type DiscoveredClusterSpec struct {
Name string `json:"name" yaml:"name"`
DisplayName string `json:"displayName" yaml:"displayName"`
OCPClusterID string `json:"ocpClusterId,omitempty" yaml:"ocpClusterId,omitempty"`
RHOCMClusterID string `json:"rhocmClusterId,omitempty" yaml:"rhocmClusterId,omitempty"`
Console string `json:"console,omitempty" yaml:"console,omitempty"`
APIURL string `json:"apiUrl" yaml:"apiUrl"`
CreationTimestamp *metav1.Time `json:"creationTimestamp,omitempty" yaml:"creationTimestamp,omitempty"`
ActivityTimestamp *metav1.Time `json:"activityTimestamp,omitempty" yaml:"activityTimestamp,omitempty"`
Type string `json:"type" yaml:"type"`
OpenshiftVersion string `json:"openshiftVersion,omitempty" yaml:"openshiftVersion,omitempty"`
CloudProvider string `json:"cloudProvider,omitempty" yaml:"cloudProvider,omitempty"`
Status string `json:"status,omitempty" yaml:"status,omitempty"`
IsManagedCluster bool `json:"isManagedCluster" yaml:"isManagedCluster"`

Credential corev1.ObjectReference `json:"credential,omitempty" yaml:"credential,omitempty"`
ActivityTimestamp *metav1.Time `json:"activityTimestamp,omitempty" yaml:"activityTimestamp,omitempty"`
APIURL string `json:"apiUrl" yaml:"apiUrl"`
CloudProvider string `json:"cloudProvider,omitempty" yaml:"cloudProvider,omitempty"`
Console string `json:"console,omitempty" yaml:"console,omitempty"`
CreationTimestamp *metav1.Time `json:"creationTimestamp,omitempty" yaml:"creationTimestamp,omitempty"`
Credential corev1.ObjectReference `json:"credential,omitempty" yaml:"credential,omitempty"`
DisplayName string `json:"displayName" yaml:"displayName"`
EnableAutoImport bool `json:"enableAutoImport,omitempty" yaml:"enableAutoImport,omitempty"`
IsManagedCluster bool `json:"isManagedCluster" yaml:"isManagedCluster"`
Name string `json:"name" yaml:"name"`
OCPClusterID string `json:"ocpClusterId,omitempty" yaml:"ocpClusterId,omitempty"`
OpenshiftVersion string `json:"openshiftVersion,omitempty" yaml:"openshiftVersion,omitempty"`
Owner string `json:"owner,omitempty" yaml:"owner,omitempty"`
RHOCMClusterID string `json:"rhocmClusterId,omitempty" yaml:"rhocmClusterId,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
Status string `json:"status,omitempty" yaml:"status,omitempty"`
Type string `json:"type" yaml:"type"`
}

// DiscoveredClusterStatus defines the observed state of DiscoveredCluster
Expand Down Expand Up @@ -95,18 +97,21 @@ func init() {

// Equal reports whether the spec of a is equal to b.
func (a DiscoveredCluster) Equal(b DiscoveredCluster) bool {
if a.Spec.Name != b.Spec.Name ||
a.Spec.DisplayName != b.Spec.DisplayName ||
if a.Spec.APIURL != b.Spec.APIURL ||
a.Spec.ActivityTimestamp.Truncate(time.Second) != b.Spec.ActivityTimestamp.Truncate(time.Second) ||
a.Spec.CloudProvider != b.Spec.CloudProvider ||
a.Spec.Console != b.Spec.Console ||
a.Spec.APIURL != b.Spec.APIURL ||
a.Spec.CreationTimestamp.Truncate(time.Second) != b.Spec.CreationTimestamp.Truncate(time.Second) ||
a.Spec.ActivityTimestamp.Truncate(time.Second) != b.Spec.ActivityTimestamp.Truncate(time.Second) ||
a.Spec.Type != b.Spec.Type ||
a.Spec.Credential != b.Spec.Credential ||
a.Spec.DisplayName != b.Spec.DisplayName ||
a.Spec.EnableAutoImport != b.Spec.EnableAutoImport ||
a.Spec.IsManagedCluster != b.Spec.IsManagedCluster ||
a.Spec.Name != b.Spec.Name ||
a.Spec.OpenshiftVersion != b.Spec.OpenshiftVersion ||
a.Spec.CloudProvider != b.Spec.CloudProvider ||
a.Spec.Owner != b.Spec.Owner ||
a.Spec.Region != b.Spec.Region ||
a.Spec.Status != b.Spec.Status ||
a.Spec.IsManagedCluster != b.Spec.IsManagedCluster ||
a.Spec.Credential != b.Spec.Credential {
a.Spec.Type != b.Spec.Type {
return false
}
return true
Expand Down
8 changes: 8 additions & 0 deletions bundle/manifests/discovery.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ spec:
- managedclusters/accept
verbs:
- update
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- list
- watch
serviceAccountName: discovery-operator
deployments:
- label:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
name: discoveredclusters.discovery.open-cluster-management.io
spec:
Expand Down Expand Up @@ -41,39 +41,36 @@ spec:
type: string
cloudProvider:
type: string
ocpClusterId:
type: string
rhocmClusterId:
type: string
console:
type: string
creationTimestamp:
format: date-time
type: string
credential:
description: 'ObjectReference contains enough information to let you
description: "ObjectReference contains enough information to let you
inspect or modify the referred object. --- New uses of this type
are discouraged because of difficulty describing its usage when
embedded in APIs. 1. Ignored fields. It includes many fields which
are not generally honored. For instance, ResourceVersion and FieldPath
are both very rarely valid in actual usage. 2. Invalid usage help. It
is impossible to add specific help for individual usage. In most
embedded usages, there are particular restrictions like, "must refer
only to types A and B" or "UID not honored" or "name must be restricted".
Those cannot be well described when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different by
usage, which makes it hard for users to predict what will happen.
4. The fields are both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is on
the group,resource tuple and the version of the actual struct is
irrelevant. 5. We cannot easily change it. Because this type is
embedded in many locations, updates to this type will affect numerous
schemas. Don''t make new APIs embed an underspecified API type
they do not control. Instead of using this type, create a locally
provided and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
are both very rarely valid in actual usage. 2. Invalid usage help.
\ It is impossible to add specific help for individual usage. In
most embedded usages, there are particular restrictions like, \"must
refer only to types A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described when embedded. 3.
Inconsistent validation. Because the usages are different, the
validation rules are different by usage, which makes it hard for
users to predict what will happen. 4. The fields are both imprecise
and overly precise. Kind is not a precise mapping to a URL. This
can produce ambiguity during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource tuple and
the version of the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make new APIs
embed an underspecified API type they do not control. \n Instead
of using this type, create a locally provided and used type that
is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
Expand Down Expand Up @@ -111,12 +108,23 @@ spec:
x-kubernetes-map-type: atomic
displayName:
type: string
enableAutoImport:
default: false
type: boolean
isManagedCluster:
type: boolean
name:
type: string
ocpClusterId:
type: string
openshiftVersion:
type: string
owner:
type: string
region:
type: string
rhocmClusterId:
type: string
status:
type: string
type:
Expand Down Expand Up @@ -173,29 +181,30 @@ spec:
format: date-time
type: string
credential:
description: 'ObjectReference contains enough information to let you
description: "ObjectReference contains enough information to let you
inspect or modify the referred object. --- New uses of this type
are discouraged because of difficulty describing its usage when
embedded in APIs. 1. Ignored fields. It includes many fields which
are not generally honored. For instance, ResourceVersion and FieldPath
are both very rarely valid in actual usage. 2. Invalid usage help. It
is impossible to add specific help for individual usage. In most
embedded usages, there are particular restrictions like, "must refer
only to types A and B" or "UID not honored" or "name must be restricted".
Those cannot be well described when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different by
usage, which makes it hard for users to predict what will happen.
4. The fields are both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is on
the group,resource tuple and the version of the actual struct is
irrelevant. 5. We cannot easily change it. Because this type is
embedded in many locations, updates to this type will affect numerous
schemas. Don''t make new APIs embed an underspecified API type
they do not control. Instead of using this type, create a locally
provided and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
are both very rarely valid in actual usage. 2. Invalid usage help.
\ It is impossible to add specific help for individual usage. In
most embedded usages, there are particular restrictions like, \"must
refer only to types A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described when embedded. 3.
Inconsistent validation. Because the usages are different, the
validation rules are different by usage, which makes it hard for
users to predict what will happen. 4. The fields are both imprecise
and overly precise. Kind is not a precise mapping to a URL. This
can produce ambiguity during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource tuple and
the version of the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make new APIs
embed an underspecified API type they do not control. \n Instead
of using this type, create a locally provided and used type that
is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
Expand Down Expand Up @@ -237,8 +246,12 @@ spec:
type: boolean
name:
type: string
ocpClusterId:
type: string
openshiftVersion:
type: string
rhocmClusterId:
type: string
status:
type: string
type:
Expand Down
Loading
Loading