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

Create Credentials Secret #158

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ ENVTEST_K8S_VERSION = 1.28
# OCP Version: for OKD bundle community
OCP_VERSION = 4.14

# Run unit tests once unless this parameter is set
REPEAT_TIMES ?= 1
# update for major version updates to YQ_VERSION! see https://github.com/mikefarah/yq
YQ_API_VERSION = v4
YQ_VERSION = v4.44.2
Expand Down Expand Up @@ -196,7 +198,8 @@ test: test-no-verify ## Generate and format code, run tests, generate manifests
# --vv: If set, emits with maximal verbosity - includes skipped and pending tests.
test-no-verify: go-verify manifests generate fmt vet fix-imports envtest ginkgo # Generate and format code, and run tests
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(ENVTEST_DIR)/$(ENVTEST_VERSION) -p path)" \
$(GINKGO) -r --keep-going --randomize-all --require-suite --vv --coverprofile cover.out ./api/... ./pkg/... ./controllers/...
$(GINKGO) -r --keep-going --randomize-all --require-suite --vv --coverprofile cover.out --repeat=$(REPEAT_TIMES) \
./api/... ./pkg/... ./controllers/...

.PHONY: bundle-run
bundle-run: operator-sdk create-ns ## Run bundle image. Default NS is "openshift-workload-availability", redefine OPERATOR_NAMESPACE to override it.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ The FAR CR, `FenceAgentsRemediation`, is created by the admin and is used to tri
The CR includes the following parameters:

