Skip to content

Commit

Permalink
fix setup and change to azureCloudConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
britaniar committed Nov 8, 2024
1 parent 4eeb3b7 commit ffc0979
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 29 deletions.
32 changes: 16 additions & 16 deletions charts/member-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ helm upgrade member-agent member-agent/ --namespace fleet-system

## Parameters

| Parameter | Description | Default |
|:-------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------|
| replicaCount | The number of member-agent replicas to deploy | `1` |
| image.repository | Image repository | `ghcr.io/azure/azure/fleet/member-agent` |
| image.pullPolicy | Image pullPolicy | `IfNotPresent` |
| image.tag | The image tag to use | `v0.1.0` |
| affinity | The node affinity to use for pod scheduling | `{}` |
| tolerations | The toleration to use for pod scheduling | `[]` |
| resources | The resource request/limits for the container image | limits: "2" CPU, 4Gi, requests: 100m CPU, 128Mi |
| namespace | Namespace that this Helm chart is installed on. | `fleet-system` |
| logVerbosity | Log level. Uses V logs (klog) | `3` |
| propertyProvider | The property provider to use with the member agent; if none is specified, the Fleet member agent will start with no property provider (i.e., the agent will expose no cluster properties, and collect only limited resource usage information) | `` |
| region | The region where the member cluster resides | `` |
| config.cloudConfig | The cloud provider configuration | **required if property provider is set to azure** |
| Parameter | Description | Default |
|:------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------|
| replicaCount | The number of member-agent replicas to deploy | `1` |
| image.repository | Image repository | `ghcr.io/azure/azure/fleet/member-agent` |
| image.pullPolicy | Image pullPolicy | `IfNotPresent` |
| image.tag | The image tag to use | `v0.1.0` |
| affinity | The node affinity to use for pod scheduling | `{}` |
| tolerations | The toleration to use for pod scheduling | `[]` |
| resources | The resource request/limits for the container image | limits: "2" CPU, 4Gi, requests: 100m CPU, 128Mi |
| namespace | Namespace that this Helm chart is installed on. | `fleet-system` |
| logVerbosity | Log level. Uses V logs (klog) | `3` |
| propertyProvider | The property provider to use with the member agent; if none is specified, the Fleet member agent will start with no property provider (i.e., the agent will expose no cluster properties, and collect only limited resource usage information) | `` |
| region | The region where the member cluster resides | `` |
| config.azureCloudConfig | The cloud provider configuration | **required if property provider is set to azure** |

## Override Azure cloud config

**If PropertyProvider feature is set to azure, then a cloud configuration is required.**
Cloud configuration provides resource metadata and credentials for `fleet-member-agent` to manipulate Azure resources.
It's embedded into a Kubernetes secret and mounted to the pods.
The values can be modified under `config.cloudConfig` section in values.yaml or can be provided as a separate file.
The values can be modified under `config.azureCloudConfig` section in values.yaml or can be provided as a separate file.


| configuration value | description | Remark |
Expand All @@ -71,7 +71,7 @@ You can create a file `azure.yaml` with the following content, and pass it to `h

```yaml
config:
cloudConfig:
azureCloudConfig:
cloud: "AzurePublicCloud"
tenantId: "00000000-0000-0000-0000-000000000000"
subscriptionId: "00000000-0000-0000-0000-000000000000"
Expand Down
2 changes: 1 addition & 1 deletion charts/member-agent/templates/cloudconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ metadata:
namespace: {{ .Values.namespace }}
type: Opaque
data:
config.json: {{ .Values.config.cloudConfig | toJson | indent 4 | b64enc | quote }}
config.json: {{ .Values.config.azureCloudConfig | toJson | indent 4 | b64enc | quote }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/member-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ config:
identityKey: "identity-key-path"
identityCert: "identity-cert-path"
CABundle: "ca-bundle-path"
cloudConfig:
azureCloudConfig:
cloud: ""
tenantId: ""
subscriptionId: ""
Expand Down
10 changes: 2 additions & 8 deletions cmd/memberagent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import (
"go.goms.io/fleet/pkg/propertyprovider"
"go.goms.io/fleet/pkg/propertyprovider/azure"
"go.goms.io/fleet/pkg/utils"
azureCloudConfig "go.goms.io/fleet/pkg/utils/cloudconfig/azure"
"go.goms.io/fleet/pkg/utils/httpclient"
//+kubebuilder:scaffold:imports
)
Expand Down Expand Up @@ -369,13 +368,8 @@ func Start(ctx context.Context, hubCfg, memberConfig *rest.Config, hubOpts, memb
klog.V(2).Info("setting up the Azure property provider")
// Note that the property provider, though initialized here, is not started until
// the specific instance wins the leader election.
cloudConfig, err := azureCloudConfig.NewCloudConfigFromFile(*cloudConfigFile)
if err != nil {
klog.ErrorS(err, "Unable to load cloud config", "file name", *cloudConfigFile)
return fmt.Errorf("unable to load cloud config: %w", err)
}
cloudConfig.SetUserAgent("fleet-member-agent")
klog.V(1).InfoS("Cloud config loaded successfully", "config", cloudConfig)
klog.V(1).InfoS("Property Provider is azure, loading cloud config", "cloudConfigFile", *cloudConfigFile)
// TODO (britaniar): load cloud config for Azure property provider.
pp = azure.New(region)
default:
// Fall back to not using any property provider if the provided type is none or
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/azure_valid_config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
config:
cloudConfig:
azureCloudConfig:
cloud: "AzurePublicCloud"
tenantId: "00000000-0000-0000-0000-000000000000"
subscriptionId: "00000000-0000-0000-0000-000000000000"
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ do
--set enableV1Beta1APIs=true \
--set propertyProvider=$PROPERTY_PROVIDER \
--set region=${REGIONS[$i]} \
-f azure_valid_config.yaml
$( [ "$PROPERTY_PROVIDER" = "azure" ] && echo "-f azure_valid_config.yaml" )
else
helm install member-agent ../../charts/member-agent/ \
--set config.hubURL=$HUB_SERVER_URL \
Expand All @@ -202,7 +202,7 @@ do
--set enableV1Alpha1APIs=false \
--set enableV1Beta1APIs=true \
--set propertyProvider=$PROPERTY_PROVIDER \
-f azure_valid_config.yaml
$( [ "$PROPERTY_PROVIDER" = "azure" ] && echo "-f azure_valid_config.yaml" )
fi
done

0 comments on commit ffc0979

Please sign in to comment.