Skip to content

Commit

Permalink
Add Status subresource to ClusterGroup CRD
Browse files Browse the repository at this point in the history
  • Loading branch information
abhiraut committed Jan 23, 2021
1 parent 4d6bdaf commit 86c8106
Show file tree
Hide file tree
Showing 14 changed files with 278 additions and 15 deletions.
25 changes: 24 additions & 1 deletion build/yamls/antrea-aks.yml
Expand Up @@ -62,7 +62,15 @@ spec:
singular: group
scope: Cluster
versions:
- name: v1alpha2
- additionalPrinterColumns:
- description: The overall summary of realization status of the ClusterGroup.
jsonPath: .status.phase
name: Realization Status
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha2
schema:
openAPIV3Schema:
properties:
Expand All @@ -79,9 +87,18 @@ spec:
podSelector:
x-kubernetes-preserve-unknown-fields: true
type: object
status:
properties:
observedGeneration:
type: integer
phase:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -1196,6 +1213,12 @@ rules:
- get
- watch
- list
- apiGroups:
- core.antrea.tanzu.vmware.com
resources:
- clustergroups/status
verbs:
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
25 changes: 24 additions & 1 deletion build/yamls/antrea-eks.yml
Expand Up @@ -62,7 +62,15 @@ spec:
singular: group
scope: Cluster
versions:
- name: v1alpha2
- additionalPrinterColumns:
- description: The overall summary of realization status of the ClusterGroup.
jsonPath: .status.phase
name: Realization Status
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha2
schema:
openAPIV3Schema:
properties:
Expand All @@ -79,9 +87,18 @@ spec:
podSelector:
x-kubernetes-preserve-unknown-fields: true
type: object
status:
properties:
observedGeneration:
type: integer
phase:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -1196,6 +1213,12 @@ rules:
- get
- watch
- list
- apiGroups:
- core.antrea.tanzu.vmware.com
resources:
- clustergroups/status
verbs:
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
25 changes: 24 additions & 1 deletion build/yamls/antrea-gke.yml
Expand Up @@ -62,7 +62,15 @@ spec:
singular: group
scope: Cluster
versions:
- name: v1alpha2
- additionalPrinterColumns:
- description: The overall summary of realization status of the ClusterGroup.
jsonPath: .status.phase
name: Realization Status
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha2
schema:
openAPIV3Schema:
properties:
Expand All @@ -79,9 +87,18 @@ spec:
podSelector:
x-kubernetes-preserve-unknown-fields: true
type: object
status:
properties:
observedGeneration:
type: integer
phase:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -1196,6 +1213,12 @@ rules:
- get
- watch
- list
- apiGroups:
- core.antrea.tanzu.vmware.com
resources:
- clustergroups/status
verbs:
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
25 changes: 24 additions & 1 deletion build/yamls/antrea-ipsec.yml
Expand Up @@ -62,7 +62,15 @@ spec:
singular: group
scope: Cluster
versions:
- name: v1alpha2
- additionalPrinterColumns:
- description: The overall summary of realization status of the ClusterGroup.
jsonPath: .status.phase
name: Realization Status
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha2
schema:
openAPIV3Schema:
properties:
Expand All @@ -79,9 +87,18 @@ spec:
podSelector:
x-kubernetes-preserve-unknown-fields: true
type: object
status:
properties:
observedGeneration:
type: integer
phase:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -1196,6 +1213,12 @@ rules:
- get
- watch
- list
- apiGroups:
- core.antrea.tanzu.vmware.com
resources:
- clustergroups/status
verbs:
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
25 changes: 24 additions & 1 deletion build/yamls/antrea.yml
Expand Up @@ -62,7 +62,15 @@ spec:
singular: group
scope: Cluster
versions:
- name: v1alpha2
- additionalPrinterColumns:
- description: The overall summary of realization status of the ClusterGroup.
jsonPath: .status.phase
name: Realization Status
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1alpha2
schema:
openAPIV3Schema:
properties:
Expand All @@ -79,9 +87,18 @@ spec:
podSelector:
x-kubernetes-preserve-unknown-fields: true
type: object
status:
properties:
observedGeneration:
type: integer
phase:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -1196,6 +1213,12 @@ rules:
- get
- watch
- list
- apiGroups:
- core.antrea.tanzu.vmware.com
resources:
- clustergroups/status
verbs:
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
6 changes: 6 additions & 0 deletions build/yamls/base/controller-rbac.yml
Expand Up @@ -153,6 +153,12 @@ rules:
- get
- watch
- list
- apiGroups:
- core.antrea.tanzu.vmware.com
resources:
- clustergroups/status
verbs:
- update
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
17 changes: 17 additions & 0 deletions build/yamls/base/crds.yml
Expand Up @@ -700,6 +700,14 @@ spec:
- name: v1alpha2
served: true
storage: true
additionalPrinterColumns:
- name: Realization Status
type: string
description: The overall summary of realization status of the ClusterGroup.
jsonPath: .status.phase
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
schema:
openAPIV3Schema:
type: object
Expand All @@ -717,6 +725,15 @@ spec:
cidr:
type: string
format: cidr
status:
type: object
properties:
phase:
type: string
observedGeneration:
type: integer
subresources:
status: {}
scope: Cluster
names:
plural: clustergroups
Expand Down
25 changes: 23 additions & 2 deletions pkg/apis/core/v1alpha2/types.go
Expand Up @@ -79,15 +79,17 @@ type ExternalEntityList struct {

// +genclient
// +genclient:nonNamespaced
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type ClusterGroup struct {
metav1.TypeMeta `json:",inline"`
// Standard metadata of the object.
metav1.ObjectMeta `json:"metadata,omitempty"`

// Desired state of the group.
Spec GroupSpec `json:"spec,omitempty"`
Spec GroupSpec `json:"spec"`
// Most recently observed status of the group.
Status GroupStatus `json:"status"`
}

type GroupSpec struct {
Expand All @@ -110,6 +112,25 @@ type GroupSpec struct {
IPBlock *secv1a1.IPBlock `json:"ipBlock,omitempty"`
}

// GroupPhase defines the phase in which a Group is.
type GroupPhase string

// These are the valid values for GroupPhase.
const (
// GroupPending means the Group has been accepted by the system, but it has not been processed by Antrea.
GroupPending GroupPhase = "Pending"
// GroupRealized means the Group has realized all of its GroupMembers.
GroupRealized GroupPhase = "Realized"
)

// GroupStatus represents information about the status of a Group.
type GroupStatus struct {
// The phase of a Group is a simple, high-level summary of the Group's status.
Phase GroupPhase `json:"phase"`
// The generation observed by Antrea.
ObservedGeneration int64 `json:"observedGeneration"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type ClusterGroupList struct {
Expand Down
19 changes: 18 additions & 1 deletion pkg/apis/core/v1alpha2/zz_generated.deepcopy.go

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

0 comments on commit 86c8106

Please sign in to comment.