Skip to content

Commit

Permalink
Update the sample
Browse files Browse the repository at this point in the history
Signed-off-by: clyang82 <[email protected]>
  • Loading branch information
clyang82 committed Jan 14, 2025
1 parent 6eb76f7 commit 070003a
Show file tree
Hide file tree
Showing 14 changed files with 154 additions and 144 deletions.
37 changes: 13 additions & 24 deletions operator/api/operator/v1alpha1/multiclusterglobalhubagent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ import (
// +kubebuilder:resource:shortName={mgha,mcgha}
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="The overall status of the MulticlusterGlobalHubAgent"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// MulticlusterGlobalHubAgent is the Schema for the multiclusterglobalhubagents API
type MulticlusterGlobalHubAgent struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec MulticlusterGlobalHubAgentSpec `json:"spec,omitempty"`
Status MulticlusterGlobalHubAgentStatus `json:"status,omitempty"`
}

// MulticlusterGlobalHubAgentSpec defines the desired state of MulticlusterGlobalHubAgent
type MulticlusterGlobalHubAgentSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Expand All @@ -54,16 +63,9 @@ type MulticlusterGlobalHubAgentSpec struct {
// Compute Resources required by the global hub agent
// +optional
Resources *shared.ResourceRequirements `json:"resources,omitempty"`
// TransportConfigSecretName specifies the secret which is used to connect to the global hub transport.
// You can fetch the information using the following commands from the global hub environment:
// cat <<EOF >./kafka.yaml
// bootstrap.server: $(kubectl get kafka kafka -n "multicluster-global-hub" -o jsonpath='{.status.listeners[1].bootstrapServers}')
// topic.status: gh-status.global-hub
// ca.crt: $(kubectl get kafka kafka -n "multicluster-global-hub" -o jsonpath='{.status.listeners[1].certificates[0]}' | { if [[ "$OSTYPE" == "darwin"* ]]; then base64 -b 0; else base64 -w 0; fi; })
// client.crt: $(kubectl get secret global-hub-kafka-user -n "multicluster-global-hub" -o jsonpath='{.data.user\.crt}')
// client.key: $(kubectl get secret global-hub-kafka-user -n "multicluster-global-hub" -o jsonpath='{.data.user\.key}')
// EOF
// You can create the secret `kubectl create secret generic transport-config -n "multicluster-global-hub" --from-file=kafka.yaml="./kafka.yaml"`
// TransportConfigSecretName specifies the secret which is used to connect to the global hub Kafka.
// You can get kafka.yaml content using `tools/generate-kafka-config.sh` from the global hub environment.
// Then you can create the secret in the current environment by running `kubectl create secret generic transport-config -n "multicluster-global-hub" --from-file=kafka.yaml="./kafka.yaml"`
// +kubebuilder:default=transport-config
TransportConfigSecretName string `json:"transportConfigSecretName,omitempty"`
}
Expand All @@ -74,20 +76,7 @@ type MulticlusterGlobalHubAgentStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// MulticlusterGlobalHubAgent is the Schema for the multiclusterglobalhubagents API
type MulticlusterGlobalHubAgent struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec MulticlusterGlobalHubAgentSpec `json:"spec,omitempty"`
Status MulticlusterGlobalHubAgentStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// +kubebuilder:object:root=true
// MulticlusterGlobalHubAgentList contains a list of MulticlusterGlobalHubAgent
type MulticlusterGlobalHubAgentList struct {
metav1.TypeMeta `json:",inline"`
Expand Down
8 changes: 0 additions & 8 deletions operator/api/operator/v1alpha1/zz_generated.deepcopy.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
Expand Up @@ -18,7 +18,9 @@ metadata:
"metadata": {
"name": "multiclusterglobalhubagent"
},
"spec": {}
"spec": {
"transportConfigSecretName": "transport-config"
}
},
{
"apiVersion": "operator.open-cluster-management.io/v1alpha4",
Expand All @@ -39,7 +41,7 @@ metadata:
categories: Integration & Delivery,OpenShift Optional
certified: "false"
containerImage: quay.io/stolostron/multicluster-global-hub-operator:latest
createdAt: "2024-11-06T07:58:55Z"
createdAt: "2025-01-14T10:57:00Z"
description: Manages the installation and upgrade of the Multicluster Global Hub.
features.operators.openshift.io/cnf: "false"
features.operators.openshift.io/cni: "false"
Expand Down Expand Up @@ -348,13 +350,16 @@ spec:
- ""
resources:
- configmaps
- serviceaccounts
- services
- namespaces
- persistentvolumeclaims
- pods
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
Expand All @@ -370,21 +375,6 @@ spec:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- namespaces
- persistentvolumeclaims
- pods
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,9 @@ spec:
transportConfigSecretName:
default: transport-config
description: |-
TransportConfigSecretName specifies the secret which is used to connect to the global hub transport.
You can fetch the information using the following commands from the global hub environment:
cat <<EOF >./kafka.yaml
bootstrap.server: $(kubectl get kafka kafka -n "multicluster-global-hub" -o jsonpath='{.status.listeners[1].bootstrapServers}')
topic.status: gh-status.global-hub
ca.crt: $(kubectl get kafka kafka -n "multicluster-global-hub" -o jsonpath='{.status.listeners[1].certificates[0]}' | { if [[ "$OSTYPE" == "darwin"* ]]; then base64 -b 0; else base64 -w 0; fi; })
client.crt: $(kubectl get secret global-hub-kafka-user -n "multicluster-global-hub" -o jsonpath='{.data.user\.crt}')
client.key: $(kubectl get secret global-hub-kafka-user -n "multicluster-global-hub" -o jsonpath='{.data.user\.key}')
EOF
You can create the secret `kubectl create secret generic transport-config -n "multicluster-global-hub" --from-file=kafka.yaml="./kafka.yaml"`
TransportConfigSecretName specifies the secret which is used to connect to the global hub Kafka.
You can get kafka.yaml content using `tools/generate-kafka-config.sh` from the global hub environment.
Then you can create the secret in the current environment by running `kubectl create secret generic transport-config -n "multicluster-global-hub" --from-file=kafka.yaml="./kafka.yaml"`
type: string
type: object
status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ spec:
resources:
description: Compute Resources required by this component
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Limits describes the maximum amount of compute resources allowed.
For more information, see: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
anyOf:
Expand All @@ -95,6 +106,17 @@ spec:
resources:
description: Compute Resources required by this component
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Limits describes the maximum amount of compute resources allowed.
For more information, see: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
anyOf:
Expand All @@ -116,6 +138,17 @@ spec:
resources:
description: Compute Resources required by this component
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Limits describes the maximum amount of compute resources allowed.
For more information, see: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
anyOf:
Expand All @@ -138,6 +171,17 @@ spec:
resources:
description: Compute Resources required by this component
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Limits describes the maximum amount of compute resources allowed.
For more information, see: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
anyOf:
Expand All @@ -159,6 +203,17 @@ spec:
resources:
description: Compute Resources required by this component
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Limits describes the maximum amount of compute resources allowed.
For more information, see: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
anyOf:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,9 @@ spec:
transportConfigSecretName:
default: transport-config
description: |-
TransportConfigSecretName specifies the secret which is used to connect to the global hub transport.
You can fetch the information using the following commands from the global hub environment:
cat <<EOF >./kafka.yaml
bootstrap.server: $(kubectl get kafka kafka -n "multicluster-global-hub" -o jsonpath='{.status.listeners[1].bootstrapServers}')
topic.status: gh-status.global-hub
ca.crt: $(kubectl get kafka kafka -n "multicluster-global-hub" -o jsonpath='{.status.listeners[1].certificates[0]}' | { if [[ "$OSTYPE" == "darwin"* ]]; then base64 -b 0; else base64 -w 0; fi; })
client.crt: $(kubectl get secret global-hub-kafka-user -n "multicluster-global-hub" -o jsonpath='{.data.user\.crt}')
client.key: $(kubectl get secret global-hub-kafka-user -n "multicluster-global-hub" -o jsonpath='{.data.user\.key}')
EOF
You can create the secret `kubectl create secret generic transport-config -n "multicluster-global-hub" --from-file=kafka.yaml="./kafka.yaml"`
TransportConfigSecretName specifies the secret which is used to connect to the global hub Kafka.
You can get kafka.yaml content using `tools/generate-kafka-config.sh` from the global hub environment.
Then you can create the secret in the current environment by running `kubectl create secret generic transport-config -n "multicluster-global-hub" --from-file=kafka.yaml="./kafka.yaml"`
type: string
type: object
status:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ spec:
resources:
description: Compute Resources required by this component
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Limits describes the maximum amount of compute resources allowed.
For more information, see: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
anyOf:
Expand All @@ -95,6 +106,17 @@ spec:
resources:
description: Compute Resources required by this component
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Limits describes the maximum amount of compute resources allowed.
For more information, see: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
anyOf:
Expand All @@ -116,6 +138,17 @@ spec:
resources:
description: Compute Resources required by this component
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Limits describes the maximum amount of compute resources allowed.
For more information, see: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
anyOf:
Expand All @@ -138,6 +171,17 @@ spec:
resources:
description: Compute Resources required by this component
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Limits describes the maximum amount of compute resources allowed.
For more information, see: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
anyOf:
Expand All @@ -159,6 +203,17 @@ spec:
resources:
description: Compute Resources required by this component
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: |-
Limits describes the maximum amount of compute resources allowed.
For more information, see: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
additionalProperties:
anyOf:
Expand Down
22 changes: 5 additions & 17 deletions operator/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ rules:
- ""
resources:
- configmaps
- serviceaccounts
- services
- namespaces
- persistentvolumeclaims
- pods
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
Expand All @@ -30,21 +33,6 @@ rules:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- namespaces
- persistentvolumeclaims
- pods
- secrets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
Expand Down
Loading

0 comments on commit 070003a

Please sign in to comment.