* `agent` - fence agent name. File name which is validated (by kubebuilder and Webhook) against a list of supported agents in the FAR pod.
* `credentialarameters` - credential parameters for accessing the node to be remediated.
* `sharedparameters` - cluster wide parameters for executing the fence agent.
* `nodeparameters` - node specific parameters for executing the fence agent.
* `retrycount` - number of times to retry the fence agent in case of failure. The default is 5.
Expand All @@ -209,9 +210,10 @@ spec:
retrycount: 5
retryinterval: "5s"
timeout: "60s"
credentialparameters:
--password
sharedparameters:
--username: "admin"
--password: "password"
--lanplus: ""
--action: "reboot"
--ip: "192.168.111.1"
Expand All @@ -223,7 +225,7 @@ spec:
worker-0: "6233"
worker-1: "6234"
worker-2: "6235"
remediationStrategy: ResourceDeletion
remediationStrategy: OutOfServiceTaint
```

## Tests
Expand Down
8 changes: 7 additions & 1 deletion api/v1alpha1/fenceagentsremediation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,20 @@ type FenceAgentsRemediationSpec struct {
//+operator-sdk:csv:customresourcedefinitions:type=spec
Timeout metav1.Duration `json:"timeout,omitempty"`

// SharedParameters are passed to the fencing agent regardless of which node is about to be fenced (i.e., they are common for all the nodes)
// SharedParameters are passed to the fencing agent regardless of which node is about to be fenced
// (i.e., they are common for all the nodes)
//+operator-sdk:csv:customresourcedefinitions:type=spec
SharedParameters map[ParameterName]string `json:"sharedparameters,omitempty"`

// NodeParameters are passed to the fencing agent according to the node that is fenced, since they are node specific
//+operator-sdk:csv:customresourcedefinitions:type=spec
NodeParameters map[ParameterName]map[NodeName]string `json:"nodeparameters,omitempty"`

// CredentialParameters are passed to the fencing agent according to the node that is fenced, and the parameters
// values are fetched from a known secret
//+operator-sdk:csv:customresourcedefinitions:type=spec
CredentialParameters []ParameterName `json:"credentialparameters,omitempty"`

// RemediationStrategy is the remediation method for unhealthy nodes.
// Currently, it could be either "OutOfServiceTaint" or "ResourceDeletion".
// ResourceDeletion will iterate over all pods related to the unhealthy node and delete them.
Expand Down
5 changes: 5 additions & 0 deletions api/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 @@ -80,6 +80,11 @@ spec:
have a fence_ prefix.
displayName: Agent
path: agent
- description: CredentialParameters are passed to the fencing agent according
to the node that is fenced, and the parameters values are fetched from a
known secret
displayName: Credential Parameters
path: credentialparameters
- description: NodeParameters are passed to the fencing agent according to the
node that is fenced, since they are node specific
displayName: Node Parameters
Expand Down Expand Up @@ -136,6 +141,11 @@ spec:
have a fence_ prefix.
displayName: Agent
path: template.spec.agent
- description: CredentialParameters are passed to the fencing agent according
to the node that is fenced, and the parameters values are fetched from a
known secret
displayName: Credential Parameters
path: template.spec.credentialparameters
- description: NodeParameters are passed to the fencing agent according to the
node that is fenced, since they are node specific
displayName: Node Parameters
Expand Down Expand Up @@ -206,6 +216,14 @@ spec:
- list
- update
- watch
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ spec:
It should have a fence_ prefix.
pattern: fence_.+
type: string
credentialparameters:
description: |-
CredentialParameters are passed to the fencing agent according to the node that is fenced, and the parameters
values are fetched from a known secret
items:
type: string
type: array
nodeparameters:
additionalProperties:
additionalProperties:
Expand Down Expand Up @@ -84,9 +91,9 @@ spec:
sharedparameters:
additionalProperties:
type: string
description: SharedParameters are passed to the fencing agent regardless
of which node is about to be fenced (i.e., they are common for all
the nodes)
description: |-
SharedParameters are passed to the fencing agent regardless of which node is about to be fenced
(i.e., they are common for all the nodes)
type: object
timeout:
default: 60s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ spec:
It should have a fence_ prefix.
pattern: fence_.+
type: string
credentialparameters:
description: |-
CredentialParameters are passed to the fencing agent according to the node that is fenced, and the parameters
values are fetched from a known secret
items:
type: string
type: array
nodeparameters:
additionalProperties:
additionalProperties:
Expand Down Expand Up @@ -93,9 +100,9 @@ spec:
sharedparameters:
additionalProperties:
type: string
description: SharedParameters are passed to the fencing agent
regardless of which node is about to be fenced (i.e., they
are common for all the nodes)
description: |-
SharedParameters are passed to the fencing agent regardless of which node is about to be fenced
(i.e., they are common for all the nodes)
type: object
timeout:
default: 60s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ spec:
It should have a fence_ prefix.
pattern: fence_.+
type: string
credentialparameters:
description: |-
CredentialParameters are passed to the fencing agent according to the node that is fenced, and the parameters
values are fetched from a known secret
items:
type: string
type: array
nodeparameters:
additionalProperties:
additionalProperties:
Expand Down Expand Up @@ -82,9 +89,9 @@ spec:
sharedparameters:
additionalProperties:
type: string
description: SharedParameters are passed to the fencing agent regardless
of which node is about to be fenced (i.e., they are common for all
the nodes)
description: |-
SharedParameters are passed to the fencing agent regardless of which node is about to be fenced
(i.e., they are common for all the nodes)
type: object
timeout:
default: 60s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ spec:
It should have a fence_ prefix.
pattern: fence_.+
type: string
credentialparameters:
description: |-
CredentialParameters are passed to the fencing agent according to the node that is fenced, and the parameters
values are fetched from a known secret
items:
type: string
type: array
nodeparameters:
additionalProperties:
additionalProperties:
Expand Down Expand Up @@ -91,9 +98,9 @@ spec:
sharedparameters:
additionalProperties:
type: string
description: SharedParameters are passed to the fencing agent
regardless of which node is about to be fenced (i.e., they
are common for all the nodes)
description: |-
SharedParameters are passed to the fencing agent regardless of which node is about to be fenced
(i.e., they are common for all the nodes)
type: object
timeout:
default: 60s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ spec:
have a fence_ prefix.
displayName: Agent
path: agent
- description: CredentialParameters are passed to the fencing agent according
to the node that is fenced, and the parameters values are fetched from a
known secret
displayName: Credential Parameters
path: credentialparameters
- description: NodeParameters are passed to the fencing agent according to the
node that is fenced, since they are node specific
displayName: Node Parameters
Expand Down Expand Up @@ -91,6 +96,11 @@ spec:
have a fence_ prefix.
displayName: Agent
path: template.spec.agent
- description: CredentialParameters are passed to the fencing agent according
to the node that is fenced, and the parameters values are fetched from a
known secret
displayName: Credential Parameters
path: template.spec.credentialparameters
- description: NodeParameters are passed to the fencing agent according to the
node that is fenced, since they are node specific
displayName: Node Parameters
Expand Down
8 changes: 8 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ rules:
- list
- update
- watch
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
Loading