Skip to content

Commit adc40b3

Browse files
authored
Add option to pass env for cluster-profile-manager (#48)
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 51135ef commit adc40b3

File tree

10 files changed

+274
-75
lines changed

10 files changed

+274
-75
lines changed

apis/installer/v1alpha1/cluster_profile_manager_types.go

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20+
core "k8s.io/api/core/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
"kmodules.xyz/resource-metadata/apis/shared"
2223
)
@@ -74,8 +75,26 @@ type AceOcmAddonsPlatformSpec struct {
7475
type AppImage struct {
7576
Image string `json:"image"`
7677
// +optional
77-
Tag string `json:"tag"`
78-
ImagePullPolicy string `json:"imagePullPolicy"`
78+
Tag string `json:"tag"`
79+
ImagePullPolicy string `json:"imagePullPolicy"`
80+
SecurityContext *core.SecurityContext `json:"securityContext"`
81+
// List of sources to populate environment variables in the container.
82+
// The keys defined within a source must be a C_IDENTIFIER. All invalid keys
83+
// will be reported as an event when the container is starting. When a key exists in multiple
84+
// sources, the value associated with the last source will take precedence.
85+
// Values defined by an Env with a duplicate key will take precedence.
86+
// Cannot be updated.
87+
// +optional
88+
// +listType=atomic
89+
EnvFrom []core.EnvFromSource `json:"envFrom"`
90+
// List of environment variables to set in the container.
91+
// Cannot be updated.
92+
// +optional
93+
// +patchMergeKey=name
94+
// +patchStrategy=merge
95+
// +listType=map
96+
// +listMapKey=name
97+
Env []core.EnvVar `json:"env"`
7998
}
8099

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

apis/installer/v1alpha1/hub_cluster_robot_types.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,28 @@ import (
2121
)
2222

2323
const (
24-
ResourceKindHubManagerRobot = "HubManagerRobot"
25-
ResourceHubManagerRobot = "hubmanagerrobot"
26-
ResourceHubManagerRobots = "hubmanagerrobots"
24+
ResourceKindHubClusterRobot = "HubClusterRobot"
25+
ResourceHubClusterRobot = "hubclusterrobot"
26+
ResourceHubClusterRobots = "hubclusterrobots"
2727
)
2828

29-
// HubManagerRobot defines the schama for HubManagerRobot.
29+
// HubClusterRobot defines the schama for HubClusterRobot.
3030

3131
// +genclient
3232
// +genclient:skipVerbs=updateStatus
3333
// +k8s:openapi-gen=true
3434
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
3535

3636
// +kubebuilder:object:root=true
37-
// +kubebuilder:resource:path=hubmanagerrobots,singular=hubmanagerrobot,categories={kubeops,appscode}
38-
type HubManagerRobot struct {
37+
// +kubebuilder:resource:path=hubclusterrobots,singular=hubclusterrobot,categories={kubeops,appscode}
38+
type HubClusterRobot struct {
3939
metav1.TypeMeta `json:",inline,omitempty"`
4040
metav1.ObjectMeta `json:"metadata,omitempty"`
41-
Spec HubManagerRobotSpec `json:"spec,omitempty"`
41+
Spec HubClusterRobotSpec `json:"spec,omitempty"`
4242
}
4343

44-
// HubManagerRobotSpec is the schema for Identity Server values file
45-
type HubManagerRobotSpec struct {
44+
// HubClusterRobotSpec is the schema for Identity Server values file
45+
type HubClusterRobotSpec struct {
4646
//+optional
4747
NameOverride string `json:"nameOverride"`
4848
//+optional
@@ -56,10 +56,10 @@ type HubManagerRobotSpec struct {
5656

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

59-
// HubManagerRobotList is a list of HubManagerRobots
60-
type HubManagerRobotList struct {
59+
// HubClusterRobotList is a list of HubClusterRobots
60+
type HubClusterRobotList struct {
6161
metav1.TypeMeta `json:",inline"`
6262
metav1.ListMeta `json:"metadata,omitempty"`
63-
// Items is a list of HubManagerRobot CRD objects
64-
Items []HubManagerRobot `json:"items,omitempty"`
63+
// Items is a list of HubClusterRobot CRD objects
64+
Items []HubClusterRobot `json:"items,omitempty"`
6565
}

apis/installer/v1alpha1/register.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
6363
&ClusterManagerSpokeList{},
6464
&ClusterProfileManager{},
6565
&ClusterProfileManagerList{},
66-
&HubManagerRobot{},
67-
&HubManagerRobotList{},
66+
&HubClusterRobot{},
67+
&HubClusterRobotList{},
6868
)
6969

7070
scheme.AddKnownTypes(SchemeGroupVersion,

apis/installer/v1alpha1/types_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ func TestDefaultValues(t *testing.T) {
3030
sc.TestCase{Obj: v1alpha1.ClusterAuthManagerSpec{}},
3131
sc.TestCase{Obj: v1alpha1.ClusterManagerHubSpec{}},
3232
sc.TestCase{Obj: v1alpha1.ClusterManagerSpokeSpec{}},
33+
sc.TestCase{Obj: v1alpha1.ClusterProfileManagerSpec{}},
34+
sc.TestCase{Obj: v1alpha1.HubClusterRobotSpec{}},
3335
)
3436
checker.TestAll(t)
3537
}

apis/installer/v1alpha1/zz_generated.deepcopy.go

Lines changed: 55 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/cluster-profile-manager/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ The following table lists the configurable parameters of the `cluster-profile-ma
5353
| manager.tag | | <code>""</code> |
5454
| manager.imagePullPolicy | | <code>Always</code> |
5555
| manager.securityContext | | <code>{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"privileged":false,"readOnlyRootFilesystem":true,"runAsNonRoot":true,"seccompProfile":{"type":"RuntimeDefault"}}</code> |
56+
| manager.envFrom | List of sources to populate environment variables in the container | <code>[]</code> |
57+
| manager.env | List of environment variables to set in the container | <code>[]</code> |
5658
| kubeconfigSecretName | | <code>""</code> |
5759
| addonManagerNamespace | | <code>open-cluster-management-addon</code> |
5860
| placement.create | | <code>true</code> |

charts/cluster-profile-manager/templates/deployment.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ spec:
3131
- --kubeconfig=/var/run/secrets/ocm/auth/kubeconfig
3232
{{- end }}
3333
- --registryFQDN={{ .Values.registryFQDN }}
34+
{{- with .Values.manager.envFrom }}
35+
envFrom:
36+
{{- toYaml . | nindent 12 }}
37+
{{- end }}
3438
env:
39+
{{- with .Values.manager.env }}
40+
{{- toYaml . | nindent 12 }}
41+
{{- end }}
3542
- name: POD_NAME
3643
valueFrom:
3744
fieldRef:

0 commit comments

Comments
 (0)